Didn't order prostate fries! bug in ROIContour.getBinaryMask() where minSpatialResolution is assumed to be 1

There is a bug in ROIContour.getBinaryMask() where minSpatialResolution is assumed to be 1. This assumption does not hold for trans rectal ultrasound scans, resulting in the “fries artifact” on when converting mask to mesh and back to masks.

The fix is quick tho:

   def getBinaryMask(self, origin=None, gridSize=None, spacing=None):
        """
        Convert the ROI contour to a binary mask image.

        Parameters
        ---------
        origin: array    (optional)
            Origin of the binary mask image.
        gridSize: array    (optional)
            Grid size of the binary mask image.
        spacing: array    (optional)
            Voxel spacing of the binary mask image.

        Returns
        -------
        mask: ROIMask
            Binary mask image.
        """
line 77 if spacing is None:
            minSpatialResolution = 1.
        else:
            minSpatialResolution = min(spacing[:2])
.
.
.
line 123 contourSpacing[2] = spacing[2] if not (spacing is None) else minSpatialResolution

Hello Hossein,

If I am not mistaken, you already included the fix in the patch you forwarded from the Enger Lab’s OpenTPS fork (thank you again for the amazing work).

I am currently in the process of merging it into our code (apologies for the delay) and I will let you know as soon as the code is merged into the dev branch while waiting for the realase.

P.S.: Since OpenTPS originates from Belgium, anything that produces fries is more of a feature than a bug… but that’s debatable!

Regards,
Eliot

2 Likes

I made the patch a while back, this one is a bit more recent. I will keep up with the dev branch from now on then.

P.S. it’s a Based feature indeed lol

1 Like