# Dice Similarity compare segment TP and TN correct?

**URL:** <https://discourse.slicer.org/t/dice-similarity-compare-segment-tp-and-tn-correct/17246>\
**Category:** Support\
**Tags:** segmentation\
**Created:** [April 22, 2021, 9:02am UTC](https://discourse.slicer.org/t/dice-similarity-compare-segment-tp-and-tn-correct/17246 "2021-04-22T09:02:27Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Focus](https://avatars.discourse-cdn.com/v4/letter/f/bc79bd/32.png) [@Focus](https://discourse.slicer.org/u/Focus)\
**Post date:** [April 22, 2021, 9:02am UTC](https://discourse.slicer.org/t/dice-similarity-compare-segment-tp-and-tn-correct/17246/1 "2021-04-22T09:02:27Z")

</div>

I use this module to compare segment and I use the same model. I don’t know why TruePositve value is less than TrueNegative value. I think this algorithm is measure from the box of pink. Am I true?? that the area outside the segment is TN and the segment model is a TP. I write on the picture down below.

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

---

<div class="post-metadata">

**Author:** ![Focus](https://avatars.discourse-cdn.com/v4/letter/f/bc79bd/32.png) [@Focus](https://discourse.slicer.org/u/Focus)\
**Post date:** [April 22, 2021, 9:10am UTC](https://discourse.slicer.org/t/dice-similarity-compare-segment-tp-and-tn-correct/17246/2 "2021-04-22T09:10:23Z")

</div>

I found this documentation source module and I think is it wrong measure? formula that dice similarity is use Union instead of intersect.

 ![image](https://us1.discourse-cdn.com/flex002/uploads/slicer/original/3X/f/c/fce113a8192f470734c43e0aadc4a2709cc7e2cc.png)  
I surf on the internet that dice similarity look like this. Can anyone tell me that I got it right?  
 ![image](https://us1.discourse-cdn.com/flex002/uploads/slicer/original/3X/e/c/ec81e8faf06d6d59a3f11592d0706294f923ffcd.png)

---

<div class="post-metadata">

**Author:** ![mikebind](https://avatars.discourse-cdn.com/v4/letter/m/71e660/32.png) [@mikebind](https://discourse.slicer.org/u/mikebind)\
**Post date:** [April 22, 2021, 9:23pm UTC](https://discourse.slicer.org/t/dice-similarity-compare-segment-tp-and-tn-correct/17246/3 "2021-04-22T21:23:08Z")

</div>

On a quick look, this seems OK to me. TP is less than TN because there are more voxels where the object isn’t present than where it is present. 20% of the voxels are object, and 80% are not object. Dice value is 1 because 2 \* (0.2 \* N) / (0.2_N + 0.2_N) = 1 (where N = number of voxels). The intersection of A and B is 0.2_N because A has volume 0.2_N and B has volume 0.2\*N and all of those voxels are in the same place (because A=B) in your example.

---

<div class="post-metadata">

**Author:** ![Focus](https://avatars.discourse-cdn.com/v4/letter/f/bc79bd/32.png) [@Focus](https://discourse.slicer.org/u/Focus)\
**Post date:** [April 23, 2021, 12:44pm UTC](https://discourse.slicer.org/t/dice-similarity-compare-segment-tp-and-tn-correct/17246/4 "2021-04-23T12:44:00Z")

</div>

Thank you for your support.
