LEAD Technologies, Inc

Grayscale Images

LEADTOOLS for .NET provides a number of classes/methods for working with grayscale images. Many of these classes/methods work on either grayscale images or color images. Some of the LEADTOOLS classes/methods however, are designed specifically for use with grayscale images, either creating a grayscale image, getting information about a grayscale image, or window-leveling.

Creating and working with grayscale images

A color image can be converted to a grayscale image using the GrayscaleCommand class. The GrayScaleExtendedCommand class converts an image to a grayscale image, but provides the user the ability to control the calculation of the grayscale pixel value by giving the R, G and B components different "weights" when calculating the grayscale value.

LEADTOOLS also provides the ConvertToColoredGrayCommand class which converts an image into a grayscale image, while allowing the user to add color effects. This creates an image with an "old-fashioned" look. An 8, 12 or 16-bit grayscale image can also be colorized using ColorizeGrayCommand.

The GrayScaleToDuotoneCommand class converts a grayscale image into a colored one by mixing or replacing the original values of the pixels with new colors.

The GrayScaleToMultitoneCommand converts a grayscale image into a colored one by mixing or replacing the original values of the pixels with one or more new colors.

The CreateAlphaImage method creates a grayscale image from the alpha channel information of an image.

The DesaturateCommand class converts the image to a grayscale level by reducing the saturation of each color to zero. The conversion will not change the color resolution.

The ShiftDataCommand class selects a specified number of bits from an 8, 12 or 16-bit grayscale image into a mask and places the mask in a new 8, 12 or 16-bit grayscale image. The SelectDataCommand class selects a specified number of bits of an 8, 12 or 16-bit grayscale image and puts them into a mask, then colors the image depending on the mask. This can show image variances depending on user-defined conditions.

Loading raw 12- and 16-bit extended grayscale images (Document/Medical only)

To load a raw 12- and 16-bit extended grayscale image, set the Codecs.InformationEventArgs.Order property to RasterByteOrder.Gray and the CodecsLoadInformationEventArgs.LeastSignificantBitFirst Property accordingly. For signed image data, set the CodecsLoadInformationEventArgs.Signed property to true.

Getting information about grayscale images

LEADTOOLS also provides functions for getting information about grayscale images. The MinMaxBitsCommand class provides information on the minimum and maximum bit set in a 12 or 16 - bit grayscale image. The MinMaxValuesCommand class gets the minimum and maximum intensity values present in a 12 or 16-bit grayscale image. Please note that support for 12 and 16-bit grayscale images is only available in Document/Medical toolkits. To get a full histogram of a 12 or 16-bit grayscale image, use HistogramCommand.

To determine the kind of grayscale palette associated with an image, if any, use GrayscaleMode.

Window-leveling (Medical only)

Window-leveling is only valid for 12 and 16-bit grayscale images, and is used to map grayscale intensities by specifying the bit range and/or a user-defined color map. Two classes/methods are provided for window-leveling. WindowLevel provides "on demand" window-leveling for the paint functions and does not alter the image, and WindowLevelCommand converts the image to a window leveled 8 or 24 bit RGB image. The bit range is passed to the methods through LowBit and HighBit and the user-defined color map is passed through LookupTable. To help set up a bit range and a color map, use MinMaxBitsCommand and MinMaxValuesCommand. MinMaxBitsCommand gets the minimum and maximum bits of the values present in a 12 or 16-bit grayscale image. MinMaxValuesCommand gets the minimum and maximum intensity values of the image. WindowLevelFillLookupTable fills the user-allocated LookupTable (LUT) with a color gradient based on the specified values.

LEADTOOLS supports two types of LUTs for 10-16-bit grayscale images (8-bit LUT and 16-bit LUT). Typical grayscale image display and processing is done using an 8-bit LUT. But, you can also use a 16-bit LUT, which offers more precision. Some special video cards and monitors also support display of grayscale images using a 16-bit LUT.

Window-leveling applied with the WindowLevelCommand class can be saved to TIF or DICOM formats without changing the image data. For more information, refer to Saving Window-Leveled Images.

Color Halftone and Halftone Images

LEADTOOLS provides a number of commands for working with color images and changing them so they are suitable for printing using halftoning techniques. For more information about these commands, refer to Color Halftone and Halftone Images.

 

 


Products | Support | Contact Us | Copyright Notices

© 2006-2012 All Rights Reserved. LEAD Technologies, Inc.