HU value in dcm series files and itk::Image

I am a little confused about HU value in dcm series. When I use ITK_SNAP or 3d slicer to read dcm series files, it shows that the range of HU is [-1000, 4.303e+004]
But when I use itk::ImageSeriesReader and get it to output to an itk::image<signed short, 3> object, When I get the Pixel range, it shows [-32745, 32749], what happened? Is there a conversion formula here?

Hello @liguangops,

The range of signed short/short is [-32768, 32767]. According to your post you are dealing with values in [-1000, 43030], so the upper limit is larger than the maximal value that can be represented by signed short (the choice for the pixel type in the code snippet). Change the pixel type to one that accommodates the range of values you need to read.

Hi, thanks for your suggestion. I will have a try. But I’m still a little confused about the type of dicom pixel data. I check the Dicom file metadata:
the tag Bits Allocated shows that each pixel allocates two bytes. So the type of it can be signed short
or unsigned short. But the range of the Pixel data is bigger than the range of signed short. So the type of pixel data can only be unsigned short. Than the HU value can be calculate by:

HU(int) = rescale\_slope \times pixel\_data(unsigned\ short) + rescale\_intercept

which means the type of HU is promoted to int.
Is my thinking correct?

Yes, makes sense (the negative values are due to the Rescale Intercept value of -1000).
Just change your code to itk::image<int, 3>

I tried it and the logic of the code became normal. thank you very much for your help.