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 tring to extract voxel_based feature, and I am confused about the size of feature map? I already tring to do zero paddings at the boundary, but the feature map has the same size as before padding.
here is my code.
import six
import os # needed navigate the system to get the input data
import SimpleITK as sitk
import radiomics
from radiomics import featureextractor # This module is used for interaction with pyradiomics
import pandas as pd
img = sitk.ReadImage("padding_20CA015_N001.nii.gz")
mask = sitk.ReadImage("padding_20CA015_N001_SAX_mask2.nii.gz")
settings = {}
#Voxel-based specific settings
settings['kernelRadius'] = 1 #Expecting kernelRadius > 0,the actual size is 2 * kernelRadius + 1 ,defult value is 1,integer, specifies the size of the kernel to use as the radius from the center voxel.
settings['maskedKernel'] = True #defult value is True,boolean, specifies whether to mask the kernel with the overall mask.
settings['initValue'] = 0 #float, value to use for voxels outside the ROI, or voxels where calculation failed. If set to nan, 3D slicer will treat them as transparent voxels
settings['voxelBatch'] = 1000 #integer > 0, this value controls the maximum number of voxels that are calculated in one batch.only by not providing it is the default value of -1 used (which means: all voxels in 1 batch).
# Instantiate the extractor
extractor = featureextractor.RadiomicsFeatureExtractor(**settings) # ** 'unpacks' the dictionary in the function call
extractor.disableAllFeatures()
extractor.enableFeaturesByName(glszm=['GrayLevelNonUniformity'])
print('Extraction parameters:\n\t', extractor.settings)
print('Enabled filters:\n\t', extractor.enabledImagetypes) # Still the default parameters
print('Enabled features:\n\t', extractor.enabledFeatures) # Still the default parameters
result = extractor.execute(img, mask, voxelBased=True)
for key, val in six.iteritems(result):
if isinstance(val, sitk.Image): # Feature map
sitk.WriteImage(val, key + '.nrrd', True)
print("Stored feature %s in %s" % (key, key + ".nrrd"))
else: # Diagnostic information
print("\t%s: %s" %(key, val))
I am tring to extract voxel_based feature, and I am confused about the size of feature map? I already tring to do zero paddings at the boundary, but the feature map has the same size as before padding.
here is my code.