I want to extract features with HE image, and I save the tiles with .png file. Here is my code:
image = sitk.ReadImage(‘test.png’) # dim=(1024, 1024, 3)
mask_arr = np.ones(image.GetSize()[::-1])
mask = sitk.GetImageFromArray(mask_arr)
firstOrderFeatures = firstorder.RadiomicsFirstOrder(image, mask)
Traceback (most recent call last):
File “/data/chenzhi/.pycharm_helpers/pydev/pydevd.py”, line 1483, in _exec
pydev_imports.execfile(file, globals, locals) # execute the script
File “/data/chenzhi/.pycharm_helpers/pydev/_pydev_imps/_pydev_execfile.py”, line 18, in execfile
exec(compile(contents+"\n", file, ‘exec’), glob, loc)
File “/data/chenzhi/Chenjy/Pathomics/paper_repetition/features_extract.py”, line 20, in
firstOrderFeatures = firstorder.RadiomicsFirstOrder(image, mask, voxelBased=False)
File “/data/chenzhi/.conda/envs/Chenjy/lib/python3.7/site-packages/radiomics/firstorder.py”, line 37, in init
self.discretizedImageArray = self._applyBinning(self.imageArray.copy())
File “/data/chenzhi/.conda/envs/Chenjy/lib/python3.7/site-packages/radiomics/base.py”, line 115, in _applyBinning
matrix, _ = imageoperations.binImage(matrix, self.maskArray, **self.settings)
File “/data/chenzhi/.conda/envs/Chenjy/lib/python3.7/site-packages/radiomics/imageoperations.py”, line 155, in binImage
binEdges = getBinEdges(parameterMatrix[parameterMatrixCoordinates], **kwargs)
File “/data/chenzhi/.conda/envs/Chenjy/lib/python3.7/site-packages/radiomics/imageoperations.py”, line 116, in getBinEdges
minimum = min(parameterValues)
ValueError: The truth value of an array with more than one element is ambiguous. Use a.any() or a.all()