Features extraction

Good morning Pyradiomics community.
Is it possible to extract characteristics from an image without informing the mask (region of interest)? that is, I want to extract characteristics from the whole image.

Thanks.

Try using boxes based method

This depends on what you want to acchieve, Currently PyRadiomics requires you to provide a mask, always. However, if you want to extract from the whole image, you can easily generate a ‘full’ mask in python:

import SimpleITK as sitk
import numpy as np

im = sitk.ReadImage('path/to/image.nrrd')
ma_arr = np.ones(im.GetSize()[::-1])  # reverse the order as image is xyz, array is zyx
ma = sitk.GetImageFromArray(ma_arr)
ma.CopyInformation(im)  # Copy geometric info

from radiomics.featureextractor import RadiomicsFeatureExtractor

extractor = RadiomicsFeatureExtractor('path/to/params.yml')
features = extractor.execute(im, ma)

Be aware that this gives features about the texture of the entire image! i.e. a single value per image, for the entire image. If you want more local information, try using voxel-based radiomics:

extractor.execute(im, ma, voxelBased=True)

Be aware that this process will take some time as features are calculated for each voxel!

Hello every body

I need to provide glcm feature maps in different directions. using the guideline I could provide the maps but it gives me just one map per feature, which I think is the weighted average of different directions.
I would appreciate any help to figure it out.
Thanks

Hi Zahra,
what you want is possible, but requires you to deep-dive into the code.
Basically, by default, separate GLCM matrices are calculated for the different directions. You can access them in the numpy array P_glcm in the GLCM feature class. When features are calculated, they are calculated separately on each glcm matrix, and just before returning, a mean is taken over the different directions (last line in the feature functions). You could implent your own version of a GLCM feature class by copying the original one and modifying this last line.

Thank you very much for your reply. For now I used Scikit-image library, however it does not calculate all the features. So, I did the same thing (access to the matrix to use my calculation) there. But I think pyradiomic is much faster and it is better if can do the same thing using pyradiomic. Thanks again