# 3D Image Registration with DICOM Series

**URL:** https://discourse.itk.org/t/3d-image-registration-with-dicom-series/3641
**Category:** Uncategorized
**Created:** [November 21, 2020, 3:48am UTC](https://discourse.itk.org/t/3d-image-registration-with-dicom-series/3641 "2020-11-21T03:48:23Z")
**Posts on this page:** 6
**Page:** 1

<div class="post-metadata">

### Author: ![Jennsoo](https://discourse.itk.org/letter_avatar_proxy/v4/letter/j/2acd7d/32.png) [@Jennsoo](https://discourse.itk.org/u/Jennsoo)
#### Post date: [November 21, 2020, 3:48am UTC](https://discourse.itk.org/t/3d-image-registration-with-dicom-series/3641/1 "2020-11-21T03:48:23Z")

</div>

Hello,  
I was performing registration between two modalities of brain and got weird results. It is hard to describe. It looks like some of the edges are highlighted. Is that normal?

![10321217_0001](https://discourse.itk.org/uploads/default/original/2X/1/1e93dd23f4ebd1f91f90da18592ec8b0a9a3789c.png)  
 ![10380189_0012](https://discourse.itk.org/uploads/default/original/2X/6/64fed012ff36397ed6058ad5d007b006b2e2fc33.png)

Here is my code.

 ![image](https://discourse.itk.org/uploads/default/original/2X/9/9bb2d25f4ba4931b6a09bda38e0f6c422ec5308a.png)

---

<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: [November 21, 2020, 7:54pm UTC](https://discourse.itk.org/t/3d-image-registration-with-dicom-series/3641/2 "2020-11-21T19:54:40Z")

</div>

Hello @Jennsoo,

This isn’t a registration problem, it is a visualization/image-storage format issue. The moving\_resampled image has a pixel type of sitkFloat32. The original/native type is likely integral (int16 or uint16). You will need to save it appropriately, or use a visualization program that does the correct thing with float data.

See if this helps:

```auto
moving_resampled = sitk.Resample(sitk.ReadImage(sitk._mageSeriesReader_GetGDCMSeriesFileNames(t2_path, moving_ids[0]), fixed_image, final_transform, sitk.sitkLinear, 0.0)

```

---

<div class="post-metadata">

### Author: ![lassoan](https://discourse.itk.org/user_avatar/discourse.itk.org/lassoan/32/27_2.png) [@lassoan](https://discourse.itk.org/u/lassoan)
#### Post date: [November 21, 2020, 8:23pm UTC](https://discourse.itk.org/t/3d-image-registration-with-dicom-series/3641/3 "2020-11-21T20:23:46Z")

</div>

What software did you use for visualization? Try software that is specifically designed for medical image visualization, such as 3D Slicer or ITK-snap.

---

<div class="post-metadata">

### Author: ![Jennsoo](https://discourse.itk.org/letter_avatar_proxy/v4/letter/j/2acd7d/32.png) [@Jennsoo](https://discourse.itk.org/u/Jennsoo)
#### Post date: [November 22, 2020, 6:18am UTC](https://discourse.itk.org/t/3d-image-registration-with-dicom-series/3641/4 "2020-11-22T06:18:48Z")

</div>

I did not use any software for visualization. I need to save every slice into a single .png/jpg/… So I transfered the moving\_image into UInt8 type using sitk.Cast.

 ![image](https://discourse.itk.org/uploads/default/original/2X/1/10057fcef785828477284e230b7ce6a4aa9ff409.png)

---

<div class="post-metadata">

### Author: ![Jennsoo](https://discourse.itk.org/letter_avatar_proxy/v4/letter/j/2acd7d/32.png) [@Jennsoo](https://discourse.itk.org/u/Jennsoo)
#### Post date: [November 22, 2020, 7:27am UTC](https://discourse.itk.org/t/3d-image-registration-with-dicom-series/3641/5 "2020-11-22T07:27:36Z")

</div>

Hello,

Thank you for your constructive suggestions. It is exactly the image-storage format issue. I checked the notebook again and found that I forgot a step when storing the results, the sitk.RescaleIntensity function. Forgive my silly mistake!

> images = sitk.Cast(sitk.RescaleIntensity(moving\_resampled), sitk.sitkUInt8)

---

<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: [November 22, 2020, 2:13pm UTC](https://discourse.itk.org/t/3d-image-registration-with-dicom-series/3641/6 "2020-11-22T14:13:26Z")

</div>

Hello @Jennsoo,

Please be careful with this as you are loosing information. Common, non medical imaging formats (png, jpg…) are not really suitable for use with medical images. Save your data in these formats only if you intend to use it for a figure in a manuscript. Otherwise, save in a format that supports high dynamic range (nrrd, mha,…) and use an appropriate viewer as recommended by @lassoan.
