Hi everyone. I have a DICOM from echocardiography which is a 4D Volume (3D space + time) that I could save in a .dcm format. I want to use SimpleITK to open it and plot it. Is it possible to read the .dcm file and plot it directly or should I convert it into a .nii first (e.g. through MITK)?
The original DICOM should be readable using SimpleITK, but till you try you won’t know:
import SimpleITK as sitk
file_name = 'abc.dcm'
image = sitk.ReadImage(file_name)
# Not sure if Fiji will work as expected, but should.
sitk.Show(image)
Many thanks @zivy for your answer. I copied your code in a file that I named `read_dcm.py" and ran it. I got the following message:
Traceback (most recent call last):
File "read_dcm.py", line 7, in <module>
sitk.Show(image)
File "/research/3D_Dicom_reader/py3_8_3D_Dicom/lib/python3.8/site-packages/SimpleITK/SimpleITK.py", line 7887, in Show
return _SimpleITK.Show(*args, **kwargs)
RuntimeError: Exception thrown in SimpleITK Show: /Users/runner/runners/2.160.0/work/1/sitk/Code/IO/src/sitkShow.cxx:495:
sitk::ERROR: No appropriate executable found.
The good news is that it looks like reading the image works.
The “bad” news, SimpleITK couldn’t find the Fiji image viewer. This is easily corrected.
Do you have Fiji installed? If yes, it may not be in the expected location (details in the FAQ). You can use another viewer (e.g. ITK-SNAP) if you already have it installed.
The output is just showing us all the paths in which the code was searching for Fiji but couldn’t find it. Is Fiji installed in one of these locations?