# How do we extract the features for each independent object in an image?

**URL:** <https://discourse.slicer.org/t/how-do-we-extract-the-features-for-each-independent-object-in-an-image/12120>\
**Category:** Support\
**Tags:** feature, radiomics, pyradiomics\
**Created:** [June 19, 2020, 6:04pm UTC](https://discourse.slicer.org/t/how-do-we-extract-the-features-for-each-independent-object-in-an-image/12120 "2020-06-19T18:04:41Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![mozdag](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/mozdag/32/7207_2.png) [@mozdag](https://discourse.slicer.org/u/mozdag)\
**Post date:** [June 19, 2020, 6:04pm UTC](https://discourse.slicer.org/t/how-do-we-extract-the-features-for-each-independent-object-in-an-image/12120/1 "2020-06-19T18:04:41Z")

</div>

I have a tissue image and there are around 100 cells in it. I also have the corresponding mask image which includes those 100 cells. How do I calculate the radiomics features for each cell?

---

<div class="post-metadata">

**Author:** ![Andinet\_Enquobahrie](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/andinet_enquobahrie/32/75_2.png) [@Andinet\_Enquobahrie](https://discourse.slicer.org/u/Andinet_Enquobahrie)\
**Post date:** [June 21, 2020, 2:36pm UTC](https://discourse.slicer.org/t/how-do-we-extract-the-features-for-each-independent-object-in-an-image/12120/2 "2020-06-21T14:36:50Z")

</div>

Hi @mozdag

Yes, you can do this using SlicerRadiomics extension module.

1. Load your tissue image and the corresponding mask as a lablel image in Slicer.

2. In the SlicerRadiomics module, you can then specify your Input Image Volume (tissue image), and Input Regions (your converted labelimage) and then run the module.

HTH  
Andinet

---

<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:** [June 23, 2020, 8:18pm UTC](https://discourse.slicer.org/t/how-do-we-extract-the-features-for-each-independent-object-in-an-image/12120/3 "2020-06-23T20:18:42Z")

</div>

Note that if you want to have features separately for the individual cells, you will need to assign a unique label value for each of the cell segmentations.

You can do this using the “Islands” effect of Segment Editor:

 ![image](https://us1.discourse-cdn.com/flex002/uploads/slicer/original/3X/0/b/0b2d5321299142ce03deb20232d187890abe4d89.png)

---

<div class="post-metadata">

**Author:** ![mozdag](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/mozdag/32/7207_2.png) [@mozdag](https://discourse.slicer.org/u/mozdag)\
**Post date:** [June 23, 2020, 8:46pm UTC](https://discourse.slicer.org/t/how-do-we-extract-the-features-for-each-independent-object-in-an-image/12120/4 "2020-06-23T20:46:23Z")

</div>

Thank you for your response. I won’t be using the Slicer app. I’ll have to use some library such as connected component:

from cc3d import connected\_components  
labels\_out = connected\_components(data\_mask)

I believe, labels\_out is a set of those ROI regions for each cell? Another point is that my images will be 2D. Have any of you got an idea on this?

I still run this code and got error: Attribute Error; image has no attribute “shape”.

---

<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:** [June 23, 2020, 9:25pm UTC](https://discourse.slicer.org/t/how-do-we-extract-the-features-for-each-independent-object-in-an-image/12120/5 "2020-06-23T21:25:33Z")

</div>

There are some additional attributes you need to make sure are set, did you check this documentation page: [https://pyradiomics.readthedocs.io/en/latest/features.html#module-radiomics.shape2D](https://pyradiomics.readthedocs.io/en/latest/features.html#module-radiomics.shape2D) ?

---

<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:** [June 25, 2020, 5:45am UTC](https://discourse.slicer.org/t/how-do-we-extract-the-features-for-each-independent-object-in-an-image/12120/6 "2020-06-25T05:45:38Z")

</div>

As to splitting connected components and extracting features, check out [this issue](https://github.com/Radiomics/pyradiomics/issues/591), which deals with the same problem.
