Reading DICOM-RT files

Hello,

I’d like to read DICOM-RT Structure Set files in my application. Is the method described in the paper below the best way to do this using ITK?
http://www.insight-journal.org/browse/publication/887

The paper uses some basic GDCM APIs to convert DICOM-RT files into images. I just want to confirm that this is still the best way, and there are no higher-level filters or classes for the task in ITK.

Thanks,
–Fijoy

I don’t think ITK can create high-quality surfaces from the usual poor-quality RT contours (planar contours with large spacing, potentially with branches, keyholes, etc). There is a contour converter class in 3D Slicer’s SlicerRT extension that you may use: either take the parts that you need (mostly in this class) or use 3D Slicer’s end-to-end solution for DICOM RT structure set, dose map, plan, and image import/export, visualization, and analysis. 3D Slicer contains ITK (accessible from both C++ and Python), so you should be able to use ITK within Slicer to do any kind of processing or analysis.

2 Likes

You can also consider command line converter provided in Plastimatch: http://plastimatch.org/plastimatch.html.

If you compare both approaches, it would be good if you could share your experience!

1 Like

Hello

I reopen that topic because I am in a similar case.
I also want to read my DICOM-RT structure set files with sitk, but I don t know how.

Could you explain how can I use Plastimatch on python to convert RT and read them

I am a beginner in using python and sitk

I figure it out how to do it but still facing some issues…
i run :

“plastimatch convert
–input structures.dcm
–output-ss-img outfile.nrrd
–output-ss-list outfile.txt”

and that s the error they are showing me :

[nrrd] nrrdSave: couldn’t fopen(“outfile.nrrd”,“wb”): Permission denied
save_ss_img: save_ss_list
Could not open ss_list file for write: outfile.txt

Why isn t it working ?

Try putting full paths there, such as C:/image/outfile.nrrd. You might be running as ordinary user, and might not have permission to write to whatever is the current directory.

C:\Program Files\Plastimatch>plastimatch convert --input RT_essai.dcm --output-ss-img C:/Program Files/Plastimatch/outfile.nrrd --output-ss-list outfile.txt
Error. Unknown option Files/Plastimatch/outfile.nrrd

When the path has spaces, you need to put it in quotes ... --output-ss-img "C:/Program Files/Plastimatch/outfile.nrrd" --output-ss-list ...

1 Like

Hello,

now it works, it convert the RT file but don t know why it cannot save it ??

Preformatted textitk::ExceptionObject (000000646C4FE2B0)
Location: "unknown"
File: C:\Users\grego\build\src\InsightToolkit-4.13.2\Modules\IO\NRRD\src\itkNrrdImageIO.cxx
Line: 1123
Description: itk::ERROR: NrrdImageIO(0000018EE9CE9480): Write: Error writing C:/Program Files/Plastimatch/_11F06DD_Y5_M6_P50_/outfile.nrrd:
[nrrd] nrrdSave: couldn't fopen("C:/Program Files/Plastimatch/_11F06DD_Y5_M6_P50_/outfile.nrrd","wb"): Permission denied



save_ss_img: save_ss_list
Could not open ss_list file for write: outfile.txt

this is what it says

You should be running the program as an administrator in order to write to C:/Program Files/, as it is a known system directory. Also possible reason: the path C:/Program Files/Plastimatch/_11F06DD_Y5_M6_P50_/ does not exist, so no file in it could be written.

The path do exist and i am the administrator.
Even if i remove the path, it says the same thing

Maybe pick another path? I am administrator too, and I can’t write into some folders e.g. C:\, so I write into C:\a\, as a short path which is easy to type.

By “running the program as an administrator” I meant invoke it from a command prompt which was started as an administrator:
Screenshot 2020-04-07 12.06.28

I ran the prompt as an Administrator and it worked.
Apparently I wasn t the admin before…

Thank you

Being a user with administrative privileges is not the same as special account “Administrator”.

I guess Microsoft’s programmers concluded that people are mostly having administrator privileges and reserved a few operations for “Administrator” account only.