ApplyLinearModalityLUT method (Main Control)
Builder Syntax |
int ApplyLinearModalityLUT(double dIntercept, double dSlope, unsigned uFlags); |
Delphi Syntax |
Function ApplyLinearModalityLUT (dIntercept: L_DOUBLE; dSlope: L_DOUBLE; uFlags: L_UINT): L_INT; |
Overview |
Refer to Changing Brightness and Contrast. |
Remarks
(Medical only) Remaps the bitmap pixels by applying a linear transformation described by a rescale slope and an intercept. In the DICOM world, this is referred to as "applying a linear Modality LUT".
This method will remap the bitmap pixels by applying the linear transformation described by the equation:
Y = mX + b
m: slope of a straight line, this is also referred to as "Rescale Slope" in the DICOM world.
b: the y-intercept of a straight line, this is also referred to as "Rescale Intercept" in the DICOM world.
Y: the resulting pixel value.
X: the input or original pixel value.
This method 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 (e.g. Hounsfield units for CT, Optical Density for film digitizers, etc.).
This method only works on grayscale bitmaps. Calling this method 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 method 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, let’s 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.
This method supports signed data images.
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) can’t be represented with the current bits stored (12 bits), which can represent values in the range (–2048 to 2048). In this case the method 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 method won’t 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 method supports 12 and 16-bit grayscale images. Support for 12 and 16-bit grayscale images is available only in the Document/Medical toolkits.
This method supports signed data images.
See Also
Elements: |
RemapIntensity method, ApplyModalityLUT method, ApplyVOILUT method, ApplyLinearVOILUT method. |
Topics: |