Declaration
property DICOM_Range: TIEDicomRange;
Description
Specifies how to handle the pixel visibility range when loading a DICOM image.
Either the pixel values are automatically scaled (image is modified) or the display values are adjusted (image is not modified).
| Value | Description |
| iedrAdjust | Pixel values within the image are scaled to the appropriate visual range |
| iedrSetBlackWhite | Pixel values are maintained, but WhiteValue and BlackValue are set to display the image correctly |
Note:
◼If you are using a
TIEMultiBitmap or
TImageEnMView, you can use
DuplicateCompressionInfo to propagate the parameter to all frames
◼iedrSetBlackWhite is not supported for saving! If iedrSetBlackWhite is specified, it will be saved as iedrAdjust. This means the pixel values of the saved image will be stretched to the range specified by
WhiteValue and
BlackValue (and the
DICOM_RescaleSlope and
DICOM_RescaleIntercept tags are updated so that the pixel values map back to their original units)
◼With iedrAdjust, pixel values outside of the window (
DICOM_WindowCenter and
DICOM_WindowWidth) are clipped when loading, and cannot be recovered. If you need to retain the full range of original values (e.g. all Hounsfield units of a CT image) when re-saving, load using iedrSetBlackWhite and set
BlackValue and
WhiteValue to the range of the pixel values before saving, e.g. by calling
AutoCalcBWValues (see example below)
◼To get the original value of a pixel (e.g. in Hounsfield units), use
DICOM_PixelToValue
◼If you use iedrSetBlackWhite, you will need to reset the
WhiteValue and
BlackValue before loading the next image, i.e.
ImageEnView1.IEBitmap.BlackValue := 0;
ImageEnView1.IEBitmap.WhiteValue := 0;
Default: iedrAdjust (Specified by
IOParamDefaults)
Loading Example
ImageEnView1.IO.NativePixelFormat := True;
ImageEnView1.IO.Params.DICOM_Range := iedrSetBlackWhite;
ImageEnView1.IO.LoadFromFile( 'D:\slice91.dcm' );
dcenter := ImageEnView1.IO.Params.DICOM_WindowCenterOffset + StrToFloat( edtLevel.Text );
dMin := dcenter - 0.5 - StrToFloat( edtWidth.Text ) - 1) / 2;
dMax := dcenter - 0.5 + StrToFloat( edtWidth.Text ) - 1) / 2;
ImageEnView1.IEBitmap.BlackValue := dMin;
ImageEnView1.IEBitmap.WhiteValue := dMax;
ImageEnView1.Update();
Saving Example
// Saving a DICOM that was loaded using iedrSetBlackWhite
// The pixel values are automatically stretched to the BlackValue..WhiteValue range, and the Rescale Slope and Rescale Intercept tags are updated
// Note: Do not call IEBitmap.StretchValues() yourself, as the Rescale tags will then be removed
ImageEnView1.IO.SaveToFileDICOM( SaveImageEnDialog1.FileName );
Saving Example (Retain all values)
// Re-save a DICOM retaining the full range of original values (e.g. all Hounsfield units)
ImageEnView1.IO.NativePixelFormat := True;
ImageEnView1.IO.Params.DICOM_Range := iedrSetBlackWhite;
ImageEnView1.IO.LoadFromFile( 'D:\slice91.dcm' );
ImageEnView1.IEBitmap.AutoCalcBWValues(); // Stretch the full range of pixel values when saving (rather than the window range)
ImageEnView1.IO.SaveToFile( 'D:\slice91_out.dcm' );
See Also
◼WhiteValue
◼BlackValue
◼DICOM_PixelToValue