# how to view mha file in Python

**URL:** <https://discourse.itk.org/t/how-to-view-mha-file-in-python/5515>\
**Category:** Beginner Questions\
**Tags:** python\
**Created:** [November 22, 2022, 4:58pm UTC](https://discourse.itk.org/t/how-to-view-mha-file-in-python/5515 "2022-11-22T16:58:11Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Uljibuh](https://discourse.itk.org/user_avatar/discourse.itk.org/uljibuh/32/3057_2.png) [@Uljibuh](https://discourse.itk.org/u/Uljibuh)\
**Post date:** [November 22, 2022, 4:58pm UTC](https://discourse.itk.org/t/how-to-view-mha-file-in-python/5515/1 "2022-11-22T16:58:12Z")

</div>

Hi all,

a beginner here, I am working on prostate cancer 3D dataset using deep learning,  
I can open these 3D files using Fiji, how I can open in python using SimpleITK ?  
do I need to convert these file into specific format in order to view it?

if you can share any relevant documents to work with 3D MRI dataset would be helpful.

thank you so much in advance.

each patient has five mha files.  
each patient dataset look like this:

`['10466_1000474_hbv.mha', '10466_1000474_sag.mha', '10466_1000474_t2w.mha', '10466_1000474_cor.mha', '10466_1000474_adc.mha']`

---

<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, 2022, 6:05pm UTC](https://discourse.itk.org/t/how-to-view-mha-file-in-python/5515/2 "2022-11-22T18:05:02Z")

</div>

Hello @Uljibuh,

Reading the images is straightforward:

```auto
import SimpleITK

image = sitk.ReadImage("10466_1000474_hbv.mha")

```

SimpleITK only provides components for image analysis, not for visualization. A utility function, [Show](https://simpleitk.org/doxygen/latest/html/namespaceitk_1_1simple.html#a86cb9e226d455efca3ba034dc2154605), and class, [ImageViewer](https://simpleitk.org/doxygen/latest/html/classitk_1_1simple_1_1ImageViewer.html), for displaying images using external programs are available. By default the external program is Fiji (this is configurable so can use other programs).

As you are new to SimpleITK, I highly recommend going over the [fundamental concepts](https://simpleitk.readthedocs.io/en/master/fundamentalConcepts.html), [common conventions](https://simpleitk.readthedocs.io/en/master/conventions.html), and possibly the [online tutorial](https://simpleitk.org/TUTORIAL/). You may also find the toolkit’s [Jupyter notebook repository](https://github.com/InsightSoftwareConsortium/SimpleITK-Notebooks) of interest.

---

<div class="post-metadata">

**Author:** ![Uljibuh](https://discourse.itk.org/user_avatar/discourse.itk.org/uljibuh/32/3057_2.png) [@Uljibuh](https://discourse.itk.org/u/Uljibuh)\
**Post date:** [November 22, 2022, 6:16pm UTC](https://discourse.itk.org/t/how-to-view-mha-file-in-python/5515/3 "2022-11-22T18:16:26Z")

</div>

Thank you for response, your shared information is helpful for me to go further.  
have a nice day.
