ImagingDataCommons / highdicom

High-level DICOM abstractions for the Python programming language
https://highdicom.readthedocs.io
MIT License
164 stars 34 forks source link

conversion of DICOM Segmentation object to nifti file #218

Open deepakri201 opened 1 year ago

deepakri201 commented 1 year ago

Hi,

I'm interested in using highdicom to convert a DICOM Segmentation object to a nifti file (one per segment). I know that there are other converters available (dcmqi segimage2itkimage, pydicom-seg), but wanted to know if this was also an option using highdicom.

I've tried this from the documentation: image ,but this does not return numpy arrays of the same dimensions as the underlying image data. It seems like I would have to extract any orientation information for each slice of the segmentation and create the volume myself in order for it to align with the image data.

Thanks!

Deepa

CPBridge commented 1 year ago

Hi @deepakri201, highdicom cannot convert directly to nifti but you should be able to do this via numpy and then nibabel/sitk.

You are using an old API for getting segments out of the segmentation dataset. Please refer to this similar issue for some hints on how to do this now: https://github.com/ImagingDataCommons/highdicom/issues/202

CPBridge commented 1 year ago

See the new docs in https://github.com/ImagingDataCommons/highdicom/pull/219 for more information on this