SlicerRadiomics--contour voxel size

Hi Slicer Developer,

I am using SlicerRadiomics to extract features. The contour is based on CT image so the voxel size of contour matrix is the same as CT image. However, the voxel size of the Input volume (MRI image) is different from the contour matrix voxel size. So, I am wondering, during the feature calculation, will the contour will be resampled to the same voxel size of input image, and then do the feature calculation? Many thanks.

Best,
Tingting

You can control this in the settings, see https://pyradiomics.readthedocs.io/en/latest/customization.html#feature-extractor-level.

You should be able to set resampled voxel size in the module GUI to 0,0,0 to resample input image to the resolution of the mask. Let us know if this does not work.

Hi Andrey,

Thank you for your reply. Actually, I want to resample contour to the resolution of input image. Could I do that easily?

Best,
Tingting

Yes, you can specify any resolution to use for resampling in the module interface.

Hi Andrey,

Thank you for your quick response. I still have some confusion.

  1. In my case, contour, also named segment, is the same as mask. I generated a Labelmap Volume of segment named GTV, the voxel size is the same as CT image, which is 1.17mmx1.17mmx3mm. Then, I resampled this Labelmap Volume to a new Labelmap Volume with voxel size 0.75mmx0.75mmx1mm. However, this resampling method did not give me the right contour. Below is the screenshot, red represents the original contour, blue is the resampled contour, they have different size.

  2. Thank you for sharing the link with me, I found a website from the link you shared talked about Pipeline of Radiomics, there is a function named “radiomics. imageoperations. checkMask(imageNode, maskNode, kwargs)”, this function seems to check if the mask contains a valid ROI, which is exactly I want. So, when I choose input image and input region which is segment or mask based on CT image (they have different voxel sizes), two questions pop up. In SlicerRadiomics based on 3D slicer platform, first, will the input regions (mask) be resampled to the voxel size of input image automatically? If the answer is yes for the last question, then, will checkMask function be initialized to correct the mask if the size of resampled mask does not match the original mask automatically?

P.S I mention voxel size and size at the same time. To clear the confusion, voxel size is pixel spacing, size means how large it is.

Many thanks.

Best wishes,
Tingting

https://pyradiomics.readthedocs.io/en/latest/radiomics.html#radiomics.imageoperations.normalizeImage
Check%20Mask

As you’ve mentioned, PyRadiomics indeed checks if the geometry (i.e. spacing, size and direction) of the mask matches that of the images. By default in PyRadiomics, it throws an error if there is a mismatch.

By setting correctMask to True, PyRadiomics instead tries to resample the mask to the image geometry, using nearest neighbor interpolation. If correction is needed, a warning is still displayed, but extraction will not fail
Only constraint here is that the bounding box of the mask has to be contained in the physical space defined by the image. If that is not the case, extraction will still fail.

In SlicerRadiomics, correctMask is already switched on by default, as labelmaps in slicer are often represented as a cropped version of the image space (i.e. size mismatch).

As to you result, which functionality did you use?

1 Like

Hi Joost,

Thank you.

I used module named Resample Scalar Voulme to do the resampling. I tried three methods, linear, nearestNeighbor, Bspline, and below are the results. Red represents the original mask with voxel size 1.17x1.17x3.3mm while blues are the resampled mask with voxel size 0.75x0.75x1mm. Bspline method gives the accurate boundary but some pixels inside the mask were not labeled. Will these pixels be labeled when correctMask is switched on?

Best,
Tingting

linear
linear
Nearest Neighbor
nearestNei
Bspline
bspline

Hi Tingting,

PyRadiomics uses nearestNeighbor to resample the mask. The interpolator that can be set in the configuration is only used for resampling the image if resampling is enabled.

Best,

Joost

Hi Joost,

Thank you. Thank you for clearing my confusion.

Best wishes
Tingting