highdicom icon indicating copy to clipboard operation
highdicom copied to clipboard

Any support for reading RT structs?

Open sarthakpati opened this issue 6 months ago • 7 comments

Hi,

Thank you for this work!

I was trying to read an RT struct but got this error: ValueError: Dataset is not a Segmentation.

Are there any plans to add this support as well?

Kind regards, Sarthak

sarthakpati avatar Jun 21 '25 21:06 sarthakpati

Hi @sarthakpati

Yes I would love to support this and it's been on the to-do list for a while. Unfortunately there are several other things that are higher priority right now... I will get to it at some point, but until then, contributions welcome 🙂

CPBridge avatar Jun 21 '25 21:06 CPBridge

P.s. it would not make sense to implement it as an alternative form of segmentation, since RT Structs are their own IOD with overlapping but different characteristics to DICOM Segmentations. One cannot use one in place of the other arbitrarily and as such a different class would be required. Their APIs could have some similarities though

CPBridge avatar Jun 21 '25 21:06 CPBridge

Ah, understood. Thank you for the update!

sarthakpati avatar Jun 21 '25 21:06 sarthakpati

Maybe you are looking for a pure-python solution, but if you are just interested in processing data in an environment that is python-scriptable SlicerRT is an option.

pieper avatar Jun 21 '25 22:06 pieper

Thanks for the tip, @pieper!

I am looking to convert RT structs to numpy arrays, and not really interested in adding something like Slicer as a dependency for such a task.

Edit: found a nice, lightweight, and highly workable solution: https://github.com/Sikerdebaard/dcmrtstruct2nii which could potentially be leveraged for this task.

sarthakpati avatar Jun 22 '25 00:06 sarthakpati

Thanks for the pointer @sarthakpati - if that library suits your needs that's great.

As the readme at that site says, there can be some very tricky special cases in RT structs. Internally SlicerRT uses a library called that is pretty robust and widely used. Since it's VTK-based, so Python wrapped pretty easily.

https://github.com/PerkLab/PolySeg

pieper avatar Jun 22 '25 02:06 pieper

Cool, thanks, @pieper!

sarthakpati avatar Jun 22 '25 10:06 sarthakpati