# Quantitative features with HeterogeneityCad

**URL:** <https://discourse.slicer.org/t/quantitative-features-with-heterogeneitycad/518>\
**Category:** Support\
**Tags:** radiomics\
**Created:** [June 16, 2017, 10:47am UTC](https://discourse.slicer.org/t/quantitative-features-with-heterogeneitycad/518 "2017-06-16T10:47:15Z")\
**Posts on this page:** 20\
**Page:** 2

<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, 2017, 3:54pm UTC](https://discourse.slicer.org/t/quantitative-features-with-heterogeneitycad/518/21 "2017-06-23T15:54:01Z")

</div>

> [@mtamponi](#):
>
> I could be some problems in the calculation of entropy, Kurtosis and Uniformity, probably in HeterogeneityCAD, but I don’t know.

Definitely it could be. If you look at the implementations of both HeterogeneityCAD and pyradiomics, and find that one is incorrect, it will be interesting to know. You might find the public radiomics digital phantom helpful in your explorations: [http://www.radiomics.org/?q=node/28](http://www.radiomics.org/?q=node/28). I would be very interested to learn about the outcome! Joost, the lead developer of pyradiomics, I believe compared pyradiomics against that phantom (unfortunately, I don’t see him on this forum, so I will ask him by email to join and comment). I don’t know if it was ever eveluated with HeterogeneityCAD. @Jayender\_Jagadeesan will be the best to comment on that!

---

<div class="post-metadata">

**Author:** ![Jayender\_Jagadeesan](https://avatars.discourse-cdn.com/v4/letter/j/96bed5/32.png) [@Jayender\_Jagadeesan](https://discourse.slicer.org/u/Jayender_Jagadeesan)\
**Post date:** [June 23, 2017, 6:36pm UTC](https://discourse.slicer.org/t/quantitative-features-with-heterogeneitycad/518/22 "2017-06-23T18:36:37Z")

</div>

The definition of the metrics can be found in the Supplemental information of Hugo’s paper:

HJWL Aerts, ER Velazquez, RTH Leijenaar, et al., “Decoding tumour phenotype by noninvasive imaging using a quantitative radiomics approach”, vol. 5, Nat Communication, 2014.

Also please note, there are number of parameters that are set, for example the number of discrete intensity levels, discretization bin width, normalization constants etc., to compute the heterogeneity metrics.

Jay

---

<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 23, 2017, 7:35pm UTC](https://discourse.slicer.org/t/quantitative-features-with-heterogeneitycad/518/23 "2017-06-23T19:35:56Z")

</div>

Hi Matteo,

As @fedorov mentioned, I compared the output of PyRadiomics to a digitial phantom, but I’m not entirely sure this is the same as Andriy mentioned. It is the digital phantom used in the article with the feature definitions Andriy sent (The IBSI document).

That being said, I think the differences you’re experiencing may be in part explained by @jayender’s comment, namely the discretization. For PyRadiomics, this is determined by a fixed bin width (as opposed to a fixed bin count) with a default value of 25 units. I’m not sure about how this is implemented in HeterogeneityCAD or what default settings are. More information on the exact method implemented in PyRadiomics can be found [here](http://pyradiomics.readthedocs.io/en/latest/radiomics.html#radiomics.imageoperations.binImage).  
However, this only affects Entropy and Uniformity.

The exact cause of the difference in Kurtosis I do not know, but it strikes me that the difference is _exactly_ 3. @jayender, does the HeterogeneityCAD system implement a fixed offset? This would be a fixed value of 3, which centers kurtosis on 0 for normal distributions (PyRadiomics does not have this offset, which would explain the difference). In fact, this offset is also implemented in the IBSI document.

Cheers,

Joost

---

<div class="post-metadata">

**Author:** ![mtamponi](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/mtamponi/32/332_2.png) [@mtamponi](https://discourse.slicer.org/u/mtamponi)\
**Post date:** [June 26, 2017, 12:54pm UTC](https://discourse.slicer.org/t/quantitative-features-with-heterogeneitycad/518/24 "2017-06-26T12:54:53Z")

</div>

@fedorov,  
Thank You Andrey,  
I downloaded the phantoms. I hope to work about and then say to You,  
Matteo

---

<div class="post-metadata">

**Author:** ![mtamponi](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/mtamponi/32/332_2.png) [@mtamponi](https://discourse.slicer.org/u/mtamponi)\
**Post date:** [June 26, 2017, 12:57pm UTC](https://discourse.slicer.org/t/quantitative-features-with-heterogeneitycad/518/25 "2017-06-26T12:57:57Z")

</div>

@jayender,  
Thank You Jay, I downloaded the supplement of the paper of H. Aerts et al. and I must work about slowly,  
Sincerely,  
Matteo

---

<div class="post-metadata">

**Author:** ![mtamponi](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/mtamponi/32/332_2.png) [@mtamponi](https://discourse.slicer.org/u/mtamponi)\
**Post date:** [June 26, 2017, 12:59pm UTC](https://discourse.slicer.org/t/quantitative-features-with-heterogeneitycad/518/26 "2017-06-26T12:59:53Z")

</div>

@JoostJM ,  
Thank to You Joost, I must study slowly on the site that You indidicated,  
Sincerely,  
Matteo

---

<div class="post-metadata">

**Author:** ![mtamponi](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/mtamponi/32/332_2.png) [@mtamponi](https://discourse.slicer.org/u/mtamponi)\
**Post date:** [June 27, 2017, 10:59am UTC](https://discourse.slicer.org/t/quantitative-features-with-heterogeneitycad/518/27 "2017-06-27T10:59:28Z")

</div>

@fedorov,  
Dear Andrey I do some calculation on the phantom that You say me (PAT2) using 3DSlicer Radiomics and Heterogeneity CAD.  
Significative differences You can see on Entropy, Hunformity and Kurtosis on first order features.  
On shape features there are difference on surface area, sphericity, compactness 1 and 2 and other differences. The Volume is ok. On GLCM there many and apparently important differences, for example autocorrelation, correlation, contrast, entropy,…  
Matteo

 ![](https://us1.discourse-cdn.com/flex002/uploads/slicer/original/1X/1496f3b772edbe58e12322ac4f32d655a43abfe4.jpg) ![](https://us1.discourse-cdn.com/flex002/uploads/slicer/original/1X/aaa24cdfe965d308ccf758ff1c59ad4ceff96c5b.jpg) ![](https://us1.discourse-cdn.com/flex002/uploads/slicer/original/1X/30e4b415f7bbbdcc814acd1e32b045c2f01be285.jpg) ![](https://us1.discourse-cdn.com/flex002/uploads/slicer/original/1X/f8af42b76275347cb8857f00fe39677ea5e57709.jpg) ![](https://us1.discourse-cdn.com/flex002/uploads/slicer/original/1X/5ffdc438f7f4ef5d768c149ccf92ab9f0142beac.jpg) ![](https://us1.discourse-cdn.com/flex002/uploads/slicer/original/1X/10dfacbd527c39f9ba99aa2e7f355c12cc21081d.jpg) ![](https://us1.discourse-cdn.com/flex002/uploads/slicer/original/1X/e48461c02fb10b9845436fc59c33571e204ace86.jpg) ![](https://us1.discourse-cdn.com/flex002/uploads/slicer/original/1X/e1b66abed0c24d4fa3d06afc16cf22c08a444ac9.jpg) ![](https://us1.discourse-cdn.com/flex002/uploads/slicer/original/1X/3b47d917460201bebc35df3e48b9e38d698202c7.jpg) ![](https://us1.discourse-cdn.com/flex002/uploads/slicer/original/1X/5f5840a110676f0342aafb26a66509704bcc9cc0.jpg)

---

<div class="post-metadata">

**Author:** ![ShivR](https://avatars.discourse-cdn.com/v4/letter/s/c2a13f/32.png) [@ShivR](https://discourse.slicer.org/u/ShivR)\
**Post date:** [July 7, 2017, 7:16pm UTC](https://discourse.slicer.org/t/quantitative-features-with-heterogeneitycad/518/28 "2017-07-07T19:16:33Z")

</div>

I’m a little confused about the installation of 3d slicer. I’ve followed the installation instructions on “read me”, downloading slicer, installing Radiomics, and restarting slicer. However, I’m unsure how to proceed from there. Where is [featureextractor.py](http://featureextractor.py) coming from? I see it in the python file from [radiomics.io](http://radiomics.io), but does that mean I need to download everything from both pyradiomics and 3d slice for 3d slicer to work? Also, is there any way I can speak to a representative and work everything out?

Thanks in advance.

---

<div class="post-metadata">

**Author:** ![pieper](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/pieper/32/8_2.png) [@pieper](https://discourse.slicer.org/u/pieper)\
**Post date:** [July 7, 2017, 7:42pm UTC](https://discourse.slicer.org/t/quantitative-features-with-heterogeneitycad/518/29 "2017-07-07T19:42:25Z")

</div>

> [@ShivR](#):
>
> I’m a little confused about the installation of 3d slicer. I’ve followed the installation instructions on “read me”, downloading slicer, installing Radiomics, and restarting slicer. However, I’m unsure how to proceed from there. Where is featureextractor.py coming from? I see it in the python file from [radiomics.io](http://radiomics.io), but does that mean I need to download everything from both pyradiomics and 3d slice for 3d slicer to work? Also, is there any way I can speak to a representative and work everything out?
> 
> Thanks in advance.

Did you find these instructions?

> **[GitHub - AIM-Harvard/SlicerRadiomics: A Slicer extension to provide a GUI...](https://github.com/AIM-Harvard/SlicerRadiomics)**
>
> A Slicer extension to provide a GUI around pyradiomics - GitHub - AIM-Harvard/SlicerRadiomics: A Slicer extension to provide a GUI around pyradiomics

Once you’ve done this install you need to load data and you can run the radiomics calculations within Slicer using the GUI (featureextractor.py is code used when developing your own script, but not directly exposed when using the SlicerRadiomics GUI).

---

<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:** [July 7, 2017, 8:02pm UTC](https://discourse.slicer.org/t/quantitative-features-with-heterogeneitycad/518/30 "2017-07-07T20:02:36Z")

</div>

> [@ShivR](#):
>
> However, I’m unsure how to proceed from there.

If you want to get help on this forum, it probably makes sense to describe what you want to achieve.

> [@ShivR](#):
>
> is there any way I can speak to a representative and work everything out?

@ShivR 3D Slicer is an open source project, not a commercial platform with a dedicated support desk. Having said that, there are companies that provide paid support and consulting related to 3D Slicer - see for example Kitware consulting offers [https://www.kitware.com/what-we-offer/#consulting](https://www.kitware.com/what-we-offer/#consulting).

---

<div class="post-metadata">

**Author:** ![ShivR](https://avatars.discourse-cdn.com/v4/letter/s/c2a13f/32.png) [@ShivR](https://discourse.slicer.org/u/ShivR)\
**Post date:** [July 7, 2017, 9:05pm UTC](https://discourse.slicer.org/t/quantitative-features-with-heterogeneitycad/518/31 "2017-07-07T21:05:05Z")

</div>

Thank you for such quick responses Andrey and Steve!

My overall goal is to use Slicer to isolate ROIs on DICOM images and then extract first and second order features from them. However, my current issue is simply that I don’t get how to install the technology. I used the instructions Steve attached. I have the same question Matteo did about not being able to find the "C:/Users/username/AppData/Roaming/NA-MIC/Extensions-revision/SlicerRadiomics/lib/site-packages/radiomics/"and the file “[featureextractor.py](http://featureextractor.py)” files on my computer, but I don’t know what a cmd prompt is or what cmd is either. How can I find this file so that Slicer Radiomics will work? Also, .py is python, so do I also need to download python to change line 9?

---

<div class="post-metadata">

**Author:** ![pieper](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/pieper/32/8_2.png) [@pieper](https://discourse.slicer.org/u/pieper)\
**Post date:** [July 7, 2017, 9:25pm UTC](https://discourse.slicer.org/t/quantitative-features-with-heterogeneitycad/518/32 "2017-07-07T21:25:22Z")

</div>

> [@ShivR](#):
>
> I have the same question Matteo did about not being able to find the "C:/Users/username/AppData/Roaming/NA-MIC/Extensions-revision/SlicerRadiomics/lib/site-packages/radiomics/"and the file “featureextractor.py” files on my computer, but I don’t know what a cmd prompt is or what cmd is either.

Ah, sorry, I see what you were asking now. The cmd prompt is also known as the command prompt or dos prompt in windows, but I found you can also get into the AppData folder by typing in the Address Bar of the windows explorer as shown here:

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

From there you can browse into the path to find the featureextractor.py file and make the edit described earlier in this thread. Hope that works for you.

@JoostJM maybe we should just comment out the yaml / pykwalify stuff until @jcfr is back.

---

<div class="post-metadata">

**Author:** ![mtamponi](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/mtamponi/32/332_2.png) [@mtamponi](https://discourse.slicer.org/u/mtamponi)\
**Post date:** [July 8, 2017, 6:23am UTC](https://discourse.slicer.org/t/quantitative-features-with-heterogeneitycad/518/33 "2017-07-08T06:23:39Z")

</div>

With the help of Steve, Andrey and Andras and reading the documentations and papers from Joost and Jayender, We are improving in evaluating radiomics features in lung cancer using 3dSlicer.  
We calculated radiomics features with Radiomics and HeterogeneityCad for more about 10 patients with lung cancer.  
We use also phantom from prof Lambin.  
We think that there are some important software bugs in the calculation of some features in HeterogeneityCad in 3DSlicer 4.7.0 (begin of june) (Entropy, Autocorrelation, Corelation,… You can see my last mail). It could be useful to check it and put more warnings about using heterogeneityCad.  
At the moment the features calculated with Radiomics seem nice, but it is necessary do more extensive elaboration.  
Thanking very much for the help  
Sincely

cc  
@ShivR  
@Fedorov  
@JoostJM  
@jayender  
@lassoan

---

<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:** [July 10, 2017, 7:59am UTC](https://discourse.slicer.org/t/quantitative-features-with-heterogeneitycad/518/34 "2017-07-10T07:59:10Z")

</div>

@pieper, I could comment out the import of pykwalify, however, this will break the parameter file parsing, which is not needed in the slicer extension, but is important in the stand alone version of PyRadiomics.

I have created a specific SlicerRadiomics branch in PyRadiomics, and updated the Cmake-lists in SlicerRadiomics to use this specific branch.

However, before this is available in the extension manager, it has to be rebuild and repackaged.(In fact, the version of SlicerRadiomics that is installed is 9e57f350709207df925cd0ce397dffbcb6f262b5 (commit from may 30th).

---

<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:** [July 10, 2017, 8:09am UTC](https://discourse.slicer.org/t/quantitative-features-with-heterogeneitycad/518/35 "2017-07-10T08:09:55Z")

</div>

As to the significant differences in first order features, see the explanation above.  
As to the changes in volume, this is mainly due to the different manner of calculating a surface area. I don’t know what heterogeneityCAD uses, but pyradiomics implements a marching cubes algorithm, creating a surface mesh and summing up the surface area of the individual triangles.  
A different approach is to sum the surface area of the border faces of the voxels, but this overestimates surface area, especially in small volumes.  
The differences in many of the other features are also due to this difference, as the formulas are dependent on the surface area value.  
A possible exception to this is Compactness1; sometimes the exponent of A is flipped (i.e. 2/3 instead of 3/2). Pyradiomics has the 3/2 exponent, as this makes the formula dimensionless.

Differences in GLCM (and most likely the other texture matrices as well) are most likely due to a different method of gray level discretization (similar to the differences in Uniformity and Entropy).

---

<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:** [July 10, 2017, 8:15am UTC](https://discourse.slicer.org/t/quantitative-features-with-heterogeneitycad/518/36 "2017-07-10T08:15:25Z")

</div>

@mtamponi, In addition, it is possible that there is a small bug in GLCM. This has been fixed in PyRadiomics, but the SlicerExtension uses a specific version of PyRadiomics, where this bugfix has not yet been applied.

---

<div class="post-metadata">

**Author:** ![ShivR](https://avatars.discourse-cdn.com/v4/letter/s/c2a13f/32.png) [@ShivR](https://discourse.slicer.org/u/ShivR)\
**Post date:** [July 10, 2017, 12:55pm UTC](https://discourse.slicer.org/t/quantitative-features-with-heterogeneitycad/518/37 "2017-07-10T12:55:05Z")

</div>

Thank you Steve, it works!

---

<div class="post-metadata">

**Author:** ![ShivR](https://avatars.discourse-cdn.com/v4/letter/s/c2a13f/32.png) [@ShivR](https://discourse.slicer.org/u/ShivR)\
**Post date:** [July 11, 2017, 3:11am UTC](https://discourse.slicer.org/t/quantitative-features-with-heterogeneitycad/518/38 "2017-07-11T03:11:05Z")

</div>

Hi

I’m sorry to post such a basic question here again, but I’m seeing this window in front of me and it seems like the radiomics extension is working - I’ve checked off first and second order features. Could someone please explain how to select something like a node from the whole image and then get the features of that cropped area or point me towards a tutorial for the extension. I can’t seem to find one online. Thanks in advance!

 ![](https://us1.discourse-cdn.com/flex002/uploads/slicer/original/1X/5d1f22b5ea5b4d758afc75ef41cce1335e3c6961.jpg)

---

<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:** [July 11, 2017, 3:42pm UTC](https://discourse.slicer.org/t/quantitative-features-with-heterogeneitycad/518/39 "2017-07-11T15:42:05Z")

</div>

@ShivR we recommend you use [Segment Editor](https://www.slicer.org/wiki/Documentation/Nightly/Modules/SegmentEditor) module to segment the structure(s) of your interest, and then select that segmentation in the “Input Segmentation” selector of the module. Can you try this and let us know if this answers your question?

---

<div class="post-metadata">

**Author:** ![ShivR](https://avatars.discourse-cdn.com/v4/letter/s/c2a13f/32.png) [@ShivR](https://discourse.slicer.org/u/ShivR)\
**Post date:** [July 13, 2017, 6:04pm UTC](https://discourse.slicer.org/t/quantitative-features-with-heterogeneitycad/518/40 "2017-07-13T18:04:33Z")

</div>

Yes, it works! I have one more question, @fedorov. I was watching your video “Segmentation of Lung and Nodule in CT using 3D Slicer”, and I was wanted to confirm that in order to get the 1st and 2nd order features of a node from radiomics, I don’t have to get a 3-d representation of the node like you did in the video right? It is enough to simply paint over the node (2d) in Segment Editor and use that segment to extract the features from in Radiomics module?

[Previous page](https://discourse.slicer.org/t/quantitative-features-with-heterogeneitycad/518.md?page=1)

[Next page](https://discourse.slicer.org/t/quantitative-features-with-heterogeneitycad/518.md?page=3)
