# How can I save whole heart without empty spaces?

**URL:** <https://discourse.slicer.org/t/how-can-i-save-whole-heart-without-empty-spaces/23596>\
**Category:** Support\
**Tags:** segmentation\
**Created:** [May 26, 2022, 3:21pm UTC](https://discourse.slicer.org/t/how-can-i-save-whole-heart-without-empty-spaces/23596 "2022-05-26T15:21:28Z")\
**Posts on this page:** 20\
**Page:** 1

<div class="post-metadata">

**Author:** ![Js165](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/js165/32/14631_2.png) [@Js165](https://discourse.slicer.org/u/Js165)\
**Post date:** [May 26, 2022, 3:21pm UTC](https://discourse.slicer.org/t/how-can-i-save-whole-heart-without-empty-spaces/23596/1 "2022-05-26T15:21:28Z")

</div>

I am facing this problem while saving/exporting the segmentation into a binary label map. The problem is with HEART only. The heart contains multiple substructures. When I am saving the whole Heart and multiple substructures, the whole heart is showing some empty spaces. The empty spaces mainly contain the substructures.  
**I am getting below image of whole heart:**  
 ![Screen Shot 2022-05-25 at 2.34.23 PM](https://us1.discourse-cdn.com/flex002/uploads/slicer/original/3X/a/4/a448c9544ca26b38bedb9a425ae045e17cdbf144.png)

**When I select all the substructures of heart then I am getting the below result:**  
 ![Screen Shot 2022-05-25 at 2.35.54 PM](https://us1.discourse-cdn.com/flex002/uploads/slicer/original/3X/0/f/0ff90b8f768c6b247c07cadbc3b54a0a84d8e710.png)  
 ![Screen Shot 2022-05-25 at 2.36.01 PM](https://us1.discourse-cdn.com/flex002/uploads/slicer/original/3X/8/5/8566a3588a97aa487684c2cbf3048c03b2610bef.png)

I want whole heart should look like the below image without detailed information of substructures. Ignore the texts in it.  
 ![Screen Shot 2022-05-25 at 2.37.42 PM](https://us1.discourse-cdn.com/flex002/uploads/slicer/original/3X/c/7/c754fa693ee7a0289b832e0df81c190b167c6d66.png)

Thanks in advance.

---

<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:** [May 27, 2022, 3:25am UTC](https://discourse.slicer.org/t/how-can-i-save-whole-heart-without-empty-spaces/23596/2 "2022-05-27T03:25:20Z")

</div>

To create a segment that is the union of all other segments, you can use Logical operators effect’s Fill option, with setting Editable region → Inside all segments.

---

<div class="post-metadata">

**Author:** ![Js165](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/js165/32/14631_2.png) [@Js165](https://discourse.slicer.org/u/Js165)\
**Post date:** [May 27, 2022, 12:32pm UTC](https://discourse.slicer.org/t/how-can-i-save-whole-heart-without-empty-spaces/23596/3 "2022-05-27T12:32:55Z")

</div>

@lassoan Thanks for your suggestion. I tried “Hollow” option. It is giving me the result but other structures are also impacting. Most probably I am not selecting correct parameter. Could you please suggest correct parameter settings?

---

<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:** [May 27, 2022, 12:59pm UTC](https://discourse.slicer.org/t/how-can-i-save-whole-heart-without-empty-spaces/23596/4 "2022-05-27T12:59:32Z")

</div>

“Hollow” effect changes a solid structure into a hollow structure. Based on what you described, this is not what you need.

Have you tried to use the “Logical operators” effect as I described above? If you want to keep other segments unchanged then set “Allow overlap” in Masking section.

---

<div class="post-metadata">

**Author:** ![Js165](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/js165/32/14631_2.png) [@Js165](https://discourse.slicer.org/u/Js165)\
**Post date:** [May 27, 2022, 1:10pm UTC](https://discourse.slicer.org/t/how-can-i-save-whole-heart-without-empty-spaces/23596/5 "2022-05-27T13:10:37Z")

</div>

Yes, I tried and attached is the screenshot of the parameter selection. I am not getting expected result. Am I doing anything wrong here?

 ![Screen Shot 2022-05-27 at 9.08.08 AM](https://us1.discourse-cdn.com/flex002/uploads/slicer/original/3X/2/e/2ee51f71dcf474e4d2f2733dc4323772bb916ddc.jpeg)

---

<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:** [May 27, 2022, 1:14pm UTC](https://discourse.slicer.org/t/how-can-i-save-whole-heart-without-empty-spaces/23596/6 "2022-05-27T13:14:05Z")

</div>

Uncheck “Bypass masking” to make the filling operation respect masking settings.

---

<div class="post-metadata">

**Author:** ![Js165](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/js165/32/14631_2.png) [@Js165](https://discourse.slicer.org/u/Js165)\
**Post date:** [May 27, 2022, 1:32pm UTC](https://discourse.slicer.org/t/how-can-i-save-whole-heart-without-empty-spaces/23596/7 "2022-05-27T13:32:50Z")

</div>

I have attached before and after effects based on your suggestion. Whole segment is filling instead of only Heart.  
**Before**

 ![Screen Shot 2022-05-27 at 9.29.48 AM](https://us1.discourse-cdn.com/flex002/uploads/slicer/original/3X/e/6/e6307330f201c76881f510c87785cc1c2debab12.jpeg)  
**After**  
 ![Screen Shot 2022-05-27 at 9.30.05 AM](https://us1.discourse-cdn.com/flex002/uploads/slicer/original/3X/0/e/0e933e773c6a218e914ec05a1682898a19f2ae4d.jpeg)

---

<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:** [May 27, 2022, 2:48pm UTC](https://discourse.slicer.org/t/how-can-i-save-whole-heart-without-empty-spaces/23596/8 "2022-05-27T14:48:02Z")

</div>

It works well for me. Use the latest Slicer Stable Release (Slicer-5.0.x) and follow these steps:

[https://us1.discourse-cdn.com/flex002/uploads/slicer/original/3X/9/1/91108a3f8ac9a4fd91e64ca68e157aa8b5921e31.mp4](https://us1.discourse-cdn.com/flex002/uploads/slicer/original/3X/9/1/91108a3f8ac9a4fd91e64ca68e157aa8b5921e31.mp4)

---

<div class="post-metadata">

**Author:** ![Js165](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/js165/32/14631_2.png) [@Js165](https://discourse.slicer.org/u/Js165)\
**Post date:** [May 27, 2022, 5:32pm UTC](https://discourse.slicer.org/t/how-can-i-save-whole-heart-without-empty-spaces/23596/9 "2022-05-27T17:32:52Z")

</div>

Thanks for sharing the video. My Slicer package is stable version and up to date. I tried in Mac and Linux but there is no change in result. Here is the latest outcome.

![a](https://us1.discourse-cdn.com/flex002/uploads/slicer/original/3X/1/9/19bae1bc5184f4938bcc00eb76da728ec0123790.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:** [May 27, 2022, 5:37pm UTC](https://discourse.slicer.org/t/how-can-i-save-whole-heart-without-empty-spaces/23596/10 "2022-05-27T17:37:47Z")

</div>

What is your exact Slicer version?

Could you try it on a sample data set, creating the segmentation from scratch, to see if there is something special about your segmentation? Or save your scene as a .mrb file, upload it somewhere, and post the link here, so that I can try to reproduce the behavior on my computer?

---

<div class="post-metadata">

**Author:** ![Js165](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/js165/32/14631_2.png) [@Js165](https://discourse.slicer.org/u/Js165)\
**Post date:** [May 27, 2022, 5:39pm UTC](https://discourse.slicer.org/t/how-can-i-save-whole-heart-without-empty-spaces/23596/11 "2022-05-27T17:39:35Z")

</div>

I am using Slicer version 5.1.0 and 5.0.2. I tried both versions.

---

<div class="post-metadata">

**Author:** ![Js165](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/js165/32/14631_2.png) [@Js165](https://discourse.slicer.org/u/Js165)\
**Post date:** [May 27, 2022, 5:44pm UTC](https://discourse.slicer.org/t/how-can-i-save-whole-heart-without-empty-spaces/23596/12 "2022-05-27T17:44:41Z")

</div>

This is the answer of your next question: Sure, I will share the details soon.

---

<div class="post-metadata">

**Author:** ![Js165](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/js165/32/14631_2.png) [@Js165](https://discourse.slicer.org/u/Js165)\
**Post date:** [May 29, 2022, 2:20pm UTC](https://discourse.slicer.org/t/how-can-i-save-whole-heart-without-empty-spaces/23596/13 "2022-05-29T14:20:17Z")

</div>

I’ve uploaded the sample data and corresponding segmentation file. Please use this link [https://easyupload.io/0klfow](https://easyupload.io/0klfow) to download those files. The problem is with only “Whole Heart”. I have attached few screenshots for your reference. **The problem is arising when I am saving the segmentation into labelmap.**

![1](https://us1.discourse-cdn.com/flex002/uploads/slicer/original/3X/1/3/139fe27cc139c149bd751ab8d1c0ef724ce1cd55.png)  
 ![2](https://us1.discourse-cdn.com/flex002/uploads/slicer/original/3X/1/1/11c530f2e5b33371b21308385da3f600bba31b83.png)  
 ![3](https://us1.discourse-cdn.com/flex002/uploads/slicer/original/3X/a/6/a6a498beb78e58339ee307d1aec73204dc22c0e1.png)  
 ![4](https://us1.discourse-cdn.com/flex002/uploads/slicer/original/3X/c/c/cc4652d6c9f534ee0e9101007bf264a5b3d41fe1.png)  
 ![6](https://us1.discourse-cdn.com/flex002/uploads/slicer/original/3X/8/7/875bde4462f9d64b94cf1fe428dfe2c4ca8cb66b.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:** [May 29, 2022, 8:00pm UTC](https://discourse.slicer.org/t/how-can-i-save-whole-heart-without-empty-spaces/23596/14 "2022-05-29T20:00:49Z")

</div>

Thank you, by loading the linked file I was able to reproduce the unexpected behavior. There was a bug in Logical operator effect and so the mask was only applied if you performed some editing operation (e.g., use the Paint effect) before.

I’ve submitted a fix, so tomorrow’s Slicer Preview Release will not have this issue. As a workaround, use Paint effect to draw a small scribble somewhere (you can undo it or erase it right after it) and then use the Logical operators effect.

Note: Do not save segmentations in Nifti files. They are intended for brain images only and have many issues and limitations. For example they cannot store overlapping segments.

---

<div class="post-metadata">

**Author:** ![Js165](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/js165/32/14631_2.png) [@Js165](https://discourse.slicer.org/u/Js165)\
**Post date:** [May 29, 2022, 11:47pm UTC](https://discourse.slicer.org/t/how-can-i-save-whole-heart-without-empty-spaces/23596/15 "2022-05-29T23:47:14Z")

</div>

Thanks for the update! I will try tomorrow’s Slicer Preview Release and update here.

---

<div class="post-metadata">

**Author:** ![Js165](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/js165/32/14631_2.png) [@Js165](https://discourse.slicer.org/u/Js165)\
**Post date:** [May 30, 2022, 4:25pm UTC](https://discourse.slicer.org/t/how-can-i-save-whole-heart-without-empty-spaces/23596/16 "2022-05-30T16:25:05Z")

</div>

Hi,  
Update on the issue: I tried with recent release (version 5.1.0 revision 30976 built 2022-05-30) but I didn’t find any changes in the result.

---

<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:** [May 30, 2022, 6:46pm UTC](https://discourse.slicer.org/t/how-can-i-save-whole-heart-without-empty-spaces/23596/17 "2022-05-30T18:46:11Z")

</div>

Slicer 5.1.0-2022-05-29 r30976 version works well. See this video successfully testing it on your data:

[https://us1.discourse-cdn.com/flex002/uploads/slicer/original/3X/2/d/2d66cb5de1d84849ce7c2da4312d6239ea20ecb7.mp4](https://us1.discourse-cdn.com/flex002/uploads/slicer/original/3X/2/d/2d66cb5de1d84849ce7c2da4312d6239ea20ecb7.mp4)

---

<div class="post-metadata">

**Author:** ![Js165](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/js165/32/14631_2.png) [@Js165](https://discourse.slicer.org/u/Js165)\
**Post date:** [May 31, 2022, 3:55pm UTC](https://discourse.slicer.org/t/how-can-i-save-whole-heart-without-empty-spaces/23596/18 "2022-05-31T15:55:07Z")

</div>

Thanks so much! This version has partially solved my issue. I want the effect will only be applied to the “whole heart”, not to other organs. For example, I am unable to detach esophagus from whole heart.

Not the RED circle portion  
 ![2022_05_31_0jy_Kleki](https://us1.discourse-cdn.com/flex002/uploads/slicer/original/3X/0/d/0dbd52ed1ee9a91fb676b66f81433810b43a0786.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:** [June 1, 2022, 7:30pm UTC](https://discourse.slicer.org/t/how-can-i-save-whole-heart-without-empty-spaces/23596/19 "2022-06-01T19:30:55Z")

</div>

You can hide the segments that you are not interested in and choose `editable region` → `inside visible segments`.

---

<div class="post-metadata">

**Author:** ![Js165](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/js165/32/14631_2.png) [@Js165](https://discourse.slicer.org/u/Js165)\
**Post date:** [June 1, 2022, 8:30pm UTC](https://discourse.slicer.org/t/how-can-i-save-whole-heart-without-empty-spaces/23596/20 "2022-06-01T20:30:26Z")

</div>

Thanks so much! I tried that option too and there is no improvements on the issue.  
Here, I attached the screenshot. I created **segment 9** for applying logical operation. You can see all other segments are not visible. segment 9 contains all the organs. I just want heart will display here.

 ![mm](https://us1.discourse-cdn.com/flex002/uploads/slicer/original/3X/d/4/d47812f6bae785d2c6a5d50e0631ad14b4a6a523.png)

My goal is to **FILL the empty regions inside the heart**. For example, I am showing the empty regions of heart.

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