# Features extraction

**URL:** <https://discourse.slicer.org/t/features-extraction/11047>\
**Category:** Radiomics\
**Created:** [April 8, 2020, 8:14pm UTC](https://discourse.slicer.org/t/features-extraction/11047 "2020-04-08T20:14:32Z")\
**Posts on this page:** 1\
**Showing post:** 3

<div class="post-metadata">

**Author:** ![JoostJM](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/joostjm/32/1091_2.png) [@JoostJM](https://discourse.slicer.org/u/JoostJM)\
**Post date:** [April 16, 2020, 12:48pm UTC](https://discourse.slicer.org/t/features-extraction/11047/3 "2020-04-16T12:48:00Z")

</div>

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:

```auto
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!

---

_[View the full topic](https://discourse.slicer.org/t/features-extraction/11047)._
