yuta-hi / pycuda_drr

Digitally recconstructed radiograph
MIT License
22 stars 3 forks source link

is mhd_filename the path of dicom? #2

Open miziha-zp opened 4 years ago

miziha-zp commented 4 years ago

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 commented 4 years ago

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

miziha-zp commented 4 years ago

can you provide the code transform dicom2mhd? it will make it easy for us to test your code. Thx

发自我的iPhone

在 2020年7月8日,下午9:00,gokceay notifications@github.com 写道:

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

gokceay commented 4 years ago

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 commented 4 years ago

Thank you for sharing your code.

miziha-zp commented 4 years ago

thanks for your code

gokceay commented 4 years ago

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