Purpose

The module DicomRescale allows the rescaling of DICOM data to a user-defined intercept, slope, and data type.

For CT data, intercept and slope define the transformation between intensity values (IV) and Hounsfield Units (HU):
HU = IV * slope + intercept

For example, this is very useful in order to normalize CT data from different vendors (Siemens, Philips, GE, Toshiba), who mostly use their specific intercept / slope / data type values, on the fly without extensive computational cost.

It can also be used to scale any incoming CT data into uint8 for more memory efficient processing and still have the correct correspondence of intensity values and HU (for example, for display in View2D annotation).

Usage

Connect a DICOM image to the input, and select appropriate rescaling parameters.

E.g., to rescale to Siemens standard, use Intercept -1024, slope 1, and data type UInt16. If Int16 is selected instead, values below -1024 HU which occur in most Philips and Toshiba datasets are preserved and result in intensity values below 0 in the output image.

Recommended normalization values for image processing are intercept = 0, slope = 1, data type = Int16, so that densities and HU correspond directly and values below -1024 (noise, masked out areas) are correctly preserved for all vendors. Toshiba and Philips usually generate non-clamped data, which is very useful for noise analysis in quantitative image processing.

Details

Internally, the module computes a scale factor S and an offset O from input and output slopes Si and So and intercepts Ii and Io

S = Si / So

O = (Ii - Io) / So

Respecting the boundaries of the data type Mindt and Maxdt, every input value vi is transformed into an output value vo according to

vo = max(Mindt, min(Maxdt, vi * S + O ))

If the selected data type is an integer type, the resulting value vo is rounded arithmetically. If user-defined bounds are activated, they are used instead of the data type derived boundaries (as long as they lie within the output data type range).

If the DICOM tag PixelPaddingValue or/and the PixelPaddingRangeLimit are set in the input DICOM data, then these values are transformed accordingly and made available at the fields pixelPadding and pixelPaddingRange

Some remarks on the internal implementation affecting the module performance: If S is 1, O is 0, and no data type change is performed, the data is just relayed in-place to minimize time consumption. If S differs from 1 or the output data type is non-integer, the complete computation is performed in double and afterwards cast into the target data type. For the frequently occurring case that S equals 1, a special loop is used which performs the clamping in the source data type and the computation (which is a mere add operation) in the target data type without necessarily converting to double for that purpose.

Tips

  • Long Double and Int64 are not explicitly supported as input data types, and explicitly not supported as output data types.
  • Note that, while the RescaleIntercept and RescaleSlope DICOM tags are updated for the output images (this is necessary to allow serial application of multiple DicomRescale operations), no additional tags (e.g. Smallest/LargestImagePixelValue) are changed.

Windows

Default Panel

../../../Modules/ML/MLImageFile/mhelp/Images/Screenshots/DicomRescale._default.png

Input Fields

input0

name: input0, type: Image

The module has one input which can be of any standard data type except long double and int64.

Output Fields

output0

name: output0, type: Image

The module has one output, holding the rescaled data. The output is updated automatically on any parameter or input image modification.

Parameter Fields

Visible Fields

Bypassing Voxel Data

name: voxelDataBypassingEnabled, type: Bool, persistent: no, deprecated name: copyMode

Shows whether the voxel data was not processed due to identity scaling and identical in/out datatype. Note that dicom tags may still be inserted (if missing) and min/max values updated.

Input Valid

name: valid, type: Bool, persistent: no

Shows whether the input is valid (standard data type and neither Long Double nor Int64).

Input Intercept

name: inputIntercept, type: String, persistent: no

Shows the intercept value stored in the input image.

Input Slope

name: inputSlope, type: String, persistent: no

Shows the slope value stored in the input image.

Input Minimum

name: inputMin, type: Double, persistent: no

Shows the minimum image value stored in the input image.

Input Maximum

name: inputMax, type: Double, persistent: no

Shows the maximum image value stored in the input image.

Input Datatype

name: inputDataType, type: String, persistent: no, deprecated name: inputType

Shows the data type of the input image.

Input Rescale Type

name: inputRescaleType, type: String, persistent: no

Displays the value of the DICOM tag “RescaleType” (0028,1054) if present, or “n/a” otherwise. Not used by the module, just displayed for user information.

Force lower bound

name: useUserMin, type: Bool, default: FALSE

If checked, the data is being clamped to a user-defined lower bound after the data type was determined.

Force upper bound

name: useUserMax, type: Bool, default: FALSE

If checked, the data is being clamped to a user-defined upper bound after the data type was determined.

If the upper bound conflicts with the lower bound, the data is set to the upper bound.

User Min

name: userMin, type: Double, default: 0

Sets the user defined minimum image value.

User Max

name: userMax, type: Double, default: 255

Sets the user defined maximum image value.

Select Intercept

name: outputIntercept, type: Double, default: 0

Sets the user defined intercept value.

Select Slope

name: outputSlope, type: Double, default: 1

Sets the user defined slope value.

Select Datatype

name: outputDataTypeSelection, type: Enum, default: Automatic, deprecated name: typeSelect

Defines the data type for the output image.

Automatic mode uses float when downscaling the image and a fitting (signed) integer type when upscaling the image.

Values:

Title Name
Automatic Automatic
Input Data Type Input Data Type
UInt8 UInt8
Int8 Int8
UInt16 UInt16
Int16 Int16
UInt32 UInt32
Int32 Int32
Float Float
Double Double

Output Minimum

name: outputMin, type: Double, persistent: no

Shows the minimum image value of the output image.

Output Maximum

name: outputMax, type: Double, persistent: no

Shows the maximum image value of the output image.

Output Datatype

name: outputDataType, type: String, persistent: no, deprecated name: outputType

Shows the data type of the output image.

Hidden Fields

pixelPaddingValid

name: pixelPaddingValid, type: Bool, persistent: no

This field is set to true if the output fields pixelPadding and pixelPaddingRange have a valid value.

pixelPadding

name: pixelPadding, type: Double, persistent: no

If a valid PixelPaddingValue tag exists in the input DICOM data then this field has the transformed value.

pixelPaddingRange

name: pixelPaddingRange, type: Double, persistent: no

If a valid PixelPaddingRangeLimit exists in the input DICOM data then this field has the transformed value. If this tag is not present, but the PixelPaddingValue, then this field has the same value as pixelPadding.