Core Optical, Inc.
SourceData GetBitmapSourceArray Method Industrial Strength, Scientific Grade
Retrieves an array of pixel values representing the source data.

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

public Array GetBitmapSourceArray(
	OutputWindowing outputWindowing = null,
	GammaEncoding gammaEncoding = GammaEncoding.sRGB,
	Int32Rect regionOfInterest = null,
	float fixedAlphaValue = -1f
)

Parameters

outputWindowing (Optional)
Type: PrecisionImage.Visualization OutputWindowing
An OutputWindowing type that allows independent windowing of the r/g/b/a/ channels. This parameter is optional and defaults to th standard range (0.0 - 1.0) clipping values.
gammaEncoding (Optional)
Type: PrecisionImage GammaEncoding
A GammaEncoding enumeration specifying the type of gamma encoding to apply to the scaled values. This parameter is optional and defaults to sRGB.
regionOfInterest (Optional)
Type: OnlineSystem.Windows Int32Rect
A OnlineInt32Rect indicating the zero-based row and column coordinates of the region to process. This parameter is optional and defaults to the entire image.
fixedAlphaValue (Optional)
Type: OnlineSystem Single
A OnlineSingle type that represents a fixed alpha value to apply to the alpha channel of the output array. This parameter is optional and defaults to no fixed value.

Return Value

A one-dimensional OnlineArray type containing the pixel values in the specified format.
Exceptions

ExceptionCondition
OnlineSystem ArgumentOutOfRangeException Thrown when regionOfInterest specifies a rectangular region not completely contained within the dimensions of the source data.
OnlineSystem ArgumentException Thrown when no output OnlinePixelFormat is currently associated with the SourceData object.
OnlineSystem ArgumentOutOfRangeException Thrown when fixedAlphaValue specifies a value not within the range of 0.0 and 1.0 inclusive.
Remarks

Use this method to retrieve an OnlineArray containing the pixel values representing the source data. The returned OnlineArray object is one dimensional and its element type is dependent on the CurrentPixelFormat property of the SourceData object. For example, if a given SourceData object has a CurrentPixelFormat property set to OnlineRgb48, the returned OnlineArray object consists of elements of type OnlineUInt16 with the pixel values represented in the array as sequential triplets of red/green/blue values. The beginning of the array corresponds to (row, column) = (0,0) of the SourceData object. The channels used as the source data for red/green/blue values are controlled via the RedChannelIndex, GreenChannelIndex, BlueChannelIndex and (optionally) AlphaChannelIndex methods. These channels do not have to be exclusive i.e. all 4 red/green/blue/alpha channel indices can be the same index value if desired. If a uniform alpha value is desired, assign a value between 0.0 (fully transparent) and 1.0 (fully opaque) to the optional fixedAlphaValue argument.

If no pixel format is currently with the SourceData object then an 8-bit grayscale depiction of the data in channel 0 is returned by default.

If the the current OnlinePixelFormat is a grey-scale type format the data for the image is automatically sourced from channel 0. To retrieve a grayscale image from another channel in the SourceData object, use either the GetChannelImage(GrayBitDepth, Int32, GammaEncoding, OutputWindowing, Int32Rect) method or the GetChannelImage(GrayBitDepth, Int32, BinaryMask, GammaEncoding, OutputWindowing, OutputWindowing, Int32Rect) method.

The optional outputWindowing argument can be used to apply channel-specific windowing to the red/green/blue/alpha channels. If this argument is not specified the default range of 0.0 - 1.0 is applied to all channels.

This method is most useful in cases where either a OnlineWriteableBitmap object is being used for live image display, or some other control is being used that does not take a OnlineBitmapSource derived type as its input.

See Also