Help in deep understanding pyRadiomics

Hello everyone,

I’m trying to understand my results that I get from pyradiomics - FeatureExtractor and I have two questions:

  1. I want to understand what values the extractor gets me, so I calculate manually the energy, max, min in the ROI to compare the results with pyradomics results. I didn’t get the same values. I checked this on the example in radiomics (brain) (with one label)
    my method - I upload the mask and the image to an float array with nrrd.read() and did manually calculate…for exp, I calculate the max value in the lesion :
    image = nrrd.read(path/to/brain_image)
    mask = = nrrd.read(path/to/brain_mask_image)
    max(image[mask == 1])

and then compare the results from the pyradiomics value.
anyone can explain me why I don’t get the same values?

  1. what the different between seg Extract to voxel Extract? what the meaning of feature map?
    how can I analyse the voxel Extract?

Tnx!
Hodaya

  1. The best start would be to run PyRadiomics with log-level set to debug and read the log, it will give you more insight into what PyRadiomics does.
    Additionally, you can review the diagnostic features, which records the mask in the ROI at various stages in pre-processing.

What type of settings are you using?

  1. Voxel-based calculates feature values for each voxel, using a kernel around each voxel. Segment-based calculates 1 value per feature for the entire ROI, based on all voxels in the ROI.
    As to analyzing voxel extract; this results in feature maps, which need to be analyed as such (e.g. by the recombining the values into a single value, or, even better, working with outcomes that give results on a voxel-level, such as areas in a histology slice matched to your image).
1 Like

Hi :slight_smile:

my settings is:

binWidth: 25
label: 1
normalize: True
interpolator: ‘sitkBSpline’
resampledPixelSpacing: [2.2,2.2,2.2]
minimumROIDimensions : 1

I still don’t get the same first order values when I compere manual computation and what i get from the pyRadiommics extractor.

my code:
import numpy as np
import nrrd
import SimpleITK as sitk
from radiomics import featureextractor, getTestCase
import six

manually:
imageName, maskName = getTestCase(‘brain1’, dataDir)
im ,im_dir= nrrd.read(imageName)
msk, msk_dir = nrrd.read(maskName )
im = im.astype(float)
seg_val = im[msk>0]

i want to use the same normalization as pyRadiommics use, so i convert to sitk and back:
seg_val = sitk.GetImageFromArray(seg_val .reshape(-1,1))
seg_val = sitk.Normalize(seg_val )
seg_val = sitk.GetArrayFromImage(seg_val )

maximum = seg_val .max()
energy = np.nansum(seg_val **2)

and for pyRadioimics:

extractor = featureextractor.RadiomicsFeatureExtractor(‘params.yaml’)
results = extractor.execute(imageName, maskName , label = 1)
results[‘original_firstorder_Energy’]
results[‘original_firstorder_Maximum’]

I don’t get the same values for the energy and max, and for the rest first order features. what I’m missing?
also if I don’t use normalization, I don’t get the same results.
I tried also to do it with binWidth=1, didn’t get any changes.

Tnx
Hodaya