AIM-Harvard / pyradiomics

Open-source python package for the extraction of Radiomics features from 2D and 3D images and binary masks. Support: https://discourse.slicer.org/c/community/radiomics
http://pyradiomics.readthedocs.io/
BSD 3-Clause "New" or "Revised" License
1.14k stars 492 forks source link

Misleading error message [BUG] #782

Open AnderBiguri opened 2 years ago

AnderBiguri commented 2 years ago

Describe the bug

While doing my own segmentations, I got the error:

  File "..../radiomics/imageoperations.py", line 268, in checkMask
    raise ValueError('mask has too few dimensions (number of dimensions %d, minimum required %d)' % (ndims, minDims))
ValueError: mask has too few dimensions (number of dimensions 1, minimum required 2)

However, my mask dimensions are indeed correct. After some investigation, the segmentation basically only provided 2 pixels, and the bounding box calculation inside that function in imageoperations.py returns a flat box, thus raising the error.

I think erroring is correct, but the error message is wrong, as its not that the mask has "too few dimensions", I inputed a 3D np.array, it has the dimensions required. Its the numerical value of the mask that is not correct.

PyRadiomics configuration Standard demo

To Reproduce Input a 3D mask of the correct shape, but only have 2 adjacent pixels true.

Expected behavior Output a message that describes the actual error.