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.16k stars 498 forks source link

[FEAT EXTRACTION] - IndexError: Error filling GLSZM. #676

Closed daivagyapareek closed 3 years ago

daivagyapareek commented 3 years ago

I am using 32 GB MBP and I am getting following error for one image, not sure what causing it.


IndexError Traceback (most recent call last)

in 5 print(len(comp_time),patient,(comp_time[-1]-comp_time[0])/60) 6 # try: ----> 7 result = extractor.execute(train_nrrd+patient+'/segmented.nrrd',train_nrrd+patient+'/filter.nrrd') 8 key_val = [(key,np.float64(val)) for key,val in result.items() if key in featureList] 9 key_val.append(('patientID',str(patient))) ~/opt/anaconda3/lib/python3.8/site-packages/radiomics/featureextractor.py in execute(self, imageFilepath, maskFilepath, label, label_channel, voxelBased) 328 logger.info('Calculating features for %s image', imageTypeName) 329 inputImage, inputMask = imageoperations.cropToTumorMask(inputImage, mask, boundingBox, padDistance=kernelRadius) --> 330 featureVector.update(self.computeFeatures(inputImage, inputMask, imageTypeName, **inputKwargs)) 331 332 logger.debug('Features extracted') ~/opt/anaconda3/lib/python3.8/site-packages/radiomics/featureextractor.py in computeFeatures(self, image, mask, imageTypeName, **kwargs) 515 featureClass.enableFeatureByName(feature) 516 --> 517 for (featureName, featureValue) in six.iteritems(featureClass.execute()): 518 newFeatureName = '%s_%s_%s' % (imageTypeName, featureClassName, featureName) 519 featureVector[newFeatureName] = featureValue ~/opt/anaconda3/lib/python3.8/site-packages/radiomics/base.py in execute(self) 183 self._calculateVoxels() 184 else: --> 185 self._calculateSegment() 186 187 return self.featureValues ~/opt/anaconda3/lib/python3.8/site-packages/radiomics/base.py in _calculateSegment(self) 222 def _calculateSegment(self): 223 # Get the feature values using the current segment. --> 224 for success, featureName, featureValue in self._calculateFeatures(): 225 # Always store the result. In case of an error, featureValue will be NaN 226 self.featureValues[featureName] = numpy.squeeze(featureValue) ~/opt/anaconda3/lib/python3.8/site-packages/radiomics/base.py in _calculateFeatures(self, voxelCoordinates) 229 # Initialize the calculation 230 # This function serves to calculate the texture matrices where applicable --> 231 self._initCalculation(voxelCoordinates) 232 233 self.logger.debug('Calculating features') ~/opt/anaconda3/lib/python3.8/site-packages/radiomics/glszm.py in _initCalculation(self, voxelCoordinates) 63 64 def _initCalculation(self, voxelCoordinates=None): ---> 65 self.P_glszm = self._calculateMatrix(voxelCoordinates) 66 67 self._calculateCoefficients() ~/opt/anaconda3/lib/python3.8/site-packages/radiomics/glszm.py in _calculateMatrix(self, voxelCoordinates) 91 matrix_args += [self.settings.get('kernelRadius', 1), voxelCoordinates] 92 ---> 93 P_glszm = cMatrices.calculate_glszm(*matrix_args) # shape (Nvox, Ng, Ns) 94 95 # Delete rows that specify gray levels not present in the ROI IndexError: Error filling GLSZM.
JoostJM commented 3 years ago

Which version of PyRadiomics did you install?

JoostJM commented 3 years ago

Possibly related to #615, #617, #600, and fixed by #635 (part of the 3.0.1 release)

JoostJM commented 3 years ago

Stale issue. Closing issue