# Voxel-based radiomic feature extraction problem

**URL:** <https://discourse.slicer.org/t/voxel-based-radiomic-feature-extraction-problem/24328>\
**Category:** Support\
**Tags:** radiomics\
**Created:** [July 15, 2022, 11:43am UTC](https://discourse.slicer.org/t/voxel-based-radiomic-feature-extraction-problem/24328 "2022-07-15T11:43:34Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Rongjun\_Dong](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/rongjun_dong/32/15766_2.png) [@Rongjun\_Dong](https://discourse.slicer.org/u/Rongjun_Dong)\
**Post date:** [July 15, 2022, 11:43am UTC](https://discourse.slicer.org/t/voxel-based-radiomic-feature-extraction-problem/24328/1 "2022-07-15T11:43:34Z")

</div>

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 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))

---

<div class="post-metadata">

**Author:** ![Panos\_p](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/panos_p/32/80129_2.png) [@Panos\_p](https://discourse.slicer.org/u/Panos_p)\
**Post date:** [May 10, 2025, 12:03pm UTC](https://discourse.slicer.org/t/voxel-based-radiomic-feature-extraction-problem/24328/2 "2025-05-10T12:03:16Z")

</div>

Hello,  
I think i found the exact topic regarding my issue  
Its my first dive into the radiomics/medical imaging, and I want to ask you from your experience, if the output feature map which is calculated within the segmentation mask, has the same dimensions with the original image. For example suppose we have a CT volume 128x128x100(height,width,number of slices). I have also the 3D segmentation. The output will have feature values within the 3D ROI, while the voxels outside ROI will have a default dummy value, yielding again 128x128x100 output volume? Thanks in advance
