Fixes label for dicom image

I use dicom dataset for feature extraction. But I got an error about ‘label’. Hoping for help

from future import print_function
import six
import os # needed navigate the system to get the input data

import matplotlib.pyplot as plt
import SimpleITK as sitk
import pydicom as dicom

import radiomics
from radiomics import featureextractor # This module is used for interaction with pyradiomics

Get the testCase

maskPath =(‘D:/NSCLC data CT paitent/manifest-1603198545583/NSCLC-Radiomics/LUNG1-001/09-18-2008-StudyID-NA-69331/300.000000-Segmentation-9.554/1-1.dcm’)
imagePath = (‘D:/NSCLC data CT paitent/manifest-1603198545583/NSCLC-Radiomics/LUNG1-001/09-18-2008-StudyID-NA-69331/0.000000-NA-82046/1-068.dcm’)
#radiomics.getTestCase
image = sitk.ReadImage(imagePath)
mask = sitk.ReadImage(maskPath)
ndImg = sitk.GetArrayFromImage(image)
ndLbl = sitk.GetArrayFromImage(mask)
plt.imshow(ndImg[0])
plt.show()
plt.imshow(ndLbl[0])
plt.show()

if imagePath is None or maskPath is None: # Something went wrong, in this case PyRadiomics will also log an error
raise Exception(‘Error getting testcase!’) # Raise exception to prevent cells below from running in case of “run all”

Additonally, store the location of the example parameter file, stored in \pyradiomics\examples/exampleSettings

paramPath = os.path.join(‘…’, ‘examples’, ‘exampleSettings’, ‘Params.yaml’)
print(‘Parameter file, absolute path:’, os.path.abspath(paramPath))

Instantiate the extractor

extractor = featureextractor.RadiomicsFeatureExtractor()

print(‘Extraction parameters:\n\t’, extractor.settings)
print(‘Enabled filters:\n\t’, extractor.enabledImagetypes)
print(‘Enabled features:\n\t’, extractor.enabledFeatures)

settings = {‘label’: 255}

extractor = radiomics.featureextractor.RadiomicsFeatureExtractor(additionalInfo=True, **settings)

result = extractor.execute(imagePath, maskPath)

print(‘Result type:’, type(result)) # result is returned in a Python ordered dictionary)
print(‘’)
print(‘Calculated features’)
for key, value in six.iteritems(result):
print(‘\t’, key, ‘:’, value)