# Get the same views of 3D dicom image

**URL:** https://discourse.itk.org/t/get-the-same-views-of-3d-dicom-image/4846
**Category:** Algorithms
**Tags:** python, dicom, simpleitk
**Created:** [March 4, 2022, 1:45am UTC](https://discourse.itk.org/t/get-the-same-views-of-3d-dicom-image/4846 "2022-03-04T01:45:35Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![tutti](https://discourse.itk.org/letter_avatar_proxy/v4/letter/t/f4b2a3/32.png) [@tutti](https://discourse.itk.org/u/tutti)
#### Post date: [March 4, 2022, 1:45am UTC](https://discourse.itk.org/t/get-the-same-views-of-3d-dicom-image/4846/1 "2022-03-04T01:45:35Z")

</div>

Hello everyone,

I have two 3D images (creat from 2 different registration methods, 2 images with same size (476,512,512) origin (0,0,0), direction(1,0,0,0,1,0,0,0,1)). I visualized 2 images with matplotlib (same slice) and got the the views as following.  
fig, (ax1, ax2, ax3) = plt.subplots(1, 3, figsize = (20, 10))  
ax1.imshow(a[150, :, :],‘gray’)  
ax2.imshow(a[:, 256, :], ‘gray’)  
ax3.imshow(a[:, :, 200], ‘gray’)

 ![A](https://discourse.itk.org/uploads/default/original/2X/d/d836df2ddafd1bc68103486238268a1ad199dbdc.png)  
 ![B](https://discourse.itk.org/uploads/default/original/2X/8/8cc2be04c0b03837fbdd890f695817e41baa6741.png)

It seems that image A and B have different views (axial, coronal and diggital) (and flip axis?). I want to convert the views of B to be the same as A. Could you please suggest what I might try?  
Many thanks,

---

<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: [March 4, 2022, 1:57pm UTC](https://discourse.itk.org/t/get-the-same-views-of-3d-dicom-image/4846/2 "2022-03-04T13:57:35Z")

</div>

Hello @tutti,

If the images have the same size origin and direction, the axial, sagittal and coronal views should match (possibly rotated).

Based on the provided size (476,512,512) you are looking at a numpy array and not the original SimpleITK image. Note that the index order in SimpleITK and numpy is reversed, image[x,y,z] vs. image\_numpy\_array[z,y,x]. Possibly the two are mixed resulting in the mismatch.

If this does not address the issue, take a look at [PermuteAxesImageFilter](https://simpleitk.org/doxygen/latest/html/classitk_1_1simple_1_1PermuteAxesImageFilter.html) or [DICOMOrientImageFilter](https://simpleitk.org/doxygen/latest/html/classitk_1_1simple_1_1DICOMOrientImageFilter.html).

---

<div class="post-metadata">

### Author: ![tutti](https://discourse.itk.org/letter_avatar_proxy/v4/letter/t/f4b2a3/32.png) [@tutti](https://discourse.itk.org/u/tutti)
#### Post date: [March 5, 2022, 6:48am UTC](https://discourse.itk.org/t/get-the-same-views-of-3d-dicom-image/4846/3 "2022-03-05T06:48:43Z")

</div>

Hi @zivy,  
Based on your suggestion, I resampled B and transposed the x and z. It solved my problem.  
Thank you for your help! :))  
Best regards,
