Core Optical, Inc.
Utilities RescaleData Method Industrial Strength, Scientific Grade
Linearly rescales the data in-place to a new range.

Namespace: PrecisionImage
Assembly: PrecisionImage (in PrecisionImage.dll) Version: 2.0.0.0 (2.0.0.0)
Syntax

public static void RescaleData(
	SourceData sourceData,
	int channel,
	float sourceLowerLimit,
	float sourceUpperLimit,
	float targetLowerLimit,
	float targetUpperLimit,
	Int32Rect regionOfInterest = null,
	BinaryMask binaryMask = null
)

Parameters

sourceData
Type: PrecisionImage SourceData
A SourceData object containing the data to operate on.
channel
Type: OnlineSystem Int32
An OnlineInt32 type indicating the channel to operate on.
sourceLowerLimit
Type: OnlineSystem Single
A OnlineSingle type indcating the lower limit (inclusive) of the source range to rescale.
sourceUpperLimit
Type: OnlineSystem Single
A OnlineSingle type indicating the upper limit (inclusive) of the source range to rescale.
targetLowerLimit
Type: OnlineSystem Single
A OnlineSingle type indicating the lower limit (inclusive) of the target range.
targetUpperLimit
Type: OnlineSystem Single
A OnlineSingle type indicating the upper limit (inclusive) of the target range.
regionOfInterest (Optional)
Type: OnlineSystem.Windows Int32Rect
An OnlineInt32Rect type indicating the region of interest. Coordinates are zero-index based. This parameter is optional and defaults to the entire image.
binaryMask (Optional)
Type: PrecisionImage.BinarizationAndMorphology BinaryMask
A BinaryMask object indicating areas to bypass. Default is no mask.
Exceptions

ExceptionCondition
OnlineSystem ArgumentNullException Thrown when sourceData is null.
OnlineSystem ArgumentOutOfRangeException Thrown when channel refers to a channel that does not exist in sourceData.
OnlineSystem ArgumentException Thrown when the dimensions of binaryMask do not match those of sourceData.
OnlineSystem ArgumentOutOfRangeException Thrown when regionOfInterest specifies a region not completely contained within the input data.
OnlineSystem ArgumentOutOfRangeException Thrown when sourceLowerLimit, sourceUpperLimit, targetLowerLimit and/or targetUpperLimit is NaN, or when sourceLowerLimit is not less than sourceUpperLimit and/or targetLowerLimit is not less than targetUpperLimit.
Remarks

Use this method to linearly rescale the data from one range to another. The sourceLowerLimit and sourceUpperLimit values specify the limits of the source data that define the value range in sourceData to map to the new scale. The targetLowerLimit and targetUpperLimit values specify the target range to which the source values are mapped. Any source value falling below sourceLowerLimit is clamped to the targetLowerLimit value. Likewise, any source value falling above sourceUpperLimit is clamped to the targetUpperLimit value. All other source values are linearly rescaled to the new target range.
Examples

The following example rescales the data in the first channel (channel zero) of sourceData1 from the range of (0 - 65535) to the new range of (0.0 - 1.0). All source data values that are initially below 0 or greater than 65535 are clamped to the new range limits of 0 and 1.0, respectively.

Int32 Channel0 = 0;
Utilitites.RescaleData(sourceData1, Channel0, 0, 65535, 0, 1);

See Also