# Thresholding series of 2D images

**URL:** https://discourse.slicer.org/t/thresholding-series-of-2d-images/35610
**Category:** Support
**Created:** [April 19, 2024, 2:19am UTC](https://discourse.slicer.org/t/thresholding-series-of-2d-images/35610 "2024-04-19T02:19:47Z")
**Posts on this page:** 7
**Page:** 1

<div class="post-metadata">

### Author: ![muratmaga](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/muratmaga/32/3622_2.png) [@muratmaga](https://discourse.slicer.org/u/muratmaga)
#### Post date: [April 19, 2024, 2:19am UTC](https://discourse.slicer.org/t/thresholding-series-of-2d-images/35610/1 "2024-04-19T02:19:47Z")

</div>

I have a series of 2D images, for which I would like to use the segment editor to mask out the background. It seems fine in the preview, but when I apply there is this ghost of other slices?

Is this because of interpolation between slices (this is not a 3D volume, but series of 2D images). If so, is there a chance to apply the threshold per slice basis?

---

<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: [April 19, 2024, 12:38pm UTC](https://discourse.slicer.org/t/thresholding-series-of-2d-images/35610/2 "2024-04-19T12:38:49Z")

</div>

The thresholding would be at the pixel level, so slice/volume shouldn’t matter. Are you sure this isn’t just a rendering issue? Maybe turn off interpolation in the slice view.

---

<div class="post-metadata">

### Author: ![muratmaga](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/muratmaga/32/3622_2.png) [@muratmaga](https://discourse.slicer.org/u/muratmaga)
#### Post date: [April 19, 2024, 7:33pm UTC](https://discourse.slicer.org/t/thresholding-series-of-2d-images/35610/3 "2024-04-19T19:33:09Z")

</div>

Interesting, it seems like a rendering issue in my other computer. I can’t replicate it with a different computer. Thanks.

I do have one more question. There are small gaps, which I would like to fill. Normally I would use closing filter to do that. But when I do, due to 3D interpolation I get artifacts (i.e, mask extending into places where it shouldnt). Would it be possible to run this slice-by-slice somehow?

 ![image](https://us1.discourse-cdn.com/flex002/uploads/slicer/original/3X/b/0/b000ba31099edb8844afddbb72a7440a51b72fa2.jpeg) ![image](https://us1.discourse-cdn.com/flex002/uploads/slicer/original/3X/1/b/1b9b7a2deab1e88617c6da13f67f1d0e3f4c0301.jpeg)

---

<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: [April 19, 2024, 8:53pm UTC](https://discourse.slicer.org/t/thresholding-series-of-2d-images/35610/4 "2024-04-19T20:53:28Z")

</div>

Yes, unlike thresholding, any of the 3d operations are going to have trouble with this kind of data (since it’s not a volume). The thing I would look at doing would be to do some of these operations at the numpy array level.

Regarding the rendering issue, that really shouldn’t happen differently on different machines. If you are able to replicate it in some small test maybe you can share the steps and others can try?

---

<div class="post-metadata">

### Author: ![muratmaga](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/muratmaga/32/3622_2.png) [@muratmaga](https://discourse.slicer.org/u/muratmaga)
#### Post date: [April 19, 2024, 9:18pm UTC](https://discourse.slicer.org/t/thresholding-series-of-2d-images/35610/5 "2024-04-19T21:18:28Z")

</div>

You can find the sample data here;  
[OSF | 39384\_cropped\_photos.zip](https://osf.io/c3wsg)

---

<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: [April 20, 2024, 2:38pm UTC](https://discourse.slicer.org/t/thresholding-series-of-2d-images/35610/6 "2024-04-20T14:38:47Z")

</div>

> [@muratmaga](#):
>
> Interesting, it seems like a rendering issue in my other computer. I can’t replicate it with a different computer.

It didn’t happen for me either (on mac book air m2). Is it repeatable on the machine where it happened? What is different about that computer?

---

<div class="post-metadata">

### Author: ![muratmaga](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/muratmaga/32/3622_2.png) [@muratmaga](https://discourse.slicer.org/u/muratmaga)
#### Post date: [April 20, 2024, 3:53pm UTC](https://discourse.slicer.org/t/thresholding-series-of-2d-images/35610/7 "2024-04-20T15:53:24Z")

</div>

It is an older Macbook pro (intel chip), but funny thing I can’t reproduce it anymore.
