# Error in \_extractFeatures when using pyradiomics in Slicer

**URL:** <https://discourse.slicer.org/t/error-in-extractfeatures-when-using-pyradiomics-in-slicer/18474>\
**Category:** Support\
**Tags:** radiomics, pyradiomics\
**Created:** [July 2, 2021, 3:19am UTC](https://discourse.slicer.org/t/error-in-extractfeatures-when-using-pyradiomics-in-slicer/18474 "2021-07-02T03:19:02Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![retidani18](https://avatars.discourse-cdn.com/v4/letter/r/ce7236/32.png) [@retidani18](https://discourse.slicer.org/u/retidani18)\
**Post date:** [July 2, 2021, 3:19am UTC](https://discourse.slicer.org/t/error-in-extractfeatures-when-using-pyradiomics-in-slicer/18474/1 "2021-07-02T03:19:02Z")

</div>

Hi !

I am trying to do radiomic analysis on a 3D lung sample. The segmentation is ready but I only get an error massage. It looks like there is some problem with the masks but I am not sure at all. Any suggestions?

Here is the whole massage from the code:  
Starting RadiomicsCLI for RBC\_train\_largesmallarteryplusspeackle\_segment\_Speckle

…Done

[2021-07-01 21:38:26] I: radiomics.script: Starting PyRadiomics (version: v3.0.1.post4+gad5b2de)

[2021-07-01 21:38:26] I: radiomics.script: Processing input…

[2021-07-01 21:38:26] I: radiomics.featureextractor: Loading parameter file C:/Users/lantis.user/AppData/Local/Temp/Slicer\RadiomicsLogicParams.json

[2021-07-01 21:38:26] I: radiomics.featureextractor: Applying custom setting overrides: {‘label’: 1, ‘correctMask’: True}

[2021-07-01 21:38:26] I: radiomics.script: Input valid, starting sequential extraction from 1 case(s)…

[2021-07-01 21:38:26] I: radiomics.script: Processing case 1

[2021-07-01 21:38:26] I: radiomics.featureextractor: Calculating features with label: 1

[2021-07-01 21:38:26] I: radiomics.featureextractor: Loading image and mask

[2021-07-01 21:38:36] E: radiomics.script: Feature extraction failed!

Traceback (most recent call last):

File “C:\Users\lantis.user\AppData\Local\NA-MIC\Slicer 4.11.20210226\NA-MIC\Extensions-29738\SlicerRadiomics\Lib\site-packages\radiomics\scripts\segment.py”, line 70, in \_extractFeatures

feature\_vector.update(extractor.execute(imageFilepath, maskFilepath, label, label\_channel))

File “C:\Users\lantis.user\AppData\Local\NA-MIC\Slicer 4.11.20210226\NA-MIC\Extensions-29738\SlicerRadiomics\Lib\site-packages\radiomics\featureextractor.py”, line 272, in execute

image, mask = self.loadImage(imageFilepath, maskFilepath, generalInfo, \*\*\_settings)

File “C:\Users\lantis.user\AppData\Local\NA-MIC\Slicer 4.11.20210226\NA-MIC\Extensions-29738\SlicerRadiomics\Lib\site-packages\radiomics\featureextractor.py”, line 382, in loadImage

raise ValueError(‘Error reading mask Filepath or SimpleITK object’)

ValueError: Error reading mask Filepath or SimpleITK object

[2021-07-01 21:38:37] I: radiomics.script: Processing results…

[2021-07-01 21:38:37] I: radiomics.script: Finished segment-based extraction successfully…

Extraction complete

Cleaning up…

---

<div class="post-metadata">

**Author:** ![fedorov](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/fedorov/32/14_2.png) [@fedorov](https://discourse.slicer.org/u/fedorov)\
**Post date:** [September 28, 2021, 7:57pm UTC](https://discourse.slicer.org/t/error-in-extractfeatures-when-using-pyradiomics-in-slicer/18474/2 "2021-09-28T19:57:39Z")

</div>

I have not been able to identify the exact issue so far, but as a workaround you can export your segmentation as a labelmap (using the section below from the Segmentations module), and then use theresulting labelmap node as “Input regions” parameter in the Radiomics module. This worked for me.

![image](https://us1.discourse-cdn.com/flex002/uploads/slicer/original/3X/d/a/dae46cd03a4cbeae709404ca634d8857db4e793c.png)

---

<div class="post-metadata">

**Author:** ![fedorov](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/fedorov/32/14_2.png) [@fedorov](https://discourse.slicer.org/u/fedorov)\
**Post date:** [September 28, 2021, 8:30pm UTC](https://discourse.slicer.org/t/error-in-extractfeatures-when-using-pyradiomics-in-slicer/18474/3 "2021-09-28T20:30:03Z")

</div>

I filed an issue, will try to get back to it: [Cannot use the module with input mask defined by a segmentation node · Issue #67 · AIM-Harvard/SlicerRadiomics · GitHub](https://github.com/AIM-Harvard/SlicerRadiomics/issues/67).
