在运行helloRadiomicsWithSettings文件时出现arrays used as indices must be of integer (or boolean) type问题解决方式

it2025-04-03  6

在运行helloRadiomicsWithSettings文件时出现arrays used as indices must be of integer (or boolean) type问题解决方式

新运行程序时出现以下问题:

Traceback (most recent call last): File “F:/python_program/pyradiomics-master/examples/helloRadiomicsWithSettings.py”, line 52, in featureVector = extractor.execute(imageName, maskName) File “F:\python_program\for_env\lib\site-packages\radiomics\featureextractor.py”, line 327, in execute featureVector.update(self.computeFeatures(inputImage, inputMask, imageTypeName, **inputKwargs)) File “F:\python_program\for_env\lib\site-packages\radiomics\featureextractor.py”, line 514, in computeFeatures for (featureName, featureValue) in six.iteritems(featureClass.execute()): File “F:\python_program\for_env\lib\site-packages\radiomics\base.py”, line 185, in execute self._calculateSegment() File “F:\python_program\for_env\lib\site-packages\radiomics\base.py”, line 222, in _calculateSegment for success, featureName, featureValue in self._calculateFeatures(): File “F:\python_program\for_env\lib\site-packages\radiomics\base.py”, line 229, in _calculateFeatures self._initCalculation(voxelCoordinates) File “F:\python_program\for_env\lib\site-packages\radiomics\glrlm.py”, line 84, in _initCalculation self.P_glrlm = self._calculateMatrix(voxelCoordinates) File “F:\python_program\for_env\lib\site-packages\radiomics\glrlm.py”, line 116, in _calculateMatrix P_glrlm = numpy.delete(P_glrlm, emptyGrayLevels - 1, 1) File “<array_function internals>”, line 6, in delete File “F:\python_program\for_env\lib\site-packages\numpy\lib\function_base.py”, line 4406, in delete keep[obj,] = False IndexError: arrays used as indices must be of integer (or boolean) type

Process finished with exit code 1

解决方法

在glrlm.py文件中插入一行代码

在前面the P_glcm = numpy.delete(P_glcm, emptyGrayLevels - 1, 1)插入一行代码if list(emptyGrayLevels):

// An highlighted block if list(emptyGrayLevels): P_glrlm = numpy.delete(P_glrlm, emptyGrayLevels - 1, 1)
最新回复(0)