0

I am unable to extract GLRLM features using the PyRadiomix library for a .jpg file. It has also a mask input, which is not clear to me.

import SimpleITK as sitk
from radiomics import glrlm
from radiomics import featureextractor

image = sitk.ReadImage('D:\Desert.jpg', imageIO="JPEGImageIO")
extractor = featureextractor.RadiomicsFeatureExtractor()
extractor = featureextractor.RadiomicsFeatureExtractor(binWidth=20, sigma=[1, 
             2, 3], verbose=True)
# Disable all feature classes, save firstorder
extractor.disableAllFeatures()
extractor.enableFeatureClassByName('glrlm')

extractor.enableFeaturesByName(glrlm=['SRE', 'LRE','GLN','GLNN','RLN','RLNN','RP','GLV','RV','RE','LGLRE','HGLRE','SRLGLE','SRHGLE','LRLGLRE','LRHGLRE'])
******result = extractor.execute(imagePath, labelPath)*******

I got this code from the PyRadiomics website. But at the last line, I can't understand the two parameters

Mohiuddin
  • 33
  • 5

1 Answers1

0

From the documentation:

execute(imageFilepath, maskFilepath, label=None, label_channel=None, voxelBased=False)

Compute radiomics signature for provide image and mask combination. It comprises of the following steps:

Parameters:

  • imageFilepath – SimpleITK Image, or string pointing to image file location
  • maskFilepath – SimpleITK Image, or string pointing to labelmap file location
  • label – Integer, value of the label for which to extract features. If not specified, last specified label is used. Default label is 1.
  • label_channel – Integer, index of the channel to use when maskFilepath yields a SimpleITK.Image with a vector pixel type. Default index is 0.
  • voxelBased – Boolean, default False. If set to true, a voxel-based extraction is performed, segment-based otherwise.

Therefore in the call

result = extractor.execute(imagePath, labelPath)

labelPath plays the role of maskFilepath in the signature.

Tonechas
  • 13,398
  • 16
  • 46
  • 80
  • What will be the maskFilepath input for my jpg file? What it does actually? – Mohiuddin Jan 30 '21 at 17:48
  • It defines the region of interest (ROI) in the image – Tonechas Jan 30 '21 at 20:46
  • So, if I want to extract all features (mentioned in PyRadiomics) from the whole image, will I again pass the same SimpleITK Image as a second argument? – Mohiuddin Feb 01 '21 at 17:25
  • I don't think so. You could use the examples provided [here](https://github.com/AIM-Harvard/pyradiomics/tree/master/data) to get acquainted with pyradiomics. Note that the masks are those files whose name ends with `_label.nrrd`. – Tonechas Feb 01 '21 at 18:46