# Resampling along the z-axis of binary segmentation stack

**URL:** <https://discourse.itk.org/t/resampling-along-the-z-axis-of-binary-segmentation-stack/4286>\
**Category:** Beginner Questions\
**Tags:** python\
**Created:** [July 23, 2021, 7:09am UTC](https://discourse.itk.org/t/resampling-along-the-z-axis-of-binary-segmentation-stack/4286 "2021-07-23T07:09:26Z")\
**Posts on this page:** 1\
**Showing post:** 7

<div class="post-metadata">

**Author:** ![lassoan](https://discourse.itk.org/user_avatar/discourse.itk.org/lassoan/32/27_2.png) [@lassoan](https://discourse.itk.org/u/lassoan)\
**Post date:** [July 25, 2021, 1:54am UTC](https://discourse.itk.org/t/resampling-along-the-z-axis-of-binary-segmentation-stack/4286/7 "2021-07-25T01:54:29Z")

</div>

If you don’t need to recover high-frequency information along the K axis (it is enough to smoothly interpolate along the slices) then you have a couple of simple options.

A. Anti-aliasing filter on the image. You can use a windowed sinc kernel, with strong smoothing along the K axis and no smoothing along I and J axes.

B. Compute signed distance map and threshold that. This is implemented in the [resample module in BRAINSTools](https://github.com/BRAINSia/BRAINSTools/tree/master/BRAINSResample).

C. Convert the labelmap to closed surface, apply low-pass filter on the surface (for example, using vtkWindowedSincPolyDataFilter), then convert back to labelmap.

D. Insert empty slices between the segmented slices and run [ITKMorphologicalContourInterpolation](https://github.com/KitwareMedical/ITKMorphologicalContourInterpolation) filter to smoothly interpolate between them.

You can try all these options using Python scripting using ITK and VTK classes, or by a couple of clicks using the GUI of 3D Slicer.

---

_[View the full topic](https://discourse.itk.org/t/resampling-along-the-z-axis-of-binary-segmentation-stack/4286)._
