Pyradiomics with masks extracted from DICOM dose cloud

Operating system:Windows 10
Slicer version: 4.10.1


I have masks stored in numpy ndarray, and I am using pynrrd to write them to .nrrd format for use in pyradiomics. When I check the nrrd masks against the dicom image in Slicer, the image origin and voxel size do not align. It’s easy enough to correct manually in slicer by changing the ‘Image Spacing:’, and ‘Image Origin:’, but I need to do this for thousands of DICOM files.Pixel spacing is available in the DICOM header, but the slice thickness seems difficult to get.

What is the best way to approach this problem? Do I try to convert all the DICOM to nrrd first? How can I do that in a python script? Saving as nrrd in Slicer works well but is too slow for many files.

Thank you for your help

You can probably use DWIConvert or dcm2niix that come with SlicerDMRI. They are meant for diffusion scans, but will also convert scalar volumes if they don’t find diffusion info in the headers. Both are simple executables so they are super fast compared to starting Slicer.

Thank you, I will have a look at that.