ImageGear Professional for Linux
Displaying Medical Grayscale Images

Many medical images use more than 8 bits per grayscale pixel. The main concern in displaying such images is that commonly used monitors can display only 256 shades of gray, which corresponds to 8 bits per pixel. The 16-bit pixels need to be mapped in some way to 8-bit pixels. ImageGear uses two approaches for this mapping.

If a 9..16 bit grayscale image has been loaded from a non-DICOM file, its pixels are mapped to 8g by left shifting the pixels by (n-8), where n is the bit depth of the image. For example, if the image has 12 bits per pixel, its pixels will be left shifted by 4 bits, so the 8 most significant bits of the 12-bit pixel will be used. This mapping is done only for image display, and does not affect the image stored in memory.

When ImageGear loads a DICOM image, it creates a 16-bit to 8-bit, or 8-bit to 8-bit display Look-Up Table (16x8 LUT or 8x8 LUT), and attaches it to the image. This LUT gives more flexibility in displaying medical images, allowing to display a certain range of pixel intensities with best contrast.

DICOM image files may contain several Look-Up Tables that describe how the image shall be displayed. "Modality" LUT specifies transform of image pixels into modality meaningful values, such as optical density or Hounsfield Units. "Value of Interest" LUT (VOI LUT) specifies what range of pixel intensities should be shown on the screen. Most often, both these LUTs are linear, and thus are presented by a pair of values that are similar to brightness and contrast. For Modality LUT, these are Rescale Intercept (0028, 1053) and Rescale Slope (0028, 1053). For VOI LUT, these are Window Center (0028, 1050) and Window Width (0028, 1051). The standard also allows the usage of non-linear LUTs. These LUTs are represented as an array of values that map source image intensities to the output range.

If all of these values are found in the file, they are all used to build the 16x8 LUT. If Rescale values are not found, default values (Intercept = 0.0, Slope=1.0) are substituted. If VOI LUT values are not found, the image is scanned for min and max pixel intensities, and the LUT is built to display the min intensity as black and max intensity as white. The values between min and max are linearly scaled between black and white.

You can adjust the values in the 16x8 LUT using MED_display_...() functions.

Grayscale LUTs can be attached to a HIGEAR or to a Display Group. In the latter case, if you are using multiple Display Groups corresponding to the same HIGEAR, they can have different LUTs, allowing to display the same image with different contrast settings simultaneously, in different windows. See the "Medical Component Grayscale Look-Up Tables" section below for more details.

Grayscale LUTs (16x8, 8x8) only work with grayscale images. They do not work with bi-tonal, indexed (paletted) or color images.

Pixel Padding Value

DICOM images sometimes contain a Data Element called "Pixel Padding Value" (PPV). The PPV is used mostly to fill in the corners of round images. DICOM provides a Tag for PPV which is (0028,0120). This Data Element stores a 16-bit grayscale value that is to be treated as the Pixel Padding Value. Any pixels in the image that have this value are not to be treated as meaningful objects - but as background color.

When the ImageGear Medical loads a DICOM image that contains a PPV the value is captured and stored in the HDS, which is attached to the new image. In fact, 3 values are stored to the HDS: the PPV from the PPV Data Element, a flag indicating that a PPV was found in the file when it was loaded, and an 8-bit grayscale value used to display pixels with this value.

Use MED_DCM_DS_PixPadVal_get() and MED_DCM_DS_PixPadVal_set() functions to get/set the Pixel Padding Value that is to be used while displaying a 16-bit grayscale image.

Pseudocoloring Medical Images

Medical Display API contains methods for creating color LUTs that can be used to pseudocolor grayscale images.

MED_display_color_create() Chooses a pre-defined ImageGear pseudo color scheme and creates 3 LUTs for the RGB components that are ready for use with display. You can call MED_display_color_set() to associate these RGB LUTs with an image.
MED_display_color_limits() Displays over and under-saturated areas with pseudo color of your choice.
MED_display_color_set() Associates 3 LUTs with an image. Can be used to apply pseudo color to an image. You can set to your own LUTs, to the LUTs created by MED_display_color_create(), or set to NULL to use linear 0-255 grayscale LUTs.

Medical Component Grayscale Look-Up Tables

The ImageGear Medical component provides a set of functions that allow you to create grayscale look-up tables according to DICOM display attributes, such as VOI LUT, Modality LUT, Presentation LUT, etc.

Use the IG_LUT_create() function to create a grayscale LUT, then use MED_display_grayscale_LUT_build() function to fill this LUT with values corresponding to DICOM display settings. This function supports both linear and non-linear Modality and VOI LUTs, as well as presentation state related LUTs.

Once you have built the LUT, you can copy it to either the image, or to the image display settings, by using IG_image_grayscale_LUT_update_from() or IG_dspl_grayscale_LUT_update_from().

IG_image_grayscale_LUT_... API internally uses the same LUT as the one that can be set by IG_display_option_get/set functions.

When ImageGear loads a grayscale DICOM image, it builds a grayscale LUT and attaches it to the image. This LUT can be obtained with the IG_image_grayscale_LUT_copy_get() function.

Example:

 
Copy Code
AT_MED_DCM_DISPLAY_SETTINGS DICOMDisplaySettings; 
HIGLUT GrayLUT = (HIGLUT)NULL;
memset(&DICOMDisplaySettings, 0, sizeof(DICOMDisplaySettings)); 
if (MED_DCM_DS_LUT_exists(g_hIGear, g_hIGearPresState,
DCM_TAG_ModalityLUTSequence)) 
{ 
        MED_DCM_DS_LUT_copy_get(g_hIGear, g_hIGearPresState,
DCM_TAG_ModalityLUTSequence, &DICOMDisplaySettings.ModalityLUT); 
} 
else 
{ 
        DICOMDisplaySettings.ModalityRescale.Slope = 1.0; 
        DICOMDisplaySettings.ModalityRescale.Intercept = 0.0; 
} 
DICOMDisplaySettings.VOIWindow.Center = 1024; 
DICOMDisplaySettings.VOIWindow.Width = 2048; 
DICOMDisplaySettings.Gamma = 1.0; 
IG_LUT_create(12,               /* Input depth of images to use this LUT for. */
        FALSE,          /* Apply to unsigned images. */
        8,              /* Display bit depth to use this LUT for. 8-bits is common for most PC
monitors. */
        FALSE,          /* Apply to unsigned displays. */
        &GrayLUT);
/* Build a grayscale LUT based on display settings */ 
MED_display_grayscale_LUT_build(&DICOMDisplaySettings, GrayLUT); 
/* Copy LUT to the image. */ 
IG_image_grayscale_LUT_update_from(g_hIGear, GrayLUT); 
IG_LUT_destroy(GrayLUT); 

See Also:

Working with Grayscale Look-Up Tables

Grayscale Look-Up Tables

 

 


©2016. Accusoft Corporation. All Rights Reserved.

Send Feedback