SlicerRT’s RTSTRUCT to Binary Mask Conversion Algorithm and Dice Coefficient Calculation

Hello everyone,

I need to calculate the Dice coefficient for my organs using Python code, independently from 3D Slicer. I have already written the code for calculating this coefficient and posted it at the following link:

https://discourse.itk.org/t/dice-coefficient-calculation-in-python/7628/2”

under the title “Dice Coefficient Calculation in Python”.

As I mentioned there, the Dice coefficient value calculated by my code is different from the value obtained by 3D Slicer.

Following up on that discussion, I would like to add the following question:

Could you please explain in detail the algorithm that Slicer (or SlicerRT) uses to convert RTSTRUCT contour data into a binary labelmap mask? Specifically, does it perform slice-by-slice 2D polygon filling or true 3D volumetric rasterization? Does it apply any interpolation, hole filling, or other morphological operations? And how does it handle alignment between the contour points and the CT image grid (spacing, orientation, and origin)?

Thanks a lot

You can find most of this information in the following journal paper and PhD dissertation. There is a paper specifically about planar contours to closed surface conversion that is referenced from these.

Pinter, C., Lasso, A., & Fichtinger, G. (2019). Polymorph segmentation representation for medical image computing. Computer Methods and Programs in Biomedicine, 171, 19–26. https://doi.org/10.1016/j.cmpb.2019.02.011

(https://labs.cs.queensu.ca/perklab/wp-content/uploads/sites/3/2024/02/Pinter2019_Manuscript.pdf)

https://qspace.library.queensu.ca/handle/1974/26422