# HU value in dcm series files and itk::Image

**URL:** https://discourse.itk.org/t/hu-value-in-dcm-series-files-and-itk-image/5333
**Category:** Uncategorized
**Created:** [September 13, 2022, 9:49am UTC](https://discourse.itk.org/t/hu-value-in-dcm-series-files-and-itk-image/5333 "2022-09-13T09:49:20Z")
**Posts on this page:** 5
**Page:** 1

<div class="post-metadata">

### Author: ![liguangops](https://discourse.itk.org/user_avatar/discourse.itk.org/liguangops/32/2900_2.png) [@liguangops](https://discourse.itk.org/u/liguangops)
#### Post date: [September 13, 2022, 9:49am UTC](https://discourse.itk.org/t/hu-value-in-dcm-series-files-and-itk-image/5333/1 "2022-09-13T09:49:20Z")

</div>

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？

---

<div class="post-metadata">

### Author: ![zivy](https://discourse.itk.org/user_avatar/discourse.itk.org/zivy/32/1726_2.png) [@zivy](https://discourse.itk.org/u/zivy)
#### Post date: [September 13, 2022, 1:18pm UTC](https://discourse.itk.org/t/hu-value-in-dcm-series-files-and-itk-image/5333/2 "2022-09-13T13:18:25Z")

</div>

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.

---

<div class="post-metadata">

### Author: ![liguangops](https://discourse.itk.org/user_avatar/discourse.itk.org/liguangops/32/2900_2.png) [@liguangops](https://discourse.itk.org/u/liguangops)
#### Post date: [September 14, 2022, 1:24am UTC](https://discourse.itk.org/t/hu-value-in-dcm-series-files-and-itk-image/5333/3 "2022-09-14T01:24:18Z")

</div>

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:  
 ![2](https://discourse.itk.org/uploads/default/original/2X/5/539ef2a1d1105e12add1e5bcb74dbfd441ebd105.png)  
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?

---

<div class="post-metadata">

### Author: ![zivy](https://discourse.itk.org/user_avatar/discourse.itk.org/zivy/32/1726_2.png) [@zivy](https://discourse.itk.org/u/zivy)
#### Post date: [September 14, 2022, 1:39am UTC](https://discourse.itk.org/t/hu-value-in-dcm-series-files-and-itk-image/5333/4 "2022-09-14T01:39:15Z")

</div>

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

---

<div class="post-metadata">

### Author: ![liguangops](https://discourse.itk.org/user_avatar/discourse.itk.org/liguangops/32/2900_2.png) [@liguangops](https://discourse.itk.org/u/liguangops)
#### Post date: [September 14, 2022, 1:51am UTC](https://discourse.itk.org/t/hu-value-in-dcm-series-files-and-itk-image/5333/5 "2022-09-14T01:51:26Z")

</div>

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