Switch off auto-rescale for CT images

All other questions regarding DCMTK

Moderator: Moderator Team

Post Reply
Message
Author
Peter.Bodnar
Posts: 1
Joined: Wed, 2022-03-02, 08:37

Switch off auto-rescale for CT images

#1 Post by Peter.Bodnar »

When I load a DCMDataset and try to save it, rescaling of intercept happens automatically.

It is CT modality, and as far as I could understand that from the source codes, the jpeg encoder switches rescaling on for CT.
djcodece.cc:1034:

Code: Select all

 if (0 == strcmp(classUID, UID_CTImageStorage))
{
    mode_CT = OFTrue;
    mode_useModalityRescale = OFTrue; // required for Hounsfield units
}   
I understand that JPEG compression works best when window is tailored to the slice. Is there a way to disable this? I'd need that because I process a series, and all images should have the same intercept.
I use Radiant viewer and it just flickers when scrolling between slices of the same set, because individual dcm files that I saved using DCMDataset::saveFile(), have different intercept values. I would like to stick with transfersyntax EXS_JPEGProcess14 or another jpeg.

Marco Eichelberg
OFFIS DICOM Team
OFFIS DICOM Team
Posts: 1437
Joined: Tue, 2004-11-02, 17:22
Location: Oldenburg, Germany
Contact:

Re: Switch off auto-rescale for CT images

#2 Post by Marco Eichelberg »

Revised answer: The flag you describe, mode_useModalityRescale, is indeed ignored by the JPEG encoder when operating in lossy mode and compressing CT images. However, this flag does not describe how the source image is compressed, but how the compressed image is stored. In CT, you often find images that have 12 bits/pixel, unsigned, plus a Rescale Slope/Intercept that "move" the raw pixel values into Hounsfield value range (ca. -1000...+3000). Since lossy JPEG only supports a maximum of 12 bits/pixel, it would degrade the image quality if Rescale Slope/Intercept would be applied before compression, because then a signed 13-bit image would have to be compressed with a 12-bit encoding process. Therefore, the encoder compresses the 12 bits/pixel and retains rescale slope and intercept, which must then be applied by the viewer - just like for the uncompressed image.

When using lossless JPEG (which supports 16 bits/pixel), as far as I can say there is no special treatment for CT images.

Post Reply

Who is online

Users browsing this forum: Bing [Bot], Google [Bot], Semrush [Bot] and 1 guest