Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Divison by zero? #359

Closed
aydindemircioglu opened this issue Mar 9, 2018 · 27 comments
Closed

Divison by zero? #359

aydindemircioglu opened this issue Mar 9, 2018 · 27 comments
Labels

Comments

@aydindemircioglu
Copy link

I get a strange message, when enabling all features and image types:

File "/usr/local/lib/python3.6/dist-packages/radiomics/base.py", line 162, in calculateFeatures
self.featureValues[feature] = getattr(self, 'get%sFeatureValue' % feature)()
File "/usr/local/lib/python3.6/dist-packages/radiomics/ngtdm.py", line 238, in getContrastFeatureValue
contrast = (numpy.sum(p_i[:, None] * p_i[None, :] * (i[:, None] - i[None, :]) ** 2) / (Ngp * (Ngp - 1))) *
File "/usr/lib/python3.6/warnings.py", line 101, in _showwarnmsg
_showwarnmsg_impl(msg)
File "/usr/lib/python3.6/warnings.py", line 28, in _showwarnmsg_impl
text = _formatwarnmsg(msg)
File "/usr/lib/python3.6/warnings.py", line 116, in _formatwarnmsg
msg.filename, msg.lineno, line=msg.line)
TypeError: itkFormatWarning() got an unexpected keyword argument 'line'

Inspecting the line, it seems that the error occurs if the divisor, D = (numpy.sum(s_i)) / Nvp, is zero.
There is no check for this there, and probably one should be added.

(Again thanks for the great package :D)

@JoostJM
Copy link
Collaborator

JoostJM commented Mar 16, 2018

Nvp is the number of voxels which have a valid region. If that number is zero, this most likely means that your segmentation consists only of individual voxels here and there. In that case, it is not possible to calculated texture and you should review that case and consider excluding it.

If this case does contain a valid segmentation, could you share an anonymized copy so we can debug?

@aydindemircioglu
Copy link
Author

I will check the segmentation again, and come back to you. (And for sure you are right)
But nonetheless, would a proper error logging like "Unable to compute contrast, is the segmentation correct?" not better than just crashing? Also, as i often compute many features inside a simple, i'd personally like that there is just a warning instead of a crash, but i could clearly catch the error myself.

@JoostJM
Copy link
Collaborator

JoostJM commented Mar 19, 2018

@aydindemircioglu There already is some checking of validity of the mask prior to feature calculation. Moreover, the division by 0 is just causing a warning, not a crash. The error you get is a format error, in that ITK is unable to format the warning message and therefore throws an error. I will look into this further...

@aydindemircioglu
Copy link
Author

strange, i had to reinstall my linux OS on one of my computers, there, with python 3.5, i dont get the above error message but just "invalid value encountered in double_scalars". the mask itself it pretty large, around 13000 voxels, and from very first sight (non-radiologist and 8bit compressed image) i'm sure that there is contrast there. its also not loosely connected, as i explicitly throw out everything except for the largest region (using "all-direction" connecteness). will try to understand what happens there.

@aydindemircioglu
Copy link
Author

@JoostJM
its hard for me to debug properly, but it seems a bit like there is not enough contrast,
thus only 1 bin gets applied, thus(?) there only one s_i coeffient, which is zero.
something along those lines perhaps? the start of the log file is like this, the INVALID line
i added just prior to the offending line, just to see where to look at.
it actually happens multiple times for the image/mask combination, i assume this is because
of different image types.

INFO:radiomics.featureextractor: No valid config parameter, applying defaults: {'normalize': False, 'resegmentRange': None, 'force2Ddimension': 0, 'removeOutliers': None, 'force2D': False, 'minimumROIDimensions': 1, 'resampledPixelSpacing': None, 'normalizeScale': 1, 'enableCExtensions': True, 'minimumROISize': None, 'preCrop': False, 'label': 1, 'padDistance': 5, 'distances': [1], 'additionalInfo': True, 'interpolator': 'sitkBSpline'}
INFO:radiomics.featureextractor: Enabled image types: {'Original': {}}
INFO:radiomics.featureextractor: Enabled features: {'shape': [], 'firstorder': [], 'glrlm': [], 'gldm': [], 'glszm': [], 'ngtdm': [], 'glcm': []}
DEBUG:radiomics.featureextractor: Enabling all features in all feature classes
DEBUG:radiomics.featureextractor: Enabled features: {'shape': [], 'firstorder': [], 'glrlm': [], 'gldm': [], 'glszm': [], 'ngtdm': [], 'glcm': []}
DEBUG:radiomics.featureextractor: Enabling all image types
DEBUG:radiomics.featureextractor: Enabled images types: {'LBP3D': {}, 'Square': {}, 'Gradient': {}, 'Original': {}, 'Logarithm': {}, 'LoG': {}, 'SquareRoot': {}, 'Exponential': {}, 'Wavelet': {}, 'LBP2D': {}}
DEBUG:radiomics.featureextractor: Enabling image type LoG (additional custom settings: {'sigma': [1.0]})
DEBUG:radiomics.featureextractor: Enabled images types: {'LBP3D': {}, 'Square': {}, 'Gradient': {}, 'Original': {}, 'Logarithm': {}, 'LoG': {'sigma': [1.0]}, 'SquareRoot': {}, 'Exponential': {}, 'Wavelet': {}, 'LBP2D': {}}
INFO:radiomics.featureextractor: Calculating features with label: 1
DEBUG:radiomics.featureextractor: Enabled images types: {'LBP3D': {}, 'Square': {}, 'Gradient': {}, 'Original': {}, 'Logarithm': {}, 'LoG': {'sigma': [1.0]}, 'SquareRoot': {}, 'Exponential': {}, 'Wavelet': {}, 'LBP2D': {}}
DEBUG:radiomics.featureextractor: Enabled features: {'shape': [], 'firstorder': [], 'glrlm': [], 'gldm': [], 'glszm': [], 'ngtdm': [], 'glcm': []}
DEBUG:radiomics.featureextractor: Current settings: {'normalize': False, 'resegmentRange': None, 'force2Ddimension': 0, 'removeOutliers': None, 'force2D': False, 'minimumROIDimensions': 1, 'resampledPixelSpacing': None, 'normalizeScale': 1, 'enableCExtensions': True, 'minimumROISize': None, 'preCrop': False, 'label': 1, 'padDistance': 5, 'distances': [1], 'additionalInfo': True, 'interpolator': 'sitkBSpline'}
INFO:radiomics.featureextractor: Loading image and mask
DEBUG:radiomics.imageoperations: Checking mask with label 1
DEBUG:radiomics.imageoperations: Calculating bounding box
DEBUG:radiomics.imageoperations: Checking minimum number of dimensions requirements (1)
DEBUG:radiomics.featureextractor: Image and Mask loaded and valid, starting extraction
INFO:radiomics.featureextractor: Adding additional extraction information
DEBUG:radiomics.imageoperations: Cropping to size [61 54 15]
INFO:radiomics.featureextractor: Computing shape
DEBUG:radiomics.shape: Initializing feature class
DEBUG:radiomics.shape: Padding the mask with 0s
DEBUG:radiomics.shape: Pre-calculate Volume, Surface Area and Eigenvalues
DEBUG:radiomics.shape: Calculating Surface Area in C
DEBUG:radiomics.shape: Shape feature class initialized
DEBUG:radiomics.shape: Calculating features
DEBUG:radiomics.shape: Calculating Maximum 3D diameter in C
DEBUG:radiomics.imageoperations: Generating angles
DEBUG:radiomics.imageoperations: Generated 13 angles
DEBUG:radiomics.featureextractor: Creating image type iterator
INFO:radiomics.featureextractor: Adding image type "LBP3D" with settings: {'normalize': False, 'force2Ddimension': 0, 'resampledPixelSpacing': None, 'normalizeScale': 1, 'enableCExtensions': True, 'minimumROISize': None, 'label': 1, 'distances': [1], 'resegmentRange': None, 'removeOutliers': None, 'force2D': False, 'minimumROIDimensions': 1, 'preCrop': False, 'padDistance': 5, 'additionalInfo': True, 'interpolator': 'sitkBSpline'}
INFO:radiomics.featureextractor: Adding image type "Square" with settings: {'normalize': False, 'force2Ddimension': 0, 'resampledPixelSpacing': None, 'normalizeScale': 1, 'enableCExtensions': True, 'minimumROISize': None, 'label': 1, 'distances': [1], 'resegmentRange': None, 'removeOutliers': None, 'force2D': False, 'minimumROIDimensions': 1, 'preCrop': False, 'padDistance': 5, 'additionalInfo': True, 'interpolator': 'sitkBSpline'}
INFO:radiomics.featureextractor: Adding image type "Gradient" with settings: {'normalize': False, 'force2Ddimension': 0, 'resampledPixelSpacing': None, 'normalizeScale': 1, 'enableCExtensions': True, 'minimumROISize': None, 'label': 1, 'distances': [1], 'resegmentRange': None, 'removeOutliers': None, 'force2D': False, 'minimumROIDimensions': 1, 'preCrop': False, 'padDistance': 5, 'additionalInfo': True, 'interpolator': 'sitkBSpline'}
INFO:radiomics.featureextractor: Adding image type "Original" with settings: {'normalize': False, 'force2Ddimension': 0, 'resampledPixelSpacing': None, 'normalizeScale': 1, 'enableCExtensions': True, 'minimumROISize': None, 'label': 1, 'distances': [1], 'resegmentRange': None, 'removeOutliers': None, 'force2D': False, 'minimumROIDimensions': 1, 'preCrop': False, 'padDistance': 5, 'additionalInfo': True, 'interpolator': 'sitkBSpline'}
INFO:radiomics.featureextractor: Adding image type "Logarithm" with settings: {'normalize': False, 'force2Ddimension': 0, 'resampledPixelSpacing': None, 'normalizeScale': 1, 'enableCExtensions': True, 'minimumROISize': None, 'label': 1, 'distances': [1], 'resegmentRange': None, 'removeOutliers': None, 'force2D': False, 'minimumROIDimensions': 1, 'preCrop': False, 'padDistance': 5, 'additionalInfo': True, 'interpolator': 'sitkBSpline'}
INFO:radiomics.featureextractor: Adding image type "LoG" with settings: {'normalize': False, 'force2Ddimension': 0, 'resampledPixelSpacing': None, 'normalizeScale': 1, 'enableCExtensions': True, 'minimumROISize': None, 'label': 1, 'distances': [1], 'resegmentRange': None, 'removeOutliers': None, 'force2D': False, 'minimumROIDimensions': 1, 'sigma': [1.0], 'preCrop': False, 'padDistance': 5, 'additionalInfo': True, 'interpolator': 'sitkBSpline'}
INFO:radiomics.featureextractor: Adding image type "SquareRoot" with settings: {'normalize': False, 'force2Ddimension': 0, 'resampledPixelSpacing': None, 'normalizeScale': 1, 'enableCExtensions': True, 'minimumROISize': None, 'label': 1, 'distances': [1], 'resegmentRange': None, 'removeOutliers': None, 'force2D': False, 'minimumROIDimensions': 1, 'preCrop': False, 'padDistance': 5, 'additionalInfo': True, 'interpolator': 'sitkBSpline'}
INFO:radiomics.featureextractor: Adding image type "Exponential" with settings: {'normalize': False, 'force2Ddimension': 0, 'resampledPixelSpacing': None, 'normalizeScale': 1, 'enableCExtensions': True, 'minimumROISize': None, 'label': 1, 'distances': [1], 'resegmentRange': None, 'removeOutliers': None, 'force2D': False, 'minimumROIDimensions': 1, 'preCrop': False, 'padDistance': 5, 'additionalInfo': True, 'interpolator': 'sitkBSpline'}
INFO:radiomics.featureextractor: Adding image type "Wavelet" with settings: {'normalize': False, 'force2Ddimension': 0, 'resampledPixelSpacing': None, 'normalizeScale': 1, 'enableCExtensions': True, 'minimumROISize': None, 'label': 1, 'distances': [1], 'resegmentRange': None, 'removeOutliers': None, 'force2D': False, 'minimumROIDimensions': 1, 'preCrop': False, 'padDistance': 5, 'additionalInfo': True, 'interpolator': 'sitkBSpline'}
INFO:radiomics.featureextractor: Adding image type "LBP2D" with settings: {'normalize': False, 'force2Ddimension': 0, 'resampledPixelSpacing': None, 'normalizeScale': 1, 'enableCExtensions': True, 'minimumROISize': None, 'label': 1, 'distances': [1], 'resegmentRange': None, 'removeOutliers': None, 'force2D': False, 'minimumROIDimensions': 1, 'preCrop': False, 'padDistance': 5, 'additionalInfo': True, 'interpolator': 'sitkBSpline'}
DEBUG:radiomics.featureextractor: Extracting features
INFO:radiomics.featureextractor: Calculating features for lbp-3D-m1 image
DEBUG:radiomics.imageoperations: Cropping to size [61 54 15]
INFO:radiomics.featureextractor: Computing firstorder
DEBUG:radiomics.firstorder: Initializing feature class
DEBUG:radiomics.firstorder: First order feature class initialized
DEBUG:radiomics.firstorder: Calculating features
DEBUG:radiomics.imageoperations: Calculated 1 bins for bin width 25 with edges: [ 0. 25.])
DEBUG:radiomics.imageoperations: Calculated 1 bins for bin width 25 with edges: [ 0. 25.])
INFO:radiomics.featureextractor: Computing glrlm
DEBUG:radiomics.glrlm: Initializing feature class
DEBUG:radiomics.imageoperations: Discretizing gray levels inside ROI
DEBUG:radiomics.imageoperations: Calculated 1 bins for bin width 25 with edges: [ 0. 25.])
DEBUG:radiomics.glrlm: Calculating GLRLM matrix in C
DEBUG:radiomics.imageoperations: Generating angles
DEBUG:radiomics.imageoperations: Generated 13 angles
DEBUG:radiomics.glrlm: Process calculated matrix
DEBUG:radiomics.glrlm: No empty angles
DEBUG:radiomics.glrlm: Calculating GLRLM coefficients
DEBUG:radiomics.glrlm: GLRLM feature class initialized, calculated GLRLM with shape (1, 54, 13)
DEBUG:radiomics.glrlm: Calculating features
INFO:radiomics.featureextractor: Computing gldm
DEBUG:radiomics.gldm: Initializing feature class
DEBUG:radiomics.imageoperations: Discretizing gray levels inside ROI
DEBUG:radiomics.imageoperations: Calculated 1 bins for bin width 25 with edges: [ 0. 25.])
DEBUG:radiomics.imageoperations: Generating angles
DEBUG:radiomics.imageoperations: Generated 13 angles
DEBUG:radiomics.gldm: Feature class initialized, calculated GLDM with shape (1, 24)
DEBUG:radiomics.gldm: Calculating features
INFO:radiomics.featureextractor: Computing glszm
DEBUG:radiomics.glszm: Initializing feature class
DEBUG:radiomics.imageoperations: Discretizing gray levels inside ROI
DEBUG:radiomics.imageoperations: Calculated 1 bins for bin width 25 with edges: [ 0. 25.])
DEBUG:radiomics.glszm: Calculating GLSZM matrix in C
DEBUG:radiomics.imageoperations: Generating angles
DEBUG:radiomics.imageoperations: Generated 13 angles
DEBUG:radiomics.glszm: Calculating GLSZM coefficients
DEBUG:radiomics.glszm: GLSZM feature class initialized, calculated GLSZM with shape (1, 1)
DEBUG:radiomics.glszm: Calculating features
INFO:radiomics.featureextractor: Computing ngtdm
DEBUG:radiomics.ngtdm: Initializing feature class
DEBUG:radiomics.imageoperations: Discretizing gray levels inside ROI
DEBUG:radiomics.imageoperations: Calculated 1 bins for bin width 25 with edges: [ 0. 25.])
DEBUG:radiomics.imageoperations: Generating angles
DEBUG:radiomics.imageoperations: Generated 13 angles
DEBUG:radiomics.ngtdm: Calculating features
ERROR:radiomics.ngtdm: INVALID

i also have a warning like

Calculating Local Binary Pattern in 2D, but extracting features in 3D. Use with caution!

on the command line (but i cant see it in the log file)-- i made sure to have trimesh, scipy
and scikit-images installed, do i overlook something?

@aydindemircioglu
Copy link
Author

mmh, this seems actually to happen much often than i thought-- i did not see it because to fix my loop i just did check if s_i == 0 if so, i return 0. maybe our images from this study have too low contrast for ngtdm to work?

@JoostJM
Copy link
Collaborator

JoostJM commented Mar 19, 2018

@aydindemircioglu, not necessarily, what kind of values do you get for originial_firstorder_range

The problem is that for texture calculation, you need to discretize your gray values. This is controlled by the binWidth parameter, which is by default 25 (aimed at CT). Apparently, your images have less contrast than that, indicating you should change that parameter.

@JoostJM
Copy link
Collaborator

JoostJM commented Mar 19, 2018

As to the warning "Calculating Local Binary Pattern in 2D, but extracting features in 3D. Use with caution!" that is due to the fact that PyRadiomics implements a local binary pattern filter for 2D and 3D separately (different calculation, see documentation). This warning is displayed when your extraction method (2D or 3D) does not comply with the chosen filter. Because you have both filters enabled, it gives the warning for the LBP2D filter (as your features are extracted in 3D).

@aydindemircioglu
Copy link
Author

thanks for all the input.

the range over all images is like this:

z$original_firstorder_Range
[1] 803 698 1073 694 1253 770 1739 802 1056 751 807 209 470 1026 768
[16] 696 222 863 595 779 753 1117 796 605 1285 471 845 477 884 1119
[31] 1267 989 1068 319 881 1760 423 848 420 910 907 1298 945 722 1267
[46] 1079 568 703 521 570

i just tried binWidth=5, but that doesnt help with the problem, i actually get then some other division by zero errors in other features. i also wanted to use binWidth=1, but then i guess this does not make much sense, and the matrices get quite large.

so for now i just skip ntgdm, i will check if i can send you an image so you can see the problem first hand.

@JoostJM
Copy link
Collaborator

JoostJM commented Mar 19, 2018

@aydindemircioglu I think I discovered the error, take a look at this line from your output:
INFO:radiomics.featureextractor: Calculating features for lbp-3D-m1 image
This means it's calculating features on this filter, and as is mentioned in the documentation of that filter, local binary pattern tends to have very small ranges of gray values, so for LBP, it makes sense to use a small binwidth (1 is fine, possibly even smaller than 1, but stick with 1 to start).
To apply a customized binwidth only for LBP, specify your parameter file like this:

imageType:
  Original: {}  # No customized settings for original filter
  LBP3D:
    binWidth: 1.0

featureClass:
  (...)  # Specify features to extract here

setting:
  (...)  # Specify your general settings here

@QiChen2014
Copy link

Hi @JoostJM , as you said , I specifed the parameter " LBP3D" in my parameter file like this:

imageType:    
  LBP3D:
    binWidth: 1.0

then I run it and I get this error:
Key 'LBP3D' was not defined. Path: '/imageType'.: Path: '/'>
What happend? I'm sure I have updated to the latest edition. Look forward to your reply and thank you for your time.

@JoostJM
Copy link
Collaborator

JoostJM commented Mar 21, 2018

@QiChen2014, This is a bug, I'm fixing it in #364.

@aydindemircioglu
Copy link
Author

i wont be able to test until next week, just in case you wonder.

@aydindemircioglu
Copy link
Author

i am really sorry, but i have to defer testing to mid may :S
you may want to close it for now, i can reopen it, if the error still persists.

@aydindemircioglu
Copy link
Author

aydindemircioglu commented Jul 3, 2018

ok, i took me only two month to get back to the topic :D (sorry again)

this is now a completely different data set, but i have the very same problem. i followed your advise, @JoostJM, and did apply the binwidth like this:

extractor.enableImageTypeByName('LBP3D', True, {'binwidth': 1.0})

but it did not help. also when i completely turn off the LBP computations

extractor.enableImageTypeByName('LBP2D', False, {})
extractor.enableImageTypeByName('LBP3D', False, {})

the error is still there.tried also with a binwidth of 0.5, 0.1 and 0.01 same thing. masks, as far as i can see them, are not constant or empty. disabling NGMT directly helps, as said.

@JoostJM
Copy link
Collaborator

JoostJM commented Jul 3, 2018

@aydindemircioglu Can you share your log? that really helps tracking issues like this down

@JoostJM
Copy link
Collaborator

JoostJM commented Jul 3, 2018

Also, can you share the results if you run only extracting firstorder Range (with all your intended filters enabled)? What kind of values do you see?

@aydindemircioglu
Copy link
Author

here are the debug loggings:

Enabled image types: {'Original': {}}
Enabled features: {'firstorder': [], 'glcm': [], 'gldm': [], 'glrlm': [], 'glszm': [], 'ngtdm': [], 'shape': []}
Enabling all features in all feature classes
Enabled features: {'firstorder': [], 'glcm': [], 'gldm': [], 'glrlm': [], 'glszm': [], 'ngtdm': [], 'shape': []}
Enabling all image types
Enabled images types: {'Original': {}, 'Exponential': {}, 'Gradient': {}, 'LBP2D': {}, 'LBP3D': {}, 'LoG': {}, 'Logarithm': {}, 'Square': {}, 'SquareRoot': {}, 'Wavelet': {}}
Enabling image type LoG (additional custom settings: {'sigma': [1.0]})
Enabled images types: {'Original': {}, 'Exponential': {}, 'Gradient': {}, 'LBP2D': {}, 'LBP3D': {}, 'LoG': {'sigma': [1.0]}, 'Logarithm': {}, 'Square': {}, 'SquareRoot': {}, 'Wavelet': {}}
Disabling image type LBP3D
Enabled images types: {'Original': {}, 'Exponential': {}, 'Gradient': {}, 'LBP2D': {}, 'LoG': {'sigma': [1.0]}, 'Logarithm': {}, 'Square': {}, 'SquareRoot': {}, 'Wavelet': {}}
Enabling image type LBP2D (additional custom settings: {})
Enabled images types: {'Original': {}, 'Exponential': {}, 'Gradient': {}, 'LBP2D': {}, 'LoG': {'sigma': [1.0]}, 'Logarithm': {}, 'Square': {}, 'SquareRoot': {}, 'Wavelet': {}}
        Executing feature extractor for region.
Calculating features with label: 1
Enabled images types: {'Original': {}, 'Exponential': {}, 'Gradient': {}, 'LBP2D': {}, 'LoG': {'sigma': [1.0]}, 'Logarithm': {}, 'Square': {}, 'SquareRoot': {}, 'Wavelet': {}}
Enabled features: {'firstorder': [], 'glcm': [], 'gldm': [], 'glrlm': [], 'glszm': [], 'ngtdm': [], 'shape': []}
Current settings: {'minimumROIDimensions': 1, 'minimumROISize': None, 'normalize': False, 'normalizeScale': 1, 'removeOutliers': None, 'resampledPixelSpacing': None, 'interpolator': 'sitkBSpline', 'preCrop': False, 'padDistance': 5, 'distances': [1], 'force2D': False, 'force2Ddimension': 0, 'resegmentRange': None, 'label': 1, 'additionalInfo': True, 'voxelBased': False}
Loading image and mask
Checking mask with label 1
Calculating bounding box
Checking minimum number of dimensions requirements (1)
Image and Mask loaded and valid, starting extraction
Adding additional extraction information
Cropping to size [114 107  38]
Computing shape
Initializing feature class
Padding the mask with 0s
Pre-calculate Volume, Surface Area and Eigenvalues
Calculating Surface Area in C
Shape feature class initialized
Calculating features
Calculating Maximum diameters in C
Creating image type iterator
Adding image type "Original" with custom settings: {}
Adding image type "Exponential" with custom settings: {}
Adding image type "Gradient" with custom settings: {}
Adding image type "LBP2D" with custom settings: {}
Adding image type "LoG" with custom settings: {'sigma': [1.0]}
Adding image type "Logarithm" with custom settings: {}
Adding image type "Square" with custom settings: {}
Adding image type "SquareRoot" with custom settings: {}
Adding image type "Wavelet" with custom settings: {}
Extracting features
Yielding original image
Calculating features for original image
Cropping to size [114 107  38]
Computing firstorder
Initializing feature class
First order feature class initialized
Calculating features
Calculated 10 bins for bin width 25 with edges: [ 25.  50.  75. 100. 125. 150. 175. 200. 225. 250. 275.])
Computing glcm
Initializing feature class
Discretizing gray levels inside ROI
Calculated 10 bins for bin width 25 with edges: [ 25  50  75 100 125 150 175 200 225 250 275])
Calculating GLCM matrix in C
Process calculated matrix
Create symmetrical matrix
No empty angles
Calculating GLCM coefficients
GLCM feature class initialized, calculated GLCM with shape (10, 10, 13)
Calculating features
GLCM is symmetrical, therefore Sum Average = 2 * Joint Average, only 1 needs to be calculated
Computing gldm
Initializing feature class
Discretizing gray levels inside ROI
Calculated 10 bins for bin width 25 with edges: [ 25  50  75 100 125 150 175 200 225 250 275])
Feature class initialized, calculated GLDM with shape (10, 27)
Calculating features
Computing glrlm
Initializing feature class
Discretizing gray levels inside ROI
Calculated 10 bins for bin width 25 with edges: [ 25  50  75 100 125 150 175 200 225 250 275])
Calculating GLRLM matrix in C
Process calculated matrix
No empty angles
Calculating GLRLM coefficients
GLRLM feature class initialized, calculated GLRLM with shape (10, 73, 13)
Calculating features
Computing glszm
Initializing feature class
Discretizing gray levels inside ROI
Calculated 10 bins for bin width 25 with edges: [ 25  50  75 100 125 150 175 200 225 250 275])
Calculating GLSZM matrix in C
Calculating GLSZM coefficients
GLSZM feature class initialized, calculated GLSZM with shape (10, 54)
Calculating features
Computing ngtdm
Initializing feature class
Discretizing gray levels inside ROI
Calculated 10 bins for bin width 25 with edges: [ 25  50  75 100 125 150 175 200 225 250 275])
Calculating features
Yielding exponential image
Calculating features for exponential image
Cropping to size [114 107  38]
Computing firstorder
Initializing feature class
First order feature class initialized
Calculating features
Calculated 2 bins for bin width 25 with edges: [ 0. 25. 50.])
Computing glcm
Initializing feature class
Discretizing gray levels inside ROI
Calculated 2 bins for bin width 25 with edges: [ 0. 25. 50.])
Calculating GLCM matrix in C
Process calculated matrix
Create symmetrical matrix
No empty angles
Calculating GLCM coefficients
GLCM feature class initialized, calculated GLCM with shape (2, 2, 13)
Calculating features
GLCM is symmetrical, therefore Sum Average = 2 * Joint Average, only 1 needs to be calculated
Computing gldm
Initializing feature class
Discretizing gray levels inside ROI
Calculated 2 bins for bin width 25 with edges: [ 0. 25. 50.])
Feature class initialized, calculated GLDM with shape (2, 27)
Calculating features
Computing glrlm
Initializing feature class
Discretizing gray levels inside ROI
Calculated 2 bins for bin width 25 with edges: [ 0. 25. 50.])
Calculating GLRLM matrix in C
Process calculated matrix
No empty angles
Calculating GLRLM coefficients
GLRLM feature class initialized, calculated GLRLM with shape (2, 114, 13)
Calculating features
Computing glszm
Initializing feature class
Discretizing gray levels inside ROI
Calculated 2 bins for bin width 25 with edges: [ 0. 25. 50.])
Calculating GLSZM matrix in C
Calculating GLSZM coefficients
GLSZM feature class initialized, calculated GLSZM with shape (2, 15)
Calculating features
Computing ngtdm
Initializing feature class
Discretizing gray levels inside ROI
Calculated 2 bins for bin width 25 with edges: [ 0. 25. 50.])
Calculating features
Calculating features for gradient image
Cropping to size [114 107  38]
Computing firstorder
Initializing feature class
First order feature class initialized
Calculating features
Calculated 5 bins for bin width 25 with edges: [  0.  25.  50.  75. 100. 125.])
Computing glcm
Initializing feature class
Discretizing gray levels inside ROI
Calculated 5 bins for bin width 25 with edges: [  0.  25.  50.  75. 100. 125.])
Calculating GLCM matrix in C
Process calculated matrix
Create symmetrical matrix
No empty angles
Calculating GLCM coefficients
GLCM feature class initialized, calculated GLCM with shape (5, 5, 13)
Calculating features
GLCM is symmetrical, therefore Sum Average = 2 * Joint Average, only 1 needs to be calculated
Computing gldm
Initializing feature class
Discretizing gray levels inside ROI
Calculated 5 bins for bin width 25 with edges: [  0.  25.  50.  75. 100. 125.])
Feature class initialized, calculated GLDM with shape (5, 27)
Calculating features
Computing glrlm
Initializing feature class
Discretizing gray levels inside ROI
Calculated 5 bins for bin width 25 with edges: [  0.  25.  50.  75. 100. 125.])
Calculating GLRLM matrix in C
Process calculated matrix
No empty angles
Calculating GLRLM coefficients
GLRLM feature class initialized, calculated GLRLM with shape (5, 113, 13)
Calculating features
Computing glszm
Initializing feature class
Discretizing gray levels inside ROI
Calculated 5 bins for bin width 25 with edges: [  0.  25.  50.  75. 100. 125.])
Calculating GLSZM matrix in C
Calculating GLSZM coefficients
GLSZM feature class initialized, calculated GLSZM with shape (5, 52)
Calculating features
Computing ngtdm
Initializing feature class
Discretizing gray levels inside ROI
Calculated 5 bins for bin width 25 with edges: [  0.  25.  50.  75. 100. 125.])
Calculating features
Calculating Local Binary Pattern in 2D, but extracting features in 3D. Use with caution!
Calculating features for lbp-2D image
Cropping to size [114 107  38]
Computing firstorder
Initializing feature class
First order feature class initialized
Calculating features
Calculated 1 bins for bin width 25 with edges: [ 0. 25.])
Computing glcm
Initializing feature class
Discretizing gray levels inside ROI
Calculated 1 bins for bin width 25 with edges: [ 0 25])
Calculating GLCM matrix in C
Process calculated matrix
Create symmetrical matrix
No empty angles
Calculating GLCM coefficients
GLCM feature class initialized, calculated GLCM with shape (1, 1, 13)
Calculating features
GLCM is symmetrical, therefore Sum Average = 2 * Joint Average, only 1 needs to be calculated
Computing gldm
Initializing feature class
Discretizing gray levels inside ROI
Calculated 1 bins for bin width 25 with edges: [ 0 25])
Feature class initialized, calculated GLDM with shape (1, 20)
Calculating features
Computing glrlm
Initializing feature class
Discretizing gray levels inside ROI
Calculated 1 bins for bin width 25 with edges: [ 0 25])
Calculating GLRLM matrix in C
Process calculated matrix
No empty angles
Calculating GLRLM coefficients
GLRLM feature class initialized, calculated GLRLM with shape (1, 114, 13)
Calculating features
Computing glszm
Initializing feature class
Discretizing gray levels inside ROI
Calculated 1 bins for bin width 25 with edges: [ 0 25])
Calculating GLSZM matrix in C
Calculating GLSZM coefficients
GLSZM feature class initialized, calculated GLSZM with shape (1, 1)
Calculating features
Computing ngtdm
Initializing feature class
Discretizing gray levels inside ROI
Calculated 1 bins for bin width 25 with edges: [ 0 25])
Calculating features
FAILED: Traceback (most recent call last):
  File "/usr/local/lib/python3.6/dist-packages/radiomics/base.py", line 297, in _calculateFeatures
    yield True, feature, getattr(self, 'get%sFeatureValue' % feature)()
  File "/usr/local/lib/python3.6/dist-packages/radiomics/ngtdm.py", line 161, in getContrastFeatureValue
    contrast = (numpy.sum(p_i[:, None] * p_i[None, :] * (i[:, None] - i[None, :]) ** 2) / (Ngp * (Ngp - 1))) * \
  File "/usr/lib/python3.6/warnings.py", line 101, in _showwarnmsg
    _showwarnmsg_impl(msg)
  File "/usr/lib/python3.6/warnings.py", line 28, in _showwarnmsg_impl
    text = _formatwarnmsg(msg)
  File "/usr/lib/python3.6/warnings.py", line 116, in _formatwarnmsg
    msg.filename, msg.lineno, line=msg.line)
TypeError: itkFormatWarning() got an unexpected keyword argument 'line'

Generating LoG images
Computing LoG with sigma 1
Yielding log-sigma-1-0-mm-3D image
Calculating features for log-sigma-1-0-mm-3D image
Cropping to size [114 107  38]
Computing firstorder

i call pyradiomics with these lines (here with lbp-2d, but as said, does not seem to matter)

            extractor = featureextractor.RadiomicsFeaturesExtractor()

            # enable all features and filters
            extractor.enableAllFeatures()
            #extractor.enableFeatureClassByName('ngtdm', enabled = False)

            extractor.enableAllImageTypes()
            extractor.enableImageTypeByName('LoG', True, {'sigma': [1.0]})
            extractor.enableImageTypeByName('LBP3D', False, {})
            extractor.enableImageTypeByName('LBP2D', True, {})

i relly wonder what i am doing wrong, as seemingly no one else is experiencing the problem. i will retest it on another computer to make sure i can reproduce this.
i also updated to the latest master.

@aydindemircioglu
Copy link
Author

regarding the range, i have several series (km, dce, darkfluid whatever), e.g. with darkfluid and a random image (it does not seem to depend on the image, i added a shuffle, so each time it is another image) i get 'original_firstorder_Range', 343.0

@JoostJM
Copy link
Collaborator

JoostJM commented Jul 4, 2018

@aydindemircioglu, that range is a lot smaller than the range of your average CT (on which the default bin width of 25 is based). You can see this reflected in your log, with generally less than 10 bins calculated.

Additionally, it is certainly too large for the LBP filter, so maybe use a custom even smaller binWidth there.

I suggest trying:

extractor = featureextractor.RadiomicsFeaturesExtractor()

# enable all features and filters
extractor.enableAllFeatures()
#extractor.enableFeatureClassByName('ngtdm', enabled = False)

extractor.settings['binWidth'] = 2.5  # Applies generally, overrides default binWidth - 25

extractor.enableAllImageTypes()
extractor.enableImageTypeByName('LoG', True, {'sigma': [1.0]})
extractor.enableImageTypeByName('LBP3D', True, {'binWidth': 0.5})  # Override the general binWidth of 2.5, as LBP generally returns small values.
extractor.enableImageTypeByName('LBP2D', False, {})  # You are extracting in 3D, so you can use the LBP in 3D as well

Finally, as to the error you're getting, that is a bug in (Simple)ITK, not in PyRadiomics. In your older installation with python 3.5, your installed SimpleITK did not have that bug, and correctly formatted the warning it is trying to give ("invalid value encountered in double_scalars", which happens in case of a division by 0)

@aydindemircioglu
Copy link
Author

thanks for all quick answer.
but i am still a bit puzzled. it does still not fix the error, i think, these are the new debug lines, could ib e that the binwidth is too small and the problem occurs in gldm instead of ngtdm?
should i normalize the images beforehand, by using the option in pyradiomics to be on the safe side?

Enabled image types: {'Original': {}}
Enabled features: {'firstorder': [], 'glcm': [], 'gldm': [], 'glrlm': [], 'glszm': [], 'ngtdm': [], 'shape': []}
Enabling all features in all feature classes
Enabled features: {'firstorder': [], 'glcm': [], 'gldm': [], 'glrlm': [], 'glszm': [], 'ngtdm': [], 'shape': []}
Enabling all image types
Enabled images types: {'Original': {}, 'Exponential': {}, 'Gradient': {}, 'LBP2D': {}, 'LBP3D': {}, 'LoG': {}, 'Logarithm': {}, 'Square': {}, 'SquareRoot': {}, 'Wavelet': {}}
Enabling image type LoG (additional custom settings: {'sigma': [1.0]})
Enabled images types: {'Original': {}, 'Exponential': {}, 'Gradient': {}, 'LBP2D': {}, 'LBP3D': {}, 'LoG': {'sigma': [1.0]}, 'Logarithm': {}, 'Square': {}, 'SquareRoot': {}, 'Wavelet': {}}
Disabling image type LBP3D
Enabled images types: {'Original': {}, 'Exponential': {}, 'Gradient': {}, 'LBP2D': {}, 'LoG': {'sigma': [1.0]}, 'Logarithm': {}, 'Square': {}, 'SquareRoot': {}, 'Wavelet': {}}
Enabling image type LBP2D (additional custom settings: {})
Enabled images types: {'Original': {}, 'Exponential': {}, 'Gradient': {}, 'LBP2D': {}, 'LoG': {'sigma': [1.0]}, 'Logarithm': {}, 'Square': {}, 'SquareRoot': {}, 'Wavelet': {}}
        Executing feature extractor for region.
Calculating features with label: 1
Enabled images types: {'Original': {}, 'Exponential': {}, 'Gradient': {}, 'LBP2D': {}, 'LoG': {'sigma': [1.0]}, 'Logarithm': {}, 'Square': {}, 'SquareRoot': {}, 'Wavelet': {}}
Enabled features: {'firstorder': [], 'glcm': [], 'gldm': [], 'glrlm': [], 'glszm': [], 'ngtdm': [], 'shape': []}
Current settings: {'minimumROIDimensions': 1, 'minimumROISize': None, 'normalize': False, 'normalizeScale': 1, 'removeOutliers': None, 'resampledPixelSpacing': None, 'interpolator': 'sitkBSpline', 'preCrop': False, 'padDistance': 5, 'distances': [1], 'force2D': False, 'force2Ddimension': 0, 'resegmentRange': None, 'label': 1, 'additionalInfo': True, 'binWidth': 2.5, 'voxelBased': False}
Loading image and mask
Checking mask with label 1
Calculating bounding box
Checking minimum number of dimensions requirements (1)
Image and Mask loaded and valid, starting extraction
Adding additional extraction information
Cropping to size [43 27  7]
Computing shape
Initializing feature class
Padding the mask with 0s
Pre-calculate Volume, Surface Area and Eigenvalues
Calculating Surface Area in C
Shape feature class initialized
Calculating features
Calculating Maximum diameters in C
Creating image type iterator
Adding image type "Original" with custom settings: {}
Adding image type "Exponential" with custom settings: {}
Adding image type "Gradient" with custom settings: {}
Adding image type "LBP2D" with custom settings: {}
Adding image type "LoG" with custom settings: {'sigma': [1.0]}
Adding image type "Logarithm" with custom settings: {}
Adding image type "Square" with custom settings: {}
Adding image type "SquareRoot" with custom settings: {}
Adding image type "Wavelet" with custom settings: {}
Extracting features
Yielding original image
Calculating features for original image
Cropping to size [43 27  7]
Computing firstorder
Initializing feature class
First order feature class initialized
Calculating features
Calculated 1247 bins for bin width 2.5 with edges: [ 505.   507.5  510.  ... 3617.5 3620.  3622.5])
Computing glcm
Initializing feature class
Discretizing gray levels inside ROI
Calculated 1247 bins for bin width 2.5 with edges: [ 505.   507.5  510.  ... 3617.5 3620.  3622.5])
Calculating GLCM matrix in C
Process calculated matrix
Create symmetrical matrix
No empty angles
Calculating GLCM coefficients
GLCM feature class initialized, calculated GLCM with shape (323, 323, 13)
Calculating features
GLCM is symmetrical, therefore Sum Average = 2 * Joint Average, only 1 needs to be calculated
Computing gldm
Initializing feature class
Discretizing gray levels inside ROI
Calculated 1247 bins for bin width 2.5 with edges: [ 505.   507.5  510.  ... 3617.5 3620.  3622.5])
Feature class initialized, calculated GLDM with shape (323, 5)
Calculating features
FAILED: Traceback (most recent call last):
  File "/usr/local/lib/python3.6/dist-packages/radiomics/base.py", line 297, in _calculateFeatures
    yield True, feature, getattr(self, 'get%sFeatureValue' % feature)()
  File "/usr/local/lib/python3.6/dist-packages/radiomics/gldm.py", line 377, in getLargeDependenceLowGrayLevelEmphasisFeatureValue
    ldlgle = numpy.sum(self.P_gldm * (jvector[None, :] ** 2) / (ivector[:, None] ** 2)) / Nz
  File "/usr/lib/python3.6/warnings.py", line 101, in _showwarnmsg
    _showwarnmsg_impl(msg)
  File "/usr/lib/python3.6/warnings.py", line 28, in _showwarnmsg_impl
    text = _formatwarnmsg(msg)
  File "/usr/lib/python3.6/warnings.py", line 116, in _formatwarnmsg
    msg.filename, msg.lineno, line=msg.line)
TypeError: itkFormatWarning() got an unexpected keyword argument 'line'

FAILED: Traceback (most recent call last):
  File "/usr/local/lib/python3.6/dist-packages/radiomics/base.py", line 297, in _calculateFeatures
    yield True, feature, getattr(self, 'get%sFeatureValue' % feature)()
  File "/usr/local/lib/python3.6/dist-packages/radiomics/gldm.py", line 300, in getLowGrayLevelEmphasisFeatureValue
    lgle = numpy.sum(pg / (ivector ** 2)) / Nz
  File "/usr/lib/python3.6/warnings.py", line 101, in _showwarnmsg
    _showwarnmsg_impl(msg)
  File "/usr/lib/python3.6/warnings.py", line 28, in _showwarnmsg_impl
    text = _formatwarnmsg(msg)
  File "/usr/lib/python3.6/warnings.py", line 116, in _formatwarnmsg
    msg.filename, msg.lineno, line=msg.line)
TypeError: itkFormatWarning() got an unexpected keyword argument 'line'

FAILED: Traceback (most recent call last):
  File "/usr/local/lib/python3.6/dist-packages/radiomics/base.py", line 297, in _calculateFeatures
    yield True, feature, getattr(self, 'get%sFeatureValue' % feature)()
  File "/usr/local/lib/python3.6/dist-packages/radiomics/gldm.py", line 339, in getSmallDependenceLowGrayLevelEmphasisFeatureValue
    sdlgle = numpy.sum(self.P_gldm / ((ivector[:, None] ** 2) * (jvector[None, :] ** 2))) / Nz
  File "/usr/lib/python3.6/warnings.py", line 101, in _showwarnmsg
    _showwarnmsg_impl(msg)
  File "/usr/lib/python3.6/warnings.py", line 28, in _showwarnmsg_impl
    text = _formatwarnmsg(msg)
  File "/usr/lib/python3.6/warnings.py", line 116, in _formatwarnmsg
    msg.filename, msg.lineno, line=msg.line)
TypeError: itkFormatWarning() got an unexpected keyword argument 'line'

Computing glrlm
Initializing feature class
Discretizing gray levels inside ROI

@aydindemircioglu
Copy link
Author

aydindemircioglu commented Jul 4, 2018

ok, adding normaliziation seems to fix the error (at least on first sight)-- and i dont' need to make binwidth smaller. though i wonder whether the default binwidth 25 is a good default choice when normalization is turned on? or should i change it to 2.5?

what is also not clear to me is whether normalization is a good thing to do, do you have experience on this? usually i'd (obviously) normalize everything in sight, but am not sure if in the radiomics domain the absolut values might carry some important information? or to put the question into better words: why normalization is not turned on by default?

@JoostJM
Copy link
Collaborator

JoostJM commented Jul 4, 2018

@aydindemircioglu Which version of SimpleITK do you have installed? (you can find this out by running pip list). An older version of SimpleITK may fix your error. This is important as these warnings can occur, also in case of a 'valid' feature extraction (that's why they're warnings, not errors).

As to normalization, it is disabled as it is not always necessary and we want to prevent users from accidentally leaving it on when they don't intend to (i.e. when it's turned on, the user explicitly configured it).
As to when to apply it: In general, I use it mainly when extracting from MR, as the gray values are relative values (and therefore less comparable between scans than say, gray values between 2 CT's, which have absolute (HU) values).

@aydindemircioglu
Copy link
Author

thanks for the infos on normalization, as a non-medical guy with not-so-much experience in medical imaging its very helpful to get hints from your experience. i will keep normalization then.

i had used the latest version 1.1.0 i think, i downgraded to 1.0.0, but the warning is still there. but i am confused, i added some verbose pritnting into ntgdm to see whats happening, and the denominator was zero, if i recall correctly. i will look at it again, to understand whether normalization has fixed the problem or not.

will report probably tomorrow.

@fedorov
Copy link
Collaborator

fedorov commented Jul 4, 2018

I tried to reproduce the issue on mac. Testing with python 3.6.1 and SimpleITK 1.0.1 (seems to be the latest), I am unable to reproduce. If I add division by zero to the feature calculation function, I get the below, as expected, using helloRadiomics.py example from the repository:

FAILED: Traceback (most recent call last):
  File "/Users/fedorov/.pyenv/versions/3.6.1/Python.framework/Versions/3.6/lib/python3.6/site-packages/pyradiomics-1.3.0.post125.dev0+g69933c7-py3.6-macosx-10.12-x86_64.egg/radiomics/base.py", line 297, in _calculateFeatures
    yield True, feature, getattr(self, 'get%sFeatureValue' % feature)()
  File "/Users/fedorov/.pyenv/versions/3.6.1/Python.framework/Versions/3.6/lib/python3.6/site-packages/pyradiomics-1.3.0.post125.dev0+g69933c7-py3.6-macosx-10.12-x86_64.egg/radiomics/firstorder.py", line 191, in getMeanFeatureValue
    return 100./0.
ZeroDivisionError: float division by zero

The error message @aydindemircioglu reported

TypeError: itkFormatWarning() got an unexpected keyword argument 'line'

does not make sense to me - the itk prefix seems to imply SimpleITK, but there is no SimpleITK involved in the calculation. And there is no such class or function in SimpleITK if I search for it.

I wonder if something got messed up in the python package installation. Can you try installing a fresh python via pyenv, installing pyradiomics from scratch and see if you can reproduce?

Also please let us know the answers to the following:

  • are you using the latest pyradiomics source?
  • how are you using pyradiomics - can you share the code that invokes feature calculation?

@aydindemircioglu
Copy link
Author

aydindemircioglu commented Jul 5, 2018

thanks andrey for looking into the matter.

first, i today again started to compute features, and when i disable ngtdm everything works without problems, had binWidth=0.05 and normalization turned on. this is now on another machine, but as i myself did the installation too, its "correlated" to my other machine. i could go ahead and reproduce in an clean virtualenv, but only on extrarequest, as i have to learn virtualevn first and i dont think it is related to the package installations. on this machine here i have python 3.6.5 and SimpleITK 1.0.1-- the latest is 1.1.0 (and i just installed it here too :D) and i usually have a recent pyradiomics working (master from monday on the other machine, here pip tells me pyradiomics==1.3.0.post69+gdffb440)

when i enable ngtdm, then the error occurs as written. i also suspect it has something to do with the contrast and range of the image, so i'd also believe that with 'finetuning' the binwidth i could probably get around the problem. but for me now disabling ngtdm is a much faster workaround.

second, to test where the error stems from, i now did two things: a) write out the contrast (the two denorminators) in the code and b) just plainly divide by zero, as you said. the first thing i already tested when opening the issue, and i get the same thing:

Ngp*(Ngp-1): 0
Nvp: 382.0
FAILED: Traceback (most recent call last):
  File "/usr/local/lib/python3.6/dist-packages/radiomics/base.py", line 162, in calculateFeatures
    self.featureValues[feature] = getattr(self, 'get%sFeatureValue' % feature)()
  File "/usr/local/lib/python3.6/dist-packages/radiomics/ngtdm.py", line 239, in getContrastFeatureValue
    contrast = (numpy.sum(p_i[:, None] * p_i[None, :] * (i[:, None] - i[None, :]) ** 2) / (Ngp * (Ngp - 1))) * \
  File "/usr/lib/python3.6/warnings.py", line 101, in _showwarnmsg
    _showwarnmsg_impl(msg)
  File "/usr/lib/python3.6/warnings.py", line 28, in _showwarnmsg_impl
    text = _formatwarnmsg(msg)
  File "/usr/lib/python3.6/warnings.py", line 116, in _formatwarnmsg
    msg.filename, msg.lineno, line=msg.line)
TypeError: itkFormatWarning() got an unexpected keyword argument 'line'

so it really seems that Ngp is 1 and as this should be the number of graylevels, i seem to have there an image+mask that becomes zero after binning (at 0.05).

ok, now, if insert a plain z=1/0 as you did, i get

  File "/usr/local/lib/python3.6/dist-packages/radiomics/base.py", line 162, in calculateFeatures
    self.featureValues[feature] = getattr(self, 'get%sFeatureValue' % feature)()
  File "/usr/local/lib/python3.6/dist-packages/radiomics/ngtdm.py", line 236, in getContrastFeatureValue
    z = 1/0
ZeroDivisionError: division by zero

but if i use z = numpy.sum(p_i[:, None] * p_i[None, :] * (i[:, None] - i[None, :]) ** 2)/0 i get the SimpleITK error again. printing out the type of this z i get <class 'numpy.float64'>. so i somehow assume that this is a class, even it looks like an usual float. so looked at my code again, and i realize that i do not convert them to numpy-- i just pass the image+mask as they are to the extractor, like this:

mask_image= helper.coregisterWithSeries (mask, series) # both simpleITK images
fv = extractor.execute(series, mask_image, l)

so maybe this is why SimpleITK comes into play? am not any kind of expert on python classes in general or SimpleITK in special. but i'd doubt that the error stems from anywhere else than an denominator that becomes in my case zero, because of some contrast/binning issues.

@aydindemircioglu
Copy link
Author

i'm closing the issue now, as the problem is really with the number of bincounts, it seems.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

4 participants