GSTT-CSC / TotalSegmentator-AIDE

TotalSegmentator packaged as an AIDE Application, based on the MONAI Application Package (MAP) standard.
Other
24 stars 5 forks source link

Ensure output RT Struct DICOMs compatible with Eclipse #11

Closed tomaroberts closed 1 year ago

tomaroberts commented 1 year ago

From some quick testing with George on 18/01/2023, we were unable to open the RT Struct .dcm files in Eclipse. Need to investigate.

Potential things to try:

hshuaib90 commented 1 year ago

Would it be easier to just look at the Eclipse log files? Anil said RT Physics should have access.

tomaroberts commented 1 year ago

George sent logs from Eclipse. Same error message repeatedly – lots of invalid VR DS lengths, e.g:

01/19/2023 17:43:26 RTSTRUCT #1 / RTstruct (lymphoma-ct-rt-struct) Warning General Size (18) of "19.034504652023315" is invalid for VR DS 01/19/2023 17:43:26 RTSTRUCT #1 / RTstruct (lymphoma-ct-rt-struct) Warning General Size (19) of "-6.3554956912994385" is invalid for VR DS 01/19/2023 17:43:26 RTSTRUCT #1 / RTstruct (lymphoma-ct-rt-struct) Warning General Size (17) of "5.070004463195801" is invalid for VR DS

These tags correspond to the contours. Investigating DICOM standard (https://dicom.nema.org/dicom/2013/output/chtml/part05/sect_6.2.html) there is a 16 byte maximum size on VR DS items:

image

So! I'll implement a fix to round these values to <16 decimal places and it should fix it.

hshuaib90 commented 1 year ago

Great, it would be great to document this somewhere or build it into a library to help future devs.

tomaroberts commented 1 year ago

TODO:

Edit line 195 in rt_utils/ds_helper.py with something like contour.ContourData = [round(val,10) for val in contour_data]

Then recompile MAP, generate new DICOM RT Struct file and try to open in Eclipse.

tomaroberts commented 1 year ago

Generated some new DICOMs offline with <16 byte DS items. Sent to George for testing in Eclipse.

tomaroberts commented 1 year ago

Can confirm this works! TotalSegmentator-AIDE RTStruct files will open in Eclipse. Have submitted PR to rt-utils repo which will hopefully enable this fix within the package itself, rather than implementing workaround in the MAP.

tomaroberts commented 1 year ago

PR now merged in rt-utils, here: https://github.com/qurit/rt-utils/pull/81

So end-to-end now complete and this issue resolved.