LBitmap::ApplyLinearModalityLUT

#include "ltwrappr.h"

virtual L_INT LBitmap::ApplyLinearModalityLUT(fIntercept, fSlope, uFlags)

L_DOUBLE fIntercept;

/* rescale intercept*/

L_DOUBLE fSlope;

/* rescale slope*/

L_UINT uFlags;

/* flags */

Remaps the bitmap pixels by applying a linear transformation described by rescale slope and intercept.

Parameter

Description

fIntercept

"Rescale Intercept" : the value of "b" in the linear relationship between original pixel values and the new pixel values.

 

(new pixel value) = m * (original pixel value) + b. Where "m" is the "Rescale Slope".

fSlope

"Rescale Slope" : the value of "m" in the linear relationship between original pixel values and the new pixel values.

 

(new pixel value) = m * (original pixel value) + b. Where "b" is the "Rescale Intercept".

uFlags

Flags which determine the behavior of this function. Use one value or use a bitwise OR ( | ) to combine values.Possible values are:

 

Value

Meaning

 

M_LUT_UPDATE_MIN_MAX

[0x0002] Update pBitmap->MinVal with the new minimum intensity value in the bitmap and pBitmap->MaxVal with the new maximum intensity value.

 

M_LUT_ALLOW_RANGE_EXPANSION

[0x0008] Adjust the high bit and/or low bit (if possible) inside the bitmap handle in order to be able to hold the range of pixel values after applying the modality LUT.

 

M_LUT_USE_FULL_RANGE

[0x0004] Do not mask the values in the LUT.

Returns

SUCCESS

The function was successful.

< 1

An error occurred. Refer to Return Codes.

Comments

This function remaps the bitmap pixels by applying a linear transformation described by rescale slope and intercept. In the DICOM world, this is referred to as "applying a linear Modality LUT".

This function will remap the bitmap pixels by applying the linear transformation described by the equation:

Y = mX + b

where:

m represents the slope of a straight line. This is referred to as "Rescale Slope" in the DICOM world.

b represents the y-intercept of a straight line. This is referred to as "Rescale Intercept" in the DICOM world.

Y represents the resulting pixel value.

X represents the input or original pixel value.

 

This function is helpful in applying what is referred to as a "Linear Modality LUT" in the DICOM world. According to the DICOM standard, a "Modality LUT" defines the transformation of manufacturer-dependent pixel values into pixel values, which are manufacturer-independent (for example, Hounsfield units for CT, Optical Density for film digitizers, etc.).

This function only works on grayscale bitmaps. Calling this function for non-grayscale bitmaps will return an error (ERROR_INV_PARAMETER).

It is recommended to always set the M_LUT_UPDATE_MIN_MAX flag.

This function could change the bitmap from signed to unsigned, or from unsigned to signed. This is determined by the values of the resulting image pixels after applying the linear transformation.

Only the useful bits in the bitmap are considered. The values are considered as if the bitmap pixel values are normalized: LowBit = 0.

For example, lets say the bitmap is:

 BitsPerPixel = 12

 LowBit = 4

 HighBit = 10

In this case, there are 10-4+1=7 valid bits. This means that there are 128 values to remap.

 

If M_LUT_ALLOW_RANGE_EXPANSION is set in uFlags, consider the following example:

If the dataset has the following attributes:

Bits per pixel 16

High Bit 11

Low Bit 0

Pixel Range 0 to +4095,

Unsigned

The number of bits stored inside the bitmap is 11-0+1 =12.

If the fIntercept is set to 1024 and fSlope is set to 0, then after applying the rescale slope and intercept:

Output minimum pixel value = (0 *1 +(-1024))= -1024

Output maximum pixel value = (4095 *1 +(-1024))= 3071

The new pixel value range (1024 to 3071) cant be represented with the current bits stored (12 bits), which can represent values in the range (2048 to 2048). In this case the function will change the high bit inside the bitmap handle to be 12 instead of 11 (bits stored becomes 13), which can represent values in the range (8192 to 8191).

Please note that the function wont be able to update the high bit and/or low bit if the number of bits stored was already equal to the bitmap bits per pixel.

This function supports 12 and 16-bit grayscale images. Support for 12 and 16-bit grayscale images is available only in the Document/Medical toolkits.

This function does not support 32-bit grayscale images. It returns the error code ERROR_GRAY32_UNSUPPORTED if a 32-bit grayscale image is passed to this function.

Required DLLs and Libraries

LTIMGCOR

For a listing of the exact DLLs and Libraries needed, based on the toolkit version, refer to Files To Be Included With Your Application.

See Also

Functions:

LBitmap::AdjustTint, LBitmap::GammaCorrectExt, LBitmap::RemapIntensity, LBitmap::ApplyLinearModalityLUT, LBitmap::ApplyVOILUT, LBitmap::ApplyLinearVOILUT, Class Members

Topics:

Raster Image Functions: Modifying Intensity Values

 

Processing an Image

 

Changing Brightness and Contrast

 

Raster Image Functions: Changing Brightness and Contrast

Example

For an example, refer to LBitmap::ApplyModalityLUT.