Hi , I want to komw how to get a feature map that is the same size as the original? 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 before extraction, but the feature map has the same size as before padding.
here is my code.
Very thank you for your help!
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 pdimg = 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 parametersresult = 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))