Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

is mhd_filename the path of dicom? #2

Open
miziha-zp opened this issue Jul 7, 2020 · 6 comments
Open

is mhd_filename the path of dicom? #2

miziha-zp opened this issue Jul 7, 2020 · 6 comments

Comments

@miziha-zp
Copy link

miziha-zp commented Jul 7, 2020

when I specific mhd_filename with a path of dicom, an error occured like this:

Traceback (most recent call last):
  File "rendering.py", line 129, in <module>
    main()
  File "rendering.py", line 31, in main
    volume, spacing = load_image(mhd_filename)
  File "rendering.py", line 11, in load_image
    itkimage = sitk.ReadImage(filename)
  File "/home/huangtianbo/anaconda3/lib/python3.7/site-packages/SimpleITK/SimpleITK.py", line 8876, in ReadImage
    return _SimpleITK.ReadImage(*args)
RuntimeError: Exception thrown in SimpleITK ReadImage: /tmp/SimpleITK/Code/IO/src/sitkImageReaderBase.cxx:107:
sitk::ERROR: Unable to determine ImageIO reader for "/home/huangtianbo/zp/spine_direction_classification/template_expretiment/s1"

can you give more detail about the parameter...

@gokceay
Copy link

gokceay commented Jul 8, 2020

to make the code work personally I converted dicom to mhd file type.

@miziha-zp
Copy link
Author

miziha-zp commented Jul 8, 2020 via email

@gokceay
Copy link

gokceay commented Jul 8, 2020

sth like this will work:
import SimpleITK as sitk

dirname = 'B'

series_IDs = sitk.ImageSeriesReader_GetGDCMSeriesIDs(dirname)

if not series_IDs:
print('No series in directory ' + ''' + dirname + ''')

for series in series_IDs:
sitk.WriteImage(sitk.ReadImage(sitk.ImageSeriesReader_GetGDCMSeriesFileNames(dirname, series)), series + '.mhd')

@yuta-hi
Copy link
Owner

yuta-hi commented Jul 10, 2020

Thank you for sharing your code.

@miziha-zp
Copy link
Author

thanks for your code

@gokceay
Copy link

gokceay commented Jul 10, 2020

you are welcome :D thanks a lot for the pycudadrr code Yuta ✌🏻

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants