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
I am trying to extract radiomic features in Jupyter notebook. This is my code for extraction. The images and masks are NRRD files extracted from 3D slicer.
if str(label).isdigit():
label = int(label)
else:
label = None
featureVector = flists[entry] # This is a pandas Series
featureVector['Image'] = os.path.basename(imageFilepath)
featureVector['Mask'] = os.path.basename(maskFilepath)
result = pd.Series(extractor.execute(imageFilepath, maskFilepath, label))
#featureVector = featureVector.append(result)
featureVector = featureVector.concat((result), axis=0)
except Exception:
print('FEATURE EXTRACTION FAILED:')
featureVector.name = entry
results = results.join(featureVector, how='outer') # If feature extraction failed, results will be all NaN
If you enable logging, PyRadiomics should output the reason why the feature extraction is failing. Try to use the commandline interface, this has the necessary code for enabling logging already there.
I am trying to extract radiomic features in Jupyter notebook. This is my code for extraction. The images and masks are NRRD files extracted from 3D slicer.
path = (r'/Users/helen/Library/CloudStorage/OneDrive-Personal/Documents/Research/PAS Radiomics research/Radiomic feature extraction Pyradiomics') params = os.path.join(path, 'PAS.yaml')
inputCSV = os.path.join(path, 'PAS_superior_pathway_codes.csv') outputCSV = os.path.join(path, 'PAS_superior_Radiomic features.csv')
try: flists = pd.read_csv(inputCSV, sep=',').T except Exception: print('CSV READ FAILED') exit(-1)
extractor = featureextractor.RadiomicsFeatureExtractor(params)
results = pd.DataFrame()
imageFilepath = flists[entry]['Image'] maskFilepath = flists[entry]['Mask'] label = flists[entry].get('Label', None)
if str(label).isdigit(): label = int(label) else: label = None
results.T.to_csv(outputCSV,sep=';', index=False, na_rep='NaN')
I keep getting a message of "FEATURE EXTRACTION FAILED" Anyone see how to solve the problem?
Thank you