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
