Copy specific slices from existing segments to single Binary Map

What I would specifically like to do is to get the 2D segments from specific slices from two different segmentations onto the same binary label map. (let’s say two slices from the axial direction).

Using those two specific slices, I want to automate the “fill between slices” widget in segment editor to create a smooth volume (which I have figured out already).

The intent of this would essentially be to make a segmentation look like one complete volume then two separate ones for a simulation.

I was wondering if anyone had any idea of how to do the first step using python code?


If it is not possible to specify a slice from a segment, is there any way to interpolate between two segments rather then two slices?

I don’t understand exactly what you would like to do, but it all sounds very easy, using existing Segment Editor effects. You can copy/move segments between segmentations and you can combine them using logical operators effect. See examples in the script repository:

Hi, sorry I was quite convoluted in my initial question.

I got to the part where I combined two segments into one as seen below:

But what I would like to do is find a way to automate a method in “filling the gap” between the seperate segments. I thought of using the “fill in between slices” method, but that requires actually using paint to paint on two different slices to fill in the gap, which is not automatic. Is there any way to do this automatically?