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

OnlineSystem Object
  PrecisionImage.Visualization ConstantSaturationColorScheme

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

public class ConstantSaturationColorScheme

The ConstantSaturationColorScheme is a modern pseudocoloring method that allows for the independant assignment of data to both the hue and intensity channels of a color output. The saturation is specified as a fixed value. 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 then linearly mapped to a specified hue angle range. The intensity data is normalized within its local minimum and maximum values prior to being linearly mapped. 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 ConstantSaturationColorScheme class.

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

// Load the image: 
Uri imageUri                   = new Uri("DentalXray.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);

// 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 (an optional enhancement not necessary for pseudocoloring): 
HistogramProcessor histProcessor = new HistogramProcessor();
histProcessor.AdaptivelyEqualizeHistogramInPlace(xrayData, 0, 35, 0.008f);

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

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

// Set the hue angles used for rendering:
colorScheme.HueStartAngle = 0;
colorScheme.HueStopAngle  = 260;

// Set the saturation value to 0.7:
colorScheme.Saturation = 0.7f;

// Acquire an 8-bit BitmaapSource of the pseudocolored data and assign it to the image control for viewing:
image1.Source = colorScheme.GetPseudocolorImage(ColorBitDepth.EightBit);

The above example generates the following images:

See Also