# itk.imread of dicom images with dtype int16

**URL:** https://discourse.itk.org/t/itk-imread-of-dicom-images-with-dtype-int16/6388
**Category:** Engineering
**Tags:** registration
**Created:** [January 11, 2024, 3:20pm UTC](https://discourse.itk.org/t/itk-imread-of-dicom-images-with-dtype-int16/6388 "2024-01-11T15:20:00Z")
**Posts on this page:** 7
**Page:** 1

<div class="post-metadata">

### Author: ![alireza\_samadi](https://discourse.itk.org/user_avatar/discourse.itk.org/alireza_samadi/32/3829_2.png) [@alireza\_samadi](https://discourse.itk.org/u/alireza_samadi)
#### Post date: [January 11, 2024, 3:20pm UTC](https://discourse.itk.org/t/itk-imread-of-dicom-images-with-dtype-int16/6388/1 "2024-01-11T15:20:00Z")

</div>

Hi all  
In my project I am trying to register two sets of images.  
When I read my moving image which is a T1 MR Quantitative Map , using DICOM reader [pydicom.dcmread] , the image is loaded correctly as below:  
[note that dtype=int16]  
 ![1](https://discourse.itk.org/uploads/default/original/2X/9/97c76f6d65db2059d8aa9cfde74f65f2d02e0010.png)  
However, when I read the same series of DICOM images using itk library doing

moving\_image = itk.imread(directory , PixelType=itk.F)

the image I see is as below [which dtype is float32] :  
 ![2](https://discourse.itk.org/uploads/default/original/2X/4/4aa3891aa3cd215c314b1e281f60f43a75621521.png)  
and I was trying different dtype selection in itk.read function but they don’t seem to work out. For example I tried ‘unsigned short’ = so it is equal to original dtype int16 but I see the below result :

![3](https://discourse.itk.org/uploads/default/original/2X/e/ebe99a4006f29ade2f551fb60e51ece3c97ff38a.png)

is there anything i can do about it ?  
also this needs to be considered that in itk documentation is mentioned for doing elastix registration (which is what I want to do) reading with itk.F is needed

PS: the images shown are from two different adjacent slices, but the results are pretty similar.

---

<div class="post-metadata">

### Author: ![matt.mccormick](https://discourse.itk.org/user_avatar/discourse.itk.org/matt.mccormick/32/7_2.png) [@matt.mccormick](https://discourse.itk.org/u/matt.mccormick)
#### Post date: [January 11, 2024, 5:30pm UTC](https://discourse.itk.org/t/itk-imread-of-dicom-images-with-dtype-int16/6388/2 "2024-01-11T17:30:57Z")

</div>

Hi @alireza_samadi ,

Is the image read correctly with [dcmqi](https://github.com/QIICR/dcmqi)?

---

<div class="post-metadata">

### Author: ![mihail.isakov](https://discourse.itk.org/letter_avatar_proxy/v4/letter/m/c4cdca/32.png) [@mihail.isakov](https://discourse.itk.org/u/mihail.isakov)
#### Post date: [January 12, 2024, 10:19am UTC](https://discourse.itk.org/t/itk-imread-of-dicom-images-with-dtype-int16/6388/3 "2024-01-12T10:19:48Z")

</div>

@alireza_samadi Could you share the image (or one slice)?

---

<div class="post-metadata">

### Author: ![alireza\_samadi](https://discourse.itk.org/user_avatar/discourse.itk.org/alireza_samadi/32/3829_2.png) [@alireza\_samadi](https://discourse.itk.org/u/alireza_samadi)
#### Post date: [January 12, 2024, 12:37pm UTC](https://discourse.itk.org/t/itk-imread-of-dicom-images-with-dtype-int16/6388/4 "2024-01-12T12:37:55Z")

</div>

Hi  
yes here they are:  
[T1.zip](https://discourse.itk.org/uploads/short-url/7h8YppFu2TRooNUuLA4FuUyOEjX.zip) (1.4 MB)

---

<div class="post-metadata">

### Author: ![mihail.isakov](https://discourse.itk.org/letter_avatar_proxy/v4/letter/m/c4cdca/32.png) [@mihail.isakov](https://discourse.itk.org/u/mihail.isakov)
#### Post date: [January 12, 2024, 1:34pm UTC](https://discourse.itk.org/t/itk-imread-of-dicom-images-with-dtype-int16/6388/5 "2024-01-12T13:34:17Z")

</div>

The image has _Photometric Interpretation_ PALETTE\_COLOR, something is probably wrong with palette. I shall look closer later. The monochrome version might be sufficient for registration.

[T1monochrome.zip](https://discourse.itk.org/uploads/short-url/oIrmRhkBIah1Cs7u0SST2etLj0q.zip) (1.4 MB)

P.S. BTW, another (unrelated) issue is that all images share the same Series UID, but have different Study UIDs and Frame of Reference UIDs. It is wrong.  
Here is fixed version: [T1monochrome-2.zip](https://discourse.itk.org/uploads/short-url/pJBdczlJJCjKzuFwS0hUZxkXFwI.zip) (1.4 MB)

---

<div class="post-metadata">

### Author: ![mihail.isakov](https://discourse.itk.org/letter_avatar_proxy/v4/letter/m/c4cdca/32.png) [@mihail.isakov](https://discourse.itk.org/u/mihail.isakov)
#### Post date: [January 12, 2024, 2:39pm UTC](https://discourse.itk.org/t/itk-imread-of-dicom-images-with-dtype-int16/6388/6 "2024-01-12T14:39:23Z")

</div>

I have tried to look at the palette, but I have to give up. Every image has different palette data and settings, I looked at binary data of the palette of image0001.dcm and image0015.dcm, all three (red, green, blue) seem to contain only 0x00 or 0xFF. No DICOM viewer I have tried could open palette better. I hope monochrome version from the above post is OK.

---

<div class="post-metadata">

### Author: ![alireza\_samadi](https://discourse.itk.org/user_avatar/discourse.itk.org/alireza_samadi/32/3829_2.png) [@alireza\_samadi](https://discourse.itk.org/u/alireza_samadi)
#### Post date: [January 12, 2024, 3:11pm UTC](https://discourse.itk.org/t/itk-imread-of-dicom-images-with-dtype-int16/6388/7 "2024-01-12T15:11:08Z")

</div>

hi thanks this Monochrome Version seems to work fine! 🙂 can I ask what should I do to convert the rest of my images similarly?
