# Segment comparison returns 0 for all metrics

**URL:** <https://discourse.slicer.org/t/segment-comparison-returns-0-for-all-metrics/7386>\
**Category:** Development\
**Tags:** slicerrt\
**Created:** [July 2, 2019, 7:10pm UTC](https://discourse.slicer.org/t/segment-comparison-returns-0-for-all-metrics/7386 "2019-07-02T19:10:29Z")\
**Posts on this page:** 16\
**Page:** 1

<div class="post-metadata">

**Author:** ![saf](https://avatars.discourse-cdn.com/v4/letter/s/59ef9b/32.png) [@saf](https://discourse.slicer.org/u/saf)\
**Post date:** [July 2, 2019, 7:10pm UTC](https://discourse.slicer.org/t/segment-comparison-returns-0-for-all-metrics/7386/1 "2019-07-02T19:10:29Z")

</div>

hello  
why I always get 0 even if I use the same data?  
I mean even if both data have the same characteristics

 ![comp](https://us1.discourse-cdn.com/flex002/uploads/slicer/original/3X/b/e/bea30fe6632b606de537c818b914842cfc184b04.png)

---

<div class="post-metadata">

**Author:** ![lassoan](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/lassoan/32/13_2.png) [@lassoan](https://discourse.slicer.org/u/lassoan)\
**Post date:** [July 2, 2019, 7:12pm UTC](https://discourse.slicer.org/t/segment-comparison-returns-0-for-all-metrics/7386/2 "2019-07-02T19:12:51Z")

</div>

Could you share the data sets that you tested with? You can create a segmentation from one of the Slicer sample data sets if you would prefer not to share your own images/segmentations.

---

<div class="post-metadata">

**Author:** ![cpinter](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/cpinter/32/7995_2.png) [@cpinter](https://discourse.slicer.org/u/cpinter)\
**Post date:** [July 2, 2019, 8:35pm UTC](https://discourse.slicer.org/t/segment-comparison-returns-0-for-all-metrics/7386/3 "2019-07-02T20:35:10Z")

</div>

> [@saf](#):
>
> even if I use the same data

If you use the same data then the difference is 0, so there is no surprise there.

---

<div class="post-metadata">

**Author:** ![saf](https://avatars.discourse-cdn.com/v4/letter/s/59ef9b/32.png) [@saf](https://discourse.slicer.org/u/saf)\
**Post date:** [July 2, 2019, 8:48pm UTC](https://discourse.slicer.org/t/segment-comparison-returns-0-for-all-metrics/7386/4 "2019-07-02T20:48:25Z")

</div>

I captured the datasets

 ![Capture1](https://us1.discourse-cdn.com/flex002/uploads/slicer/original/3X/4/7/478929747b44cbc6d5619ab2dd9e5b5d5c9e03f1.png)

 ![Capture2](https://us1.discourse-cdn.com/flex002/uploads/slicer/original/3X/3/1/31c4b5d440478874c371d2c75758db83148a341f.png)

---

<div class="post-metadata">

**Author:** ![saf](https://avatars.discourse-cdn.com/v4/letter/s/59ef9b/32.png) [@saf](https://discourse.slicer.org/u/saf)\
**Post date:** [July 3, 2019, 9:09am UTC](https://discourse.slicer.org/t/segment-comparison-returns-0-for-all-metrics/7386/5 "2019-07-03T09:09:05Z")

</div>

no, normally, when I use the same data, the dice that will be calculated must be a high value ,  
normally I get a good result not 0  
but I didn’t always try the same datasets, i tried several different data and I always get 0

---

<div class="post-metadata">

**Author:** ![cpinter](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/cpinter/32/7995_2.png) [@cpinter](https://discourse.slicer.org/u/cpinter)\
**Post date:** [July 3, 2019, 1:16pm UTC](https://discourse.slicer.org/t/segment-comparison-returns-0-for-all-metrics/7386/6 "2019-07-03T13:16:02Z")

</div>

Segment Comparison works for me in the recent versions.

Could you please share your data? The segmentation nrrd files are enough, but a Slicer scene (mrb) would be best. Thanks!

---

<div class="post-metadata">

**Author:** ![saf](https://avatars.discourse-cdn.com/v4/letter/s/59ef9b/32.png) [@saf](https://discourse.slicer.org/u/saf)\
**Post date:** [July 3, 2019, 2:35pm UTC](https://discourse.slicer.org/t/segment-comparison-returns-0-for-all-metrics/7386/7 "2019-07-03T14:35:35Z")

</div>

the datasets that i have are in nifti type  
you can found the datasets here  
[https://drive.google.com/open?id=1t\_gn\_UvqarHlV9bFQ8EmjsaLgZh1SPtp](https://drive.google.com/open?id=1t_gn_UvqarHlV9bFQ8EmjsaLgZh1SPtp)

---

<div class="post-metadata">

**Author:** ![cpinter](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/cpinter/32/7995_2.png) [@cpinter](https://discourse.slicer.org/u/cpinter)\
**Post date:** [July 3, 2019, 3:28pm UTC](https://discourse.slicer.org/t/segment-comparison-returns-0-for-all-metrics/7386/8 "2019-07-03T15:28:30Z")

</div>

Thanks for the data!

For me Segment Comparison works on these segmenations. I loaded them as labelmap, then converted them to segmentation nodes, then used Segment Comparison as normal.

The obvious problem is that the two segmentations do not overlap, so Dice is 0 and Hausdorff distances are super high, but the algorithms work. Not sure what you did differently. Please try to do as I describe above.

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

---

<div class="post-metadata">

**Author:** ![saf](https://avatars.discourse-cdn.com/v4/letter/s/59ef9b/32.png) [@saf](https://discourse.slicer.org/u/saf)\
**Post date:** [July 3, 2019, 4:00pm UTC](https://discourse.slicer.org/t/segment-comparison-returns-0-for-all-metrics/7386/9 "2019-07-03T16:00:49Z")

</div>

can you show me how to load them as labelmap and convert them to segmentation nodes. (by a capture if you want)  
because i tried to import them as labelmap but it doesn’t work  
i think i made something wrong .  
thak you

---

<div class="post-metadata">

**Author:** ![cpinter](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/cpinter/32/7995_2.png) [@cpinter](https://discourse.slicer.org/u/cpinter)\
**Post date:** [July 3, 2019, 6:53pm UTC](https://discourse.slicer.org/t/segment-comparison-returns-0-for-all-metrics/7386/10 "2019-07-03T18:53:49Z")

</div>

This is the easiest:

1. Drag&drop  
 ![image](https://us1.discourse-cdn.com/flex002/uploads/slicer/original/3X/7/e/7ea3557ea99f43b5f4afc8bd049e8125e08f632b.png)
2. Data module  
 ![image](https://us1.discourse-cdn.com/flex002/uploads/slicer/original/3X/9/f/9f9cd7b687323e5ace972ccbb594e86e8eaa5c21.png)

---

<div class="post-metadata">

**Author:** ![saf](https://avatars.discourse-cdn.com/v4/letter/s/59ef9b/32.png) [@saf](https://discourse.slicer.org/u/saf)\
**Post date:** [July 5, 2019, 11:27am UTC](https://discourse.slicer.org/t/segment-comparison-returns-0-for-all-metrics/7386/11 "2019-07-05T11:27:04Z")

</div>

thank you I loaded them as labelmap, but i can’t fount the window of convertion to segmentation nodes.

 ![node](https://us1.discourse-cdn.com/flex002/uploads/slicer/original/3X/3/6/3651ee9d6b4c61a03795f18861be873de5309783.png)

---

<div class="post-metadata">

**Author:** ![lassoan](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/lassoan/32/13_2.png) [@lassoan](https://discourse.slicer.org/u/lassoan)\
**Post date:** [July 5, 2019, 12:21pm UTC](https://discourse.slicer.org/t/segment-comparison-returns-0-for-all-metrics/7386/12 "2019-07-05T12:21:32Z")

</div>

As @cpinterwrote above, it is in the Data module. Make sure you use at least the latest stable version of Slicer (currently 4.10.2).

---

<div class="post-metadata">

**Author:** ![saf](https://avatars.discourse-cdn.com/v4/letter/s/59ef9b/32.png) [@saf](https://discourse.slicer.org/u/saf)\
**Post date:** [July 5, 2019, 3:27pm UTC](https://discourse.slicer.org/t/segment-comparison-returns-0-for-all-metrics/7386/14 "2019-07-05T15:27:00Z")

</div>

thank you it works but in Slicer 4.10.1, because in Slicer 4.10.2 i didn’t find the segment comparison module

---

<div class="post-metadata">

**Author:** ![lassoan](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/lassoan/32/13_2.png) [@lassoan](https://discourse.slicer.org/u/lassoan)\
**Post date:** [July 5, 2019, 4:42pm UTC](https://discourse.slicer.org/t/segment-comparison-returns-0-for-all-metrics/7386/15 "2019-07-05T16:42:38Z")

</div>

Segment Comparison module is provided by SlicerRT extension. You’ll have the module in Slicer-4.10.2, too, if you install SlicerRT.

---

<div class="post-metadata">

**Author:** ![saf](https://avatars.discourse-cdn.com/v4/letter/s/59ef9b/32.png) [@saf](https://discourse.slicer.org/u/saf)\
**Post date:** [July 5, 2019, 5:11pm UTC](https://discourse.slicer.org/t/segment-comparison-returns-0-for-all-metrics/7386/16 "2019-07-05T17:11:16Z")

</div>

thank you it works  
I wish I could find more function than dice and dose, such as (recall, precision, accuracy,…)

---

<div class="post-metadata">

**Author:** ![lassoan](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/lassoan/32/13_2.png) [@lassoan](https://discourse.slicer.org/u/lassoan)\
**Post date:** [July 5, 2019, 6:06pm UTC](https://discourse.slicer.org/t/segment-comparison-returns-0-for-all-metrics/7386/17 "2019-07-05T18:06:28Z")

</div>

Dice, recall, precision, accuracy could be all very easily added but they are basically all useless metrics, as they are highly dependent on the shape of the segment, may be sensitive to irrelevant errors and sensitive to all kinds of clinically important errors. For example, 90% does not mean anything: a practically perfect segmentation and an extremely low quality segmentation can both get this same score. For thin shapes that I can see in your screenshots, these overlap percentage based give completely meaningless results. These metrics are probably only used because they are trivial to compute and often researchers do not want to spend a lot of time with evaluation - if they get 1-2% better values than those reported in the literature then they consider their work done, publish their paper, and move on.

Hausdorff metric variants have absolute, clinically relevant meaning - I would highly recommend to use them. Identifying anatomical landmark points and surfaces manually and measure distance between them manually gives useful information, too. You also need to spend time with carefully visual assessment of the results to see where errors occur and see if they are clinically important or not.
