# Heat Map for multiple segmentations

**URL:** https://discourse.slicer.org/t/heat-map-for-multiple-segmentations/23782
**Category:** Support
**Created:** [June 9, 2022, 6:02am UTC](https://discourse.slicer.org/t/heat-map-for-multiple-segmentations/23782 "2022-06-09T06:02:13Z")
**Posts on this page:** 5
**Page:** 1

<div class="post-metadata">

### Author: ![zells](https://avatars.discourse-cdn.com/v4/letter/z/6de8d8/32.png) [@zells](https://discourse.slicer.org/u/zells)
#### Post date: [June 9, 2022, 6:02am UTC](https://discourse.slicer.org/t/heat-map-for-multiple-segmentations/23782/1 "2022-06-09T06:02:13Z")

</div>

![](https://us1.discourse-cdn.com/flex002/uploads/slicer/original/3X/4/d/4dfcf174e722a78772b656255f470a335cfbe565.png)  
I have a bunch of lesions here (with organs) but I want the colors of the lesions to be denoted in a manner that if they are overlapping with other lesions it changes color. ie if the two yellow lesions (in the middle of the screen) have a overlap in the middle the color would be say red.

Basically creating a heat map of common points within the lesion. Anyone know of an extension package or a way to take care of this? Any recommendations are appreciated

---

<div class="post-metadata">

### Author: ![mau\_igna\_06](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/mau_igna_06/32/9056_2.png) [@mau\_igna\_06](https://discourse.slicer.org/u/mau_igna_06)
#### Post date: [June 9, 2022, 1:06pm UTC](https://discourse.slicer.org/t/heat-map-for-multiple-segmentations/23782/2 "2022-06-09T13:06:04Z")

</div>

You can code your segments with prime numbers. That makes them decodeable after they are multiplied. Ot’s a costly iperation but you can have a look up table for it.

Please ask if you have any questions and if you’d be willing tondevelop this for Slicer

---

<div class="post-metadata">

### Author: ![hherhold](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/hherhold/32/12199_2.png) [@hherhold](https://discourse.slicer.org/u/hherhold)
#### Post date: [June 9, 2022, 1:20pm UTC](https://discourse.slicer.org/t/heat-map-for-multiple-segmentations/23782/3 "2022-06-09T13:20:57Z")

</div>

There are likely many data structures that would allow you to do this, another one would be to make a volume bitmap. Each bit is for a lesion, and any element in the volume with more than one bit set is an overlap. (If that makes sense.) This could probably be done in python without too much effort.

---

<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: [June 9, 2022, 4:31pm UTC](https://discourse.slicer.org/t/heat-map-for-multiple-segmentations/23782/4 "2022-06-09T16:31:26Z")

</div>

> [@hherhold](#):
>
> one would be to make a volume bitmap.

I agree, this would be a very easy way to find how many structures overlap at each location. You can [get each segment as a numpy array](https://slicer.readthedocs.io/en/latest/developer_guide/script_repository.html#read-and-write-a-segment-as-a-numpy-array) and simply add the arrays to get a “heat map”. You can [put the result into a volume node](https://slicer.readthedocs.io/en/latest/developer_guide/script_repository.html#combine-multiple-volumes-into-one) and then view it in slice views or volume rendering.

---

<div class="post-metadata">

### Author: ![zells](https://avatars.discourse-cdn.com/v4/letter/z/6de8d8/32.png) [@zells](https://discourse.slicer.org/u/zells)
#### Post date: [June 9, 2022, 4:35pm UTC](https://discourse.slicer.org/t/heat-map-for-multiple-segmentations/23782/5 "2022-06-09T16:35:24Z")

</div>

@hherhold @lassoan Thank you both for suggestions! Thank you for the links as well. I will give this a try. Thank you
