Core Optical, Inc.
VariableSaturationColorScheme ClassIndustrial Strength, Scientific Grade
A type encapsulating a variable-saturation tuneable pseudocoloring algorithm
Inheritance Hierarchy

OnlineSystem Object
  PrecisionImage.Visualization VariableSaturationColorScheme

Namespace: PrecisionImage.Visualization
Assembly: PrecisionImage (in PrecisionImage.dll) Version: (

public class VariableSaturationColorScheme

The VariableSaturationColorScheme is a modern pseudocoloring method that allows for the independant assignment of data to the hue, intensity and saturation channels of a color output. This allows for a flexible visualization scheme that can be tuned (optimized) for a given application and/or specific source data. The hue data is normalized within its local minimum and maximum values and linearly mapped to a specified hue angle range. The intensity and saturation data is normalized within their local minimum and maximum values prior to being linearly mapped to the intensity and saturation channels. The normalization ranges can be overriden if desired by specifying an OutputWindowing object to use for the mapping range. The resulting color at each data point is generated in the HSI (Hue-Saturation-Intensity) color space and is converted internally to sRGB prior to being output as either a OnlineBitmapSource image or an OnlineArray type.


The following example illustrates the use of the VariableSaturationColorScheme class.

using PrecisionImage;
using PrecisionImage.HistogramProcessing;
using PrecisionImage.Visualization;
using PrecisionImage.BinarizationAndMorphology;

// Load the image: 
Uri imageUri                   = new Uri("RabbitXray.tif", UriKind.Relative);
TiffBitmapDecoder imageDecoder = new TiffBitmapDecoder(imageUri, BitmapCreateOptions.PreservePixelFormat, BitmapCacheOption.Default);
BitmapSource SourceImage       = imageDecoder.Frames[0];
image0.Source                  = SourceImage; // Display x-ray 

// Load x-ray data into SourceData object: 
SourceData xrayData = new SourceData(SourceImage, GammaEncoding.None);

// Instantiate a binary mask to force processing to bypass null-signal areas: 
BinaryMask Mask = new BinaryMask(SourceImage, 41, true);

// Clone the xray data into a second SourceData object and invert it: 
SourceData invertedXray = xrayData.Clone();

// Apply an adaptive histogram equalization in-place to the original x-ray image: 
HistogramProcessor histProcessor = new HistogramProcessor();
histProcessor.AdaptivelyEqualizeHistogramInPlace(xrayData, 0, 60, 0.01f, binaryMask: Mask);

// Instantiate a new VariableSaturationColorScheme object to generate the pseudocolored image: 
VariableSaturationColorScheme colorScheme = new VariableSaturationColorScheme();

// Assign the hue, saturation and intensity data:
colorScheme.AssignHueData(invertedXray, 0);
colorScheme.AssignSaturationData(invertedXray, 0);
colorScheme.AssignIntensityData(xrayData, 0);

// Set the hue angles used for rendering:
colorScheme.HueStartAngle = 160;
colorScheme.HueStopAngle  = 315;

// Display an 8-bit result using the binary mask to sreen out null-signal areas:
image1.Source = colorScheme.GetPseudocolorImage(ColorBitDepth.EightBit, binaryMask: Mask);

The above example generates the following images:

See Also