Skip to content

Commit

Permalink
BUG: Fix incorrect check for minimum ROI dimensions.
Browse files Browse the repository at this point in the history
By using `<=`, also ROIs that had the same number of dimensions as minimum dimensions were excluded.

Additionally, set the default value for required minimum dimensions to 2 (2D ROIs).
  • Loading branch information
JoostJM committed Sep 7, 2018
1 parent 0fe737e commit 623b836
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion docs/customization.rst
Expand Up @@ -201,7 +201,7 @@ Feature Extractor Level

*Mask validation*

- ``minimumROIDimensions`` [1]: Integer, range 1-3, specifies the minimum dimensions (1D, 2D or 3D, respectively).
- ``minimumROIDimensions`` [2]: Integer, range 1-3, specifies the minimum dimensions (1D, 2D or 3D, respectively).
Single-voxel segmentations are always excluded.
- ``minimumROISize`` [None]: Integer, > 0, specifies the minimum number of voxels required. Test is skipped
if this parameter is omitted (specifying it as None in the parameter file will throw an error).
Expand Down
2 changes: 1 addition & 1 deletion radiomics/featureextractor.py
Expand Up @@ -83,7 +83,7 @@ def _getDefaultSettings(cls):
are defined in the respective feature classes and and not included here. Similarly, filter specific settings are
defined in ``imageoperations.py`` and also not included here.
"""
return {'minimumROIDimensions': 1,
return {'minimumROIDimensions': 2,
'minimumROISize': None, # Skip testing the ROI size by default
'normalize': False,
'normalizeScale': 1,
Expand Down
4 changes: 2 additions & 2 deletions radiomics/imageoperations.py
Expand Up @@ -159,7 +159,7 @@ def checkMask(imageNode, maskNode, **kwargs):
correctedMask = None

label = kwargs.get('label', 1)
minDims = kwargs.get('minimumROIDimensions', 1)
minDims = kwargs.get('minimumROIDimensions', 2)
minSize = kwargs.get('minimumROISize', None)

logger.debug('Checking mask with label %d', label)
Expand Down Expand Up @@ -208,7 +208,7 @@ def checkMask(imageNode, maskNode, **kwargs):

logger.debug('Checking minimum number of dimensions requirements (%d)', minDims)
ndims = numpy.sum((boundingBox[1::2] - boundingBox[0::2] + 1) > 1) # UBound - LBound + 1 = Size
if ndims <= minDims:
if ndims < minDims:
logger.error('mask has too few dimensions (number of dimensions %d, minimum required %d)', ndims, minDims)
return None, correctedMask

Expand Down

0 comments on commit 623b836

Please sign in to comment.