GLCM extraction error on .png image

Operating system: Windows 10
Slicer version:
Expected behavior:
Actual behavior:
HI,
I am new to pyradiomics and getting an error while extracting using GLCM, here is my code:

ig = sitk.ReadImage(’./PAC_14_DN0.png’, sitk.sitkUInt8)
print(ig.GetSize())
print(ig)
image3d = sitk.JoinSeries(ig)
msk = sitk.ReadImage(’./mask1.png’, sitk.sitkUInt8)
print(msk.GetSize())
print(msk)
msk3d = sitk.JoinSeries(msk)

feature = radiomics.glcm.RadiomicsGLCM(image3d, msk3d, label=255)
print(feature.getAutocorrelationFeatureValue())
output:
(190, 250)
Image (0000022AFBBD4110)
RTTI typeinfo: class itk::Image<unsigned char,2>
Reference Count: 1
Modified Time: 945
Debug: Off
Object Name:
Observers:
none
Source: (none)
Source output name: (none)
Release Data: Off
Data Released: False
Global Release Data: Off
PipelineMTime: 935
UpdateMTime: 944
RealTimeStamp: 0 seconds
LargestPossibleRegion:
Dimension: 2
Index: [0, 0]
Size: [190, 250]
BufferedRegion:
Dimension: 2
Index: [0, 0]
Size: [190, 250]
RequestedRegion:
Dimension: 2
Index: [0, 0]
Size: [190, 250]
Spacing: [1, 1]
Origin: [0, 0]
Direction:
1 0
0 1

IndexToPointMatrix:
1 0
0 1

PointToIndexMatrix:
1 0
0 1

Inverse Direction:
1 0
0 1

PixelContainer:
ImportImageContainer (0000022A801703A0)
RTTI typeinfo: class itk::ImportImageContainer<unsigned __int64,unsigned char>
Reference Count: 1
Modified Time: 941
Debug: Off
Object Name:
Observers:
none
Pointer: 0000022A8025DD10
Container manages memory: true
Size: 47500
Capacity: 47500

(190, 250)
Image (0000022AFBBD4680)
RTTI typeinfo: class itk::Image<unsigned char,2>
Reference Count: 1
Modified Time: 1139
Debug: Off
Object Name:
Observers:
none
Source: (none)
Source output name: (none)
Release Data: Off
Data Released: False
Global Release Data: Off
PipelineMTime: 1129
UpdateMTime: 1138
RealTimeStamp: 0 seconds
LargestPossibleRegion:
Dimension: 2
Index: [0, 0]
Size: [190, 250]
BufferedRegion:
Dimension: 2
Index: [0, 0]
Size: [190, 250]
RequestedRegion:
Dimension: 2
Index: [0, 0]
Size: [190, 250]
Spacing: [1, 1]
Origin: [0, 0]
Direction:
1 0
0 1

IndexToPointMatrix:
1 0
0 1

PointToIndexMatrix:
1 0
0 1

Inverse Direction:
1 0
0 1

PixelContainer:
ImportImageContainer (0000022A80171750)
RTTI typeinfo: class itk::ImportImageContainer<unsigned __int64,unsigned char>
Reference Count: 1
Modified Time: 1135
Debug: Off
Object Name:
Observers:
none
Pointer: 0000022A80275050
Container manages memory: true
Size: 47500
Capacity: 47500
KeyError Traceback (most recent call last)
in ()
1 # feature.enableAllFeatures()
2 # feature.calculateFeatures()
----> 3 print(feature.getAutocorrelationFeatureValue())

F:\Programs\Anaconda3\lib\site-packages\radiomics\glcm.py in getAutocorrelationFeatureValue(self)
253 Autocorrelation is a measure of the magnitude of the fineness and coarseness of texture.
254 “”"
–> 255 i = self.coefficients[‘i’]
256 j = self.coefficients[‘j’]
257 ac = numpy.sum(self.P_glcm * (i * j)[None, :, :, None], (1, 2))

KeyError: ‘i’

Thanks in advance.

This bug occurs due to incorrect usage of the featureclass in standalone version.
Through directly calling the feature function, important initialization steps are skipped.

Recommended usage is through the featureextractor module (as this also implements important preprocessing code and checks). See interactive use.

Using the feature classes directly is still possible, but only recommended for developers’ use. See using feature classes directly