Fill between slices

Hi all,
I have a question about the function “Fill between slices” in the segment editor.

How are the slices interpolated?
Linear, Spline? Any intensity information used or just contours geometry?

Thanks a lot.

Hi Paolo,

I hope you’re doing great :slight_smile:

The interpolation algorithm under the hood is ultimately this one:
It is used with the default parameters.

It does not take intensity information into account (see the code, where the only input of the filter is the labelmap).

1 Like

Hi @cpinter!
I’m doing fine :slight_smile:
Thanks for helping, I think I found the article as well.
It should be:

Blockquote Albu, A.B., Beugeling, T. and Laurendeau, D., 2008. A morphology-based approach for interslice interpolation of anatomical slices from volumetric images. IEEE Transactions on Biomedical Engineering , 55 (8), pp.2022-2038.

Thanks a lot!

I have experience with a more or less similar tool in Mimics, called ‘Multiple slice Edit’. For me it has been very usefull when segmenting for instance a vessel, or a tibia in a MRI.
The way I always use the tool is in combination with a threshold setting.

In short it works like this:
– I start by choosing the correct threshold for the part I want to segment (or remove from a mask).
– With the “Multiple slice edit’ I then draw a region around that particular part on multiple, non adjacent slices, just like it is done with the ‘Fill between slices’ in Slicer.
– Then I let the tool interpolate a temporary mask. This temporary masks then includes the part.
– Finally I can choose whether I want to add or remove the part and hit apply.
The resulting mask then shows a nice, continuous mask.

I would love to see this feature in Slicer’s ‘Fill between slices’ tool. Do you think it’s possible to include it?

For some more information on how the ‘Multiple slice edit’ works, I’ve attached a link to a pdf (page 33).

1 Like

I don’t quite understand neither how the threshold is used nor why you’d remove.

In case this information is useful

  • You can define a threshold for edited region in the masking options on the bottom. Only those voxels are affected by any editing operation that are within the threshold
  • The logical operator allows subtracting a segment from another (or you can specify editable area as outside segment in the masking options)

Could be done on slicer, just make a first segment with a threshold then another with with “fill between slices” then do a logical operations> intersect

If this is the goal then it’s easier to do a single Fill between slices with threshold set for Editable intensity range within Masking options. No second segment, no logical operators.

1 Like

To give you an example. Recently I was asked to segment a MRI of a pelvis from a patient with a tumor. The surgeon needed the segmentation for his orientation during the operation. Close to this tumor there was a large blood vessel, so for his convenience I also segmented that.
In MRI the gray values are much harder to handle then in a CT. For this the ‘Multiple slice edit’ (or the ‘Fill between slices’) can be very helpfull.

Doing this in Mimics with the ‘Multiple slice edit’ is very simple.
Let’s say I only want to segment a length of 10 cm. I start by determining which gray values represent the blood vessel. Then with the ‘Multiple slice edit’ I first draw my top slice well around the blood vessel and then my bottom slice, 10 cm lower. Next I let the algorithm calculate/interpolate a temporary 3D-mask. This is also done with some sort of morphing. The temporary mask then includes the part of the blood vessel I want to segment. Within this 3D-mask the tool then decides which voxel gray values (the vessel) correspond to my threshold settings and then it’s up to me to decide whether I want to add or remove these voxels to my final 3D-mask.

I’ve tried this also with the Editable intensity range of ‘Fill between slices’ and it does work, but still it uses it’s contour interpolation which leads to a less accurate, jaggy mask (when smoothing is off, of course) and that’s not what I want.
Also if there is a large change in morphology of the object in between the selected slice (for instance because it changes direction), Mimics does the job well, as long as the object stays within the temporary 3D-mask. With Slicer you have to select extra slices to correct for this, but still the result is less accurate.

If you or someone else knows another easy way or workaround for this, please let me know.

1 Like

Well, I’ve just discovered my own solution! :smile:

When I read through my post I came to this workflow:

  • First I start with a segment in which I use the ‘Fill between slices’ tool to define a 3D-mask that includes my object of interest.
  • Then I start a second segment, choose the threshold tool to define the correct thresholds for this object, select the first mask as my ‘Editable area’ and hit apply.
    Viola! Done!



This sounds great @Leon, would it be possible to add a couple screenshots?

To further simplify this workflow:

  • Set threshold values in Threshold tool but don’t apply, instead select Use for masking
  • Use Fill between slices (or any other tool)

You’ll notice that this will yield equivalent results.

Here you see the procedure for making the temporary mask + unsmoothed result in 3D-viewer.

Then the thresholding for the second segment (I removed the non-connected area’s with the island tool).

This is the result that comes out of your method. I’ve used the same slices as in my one method.

So it’s up to you guys to tell which one is the best. :wink:


You may further improve segmentation result if you use Crop volume module to resample the input volume to have isotropic resolution before segmenting it.


I use Mimics primarily at work and use the Multislice Edit tool All The Time. The work around you say here is what I’ve been doing for my micro-CT scans on my personal project at home. It’s clunky, and I wish the Fill between slices was less jagged, but it works… slowly. What I would give for a smoother Fill between slices!

I’m trying to separate bones of the skull, so the suture lines are sometimes almost non-existant, so more automated tools don’t work for me.

Good to know there is another Mimics user out here facing the same challenges.

You can change the resolution of the segment labelmaps to make the raw segmentation smoother using the box icon next to the master volume selector.

Also you can use the Smooth effect to perform additional smoothing if needed.

Thanks for the feedback. Our goal is to make Slicer’s image segmentation tools work better than Mimics. I think we are already achieved this in many aspects, but if there is anything that you cannot find in Slicer or feel that could be improved then let us know.

Thanks for the tips, cpinter. I didn’t know about the ability to break the segmenting voxels into smaller units. I’m assuming that this would take up more RAM and make things slower, though? However, this may make all the difference because I can see the sutures between skull bones, but it is only one voxel wide in places and therefore not enough to really register with the automated tools. I’ve been looking into getting a computer with more RAM anyways.

Also, I’ll try smoothing what I think of as my ‘temporary selection layer’ after I apply Fill between slices. It’s another step, but likely faster than cleaning up that selection by hand.

lassoan, one other thing that would make a big difference for me is how Fast Marching works. The way the tool works now, you limit it to a percentage of the whole volume. I’d like to use the tool for very local regions, but I can’t go smaller than 0.01%. It would be much more useful to be able to limit it to n voxel radius (eg look only within a 10 voxel radius). What I have in mind is a little closer to how VG Studio works in that regard.

Thanks both for the suggestions!

Hi @aiNeander - we don’t typically use the commercial tools, so if you can provide illustrative examples, either with Slicer’s SampleData or with data you can share, where you find Slicer’s tools could be improved please share as much detail as you can (e.g. screenshots of the level of segmentation detail you need to achieve).

Regarding the Fast Marching min size, that’s a good suggestion (knowing Andras he’s probably already fixed that while I’ve been typing!).

1 Like

Due to discretization of distances, image noise, and partial volume effect, you cannot reliably work with structures with thickness of a single voxel. Probably you need to at least double or triple the resolution, which would make the total volume size 8x or 27x larger. To keep memory size and computation time under control, crop the volume to the region that contains the region of interest. It is also advisable to resample your volume to have isotropic spacing. You can do all these operations in one step, using Crop volume module. If your region of interest is large and you need high resolution then you may need a strong computer (lots of RAM and CPU with high clock speed).

If you reduce the maximum volume then initialization will be faster and for example by setting 0.01% for maximum volume then 0.01% for segment volume, the total is 0.0001%, which should be small enough for most cases. If not, then press Ctrl - + to show more decimals and enter values smaller than 0.01.

How do you use Fast marching for segmenting very local regions? We normally use Fast marching for segmenting an entire region, as you can specify many seeds.

  • If you want to just click a point and add similar regions around it: Then “Flood filling” effect may be more suitable. Than fast marching.
  • If you specify many seed points and want to constrain fast marching around it then we could enable masking for this effect to constraint growing to be within a specific mask segment. We haven’t enabled masking for Fast marching yet because for such cases the much more versatile “Grow from seeds” effect can be used instead, which already supports masking and multiple input segments. Grow from seeds allows you to work within a predefined masked region (that you can create using any other effects) and then use seeds to grow and split segments within the masked region, with interactive updates, with real-time 3D preview.

There are so many very powerful tools in Slicer that can be used in combination to solve very challenging segmentation tasks, but it is not trivial to come up with a good segmentation workflow. If you provide more information as @pieper suggested above then we can give more specific advice.