Subsample a 3D volume

Hi guys,

I’m trying to subsample a 3D volume in a particular plane, while keeping the same spacing in the other two. I found an example of something similar here:

However, I don’t want to use any kind of projection/interpolation, just a simple subsampling setting a concrete spacing in one axis (axial plane).

Do you have any idea which would be the best way to achieve this?

Also, once that I use the sliceLogic, I don’t know how to reset the state (even when closing the scene, the volume is not displayed correctly in the used Window). What’s the right way to reset it?

Thank you!

Hi Jorge -

Maybe you can use this module [1] under Legacy->Filtering. It gives you control over the spacing in the image planes and creates a new volume that you can save and restore.



Hi Steve,

I don’t know the history of module to be under Legacy, but it worked like a charm. I hope it doesn’t get deprecated anytime soon :slight_smile:


Jorge Onieva

With non-deprecated modules, you would create an empty volume to specify spacing and extent and then use Crop Volume module or any of the image resample modules to conform the input module to that geometry.

Hi guys,

As a follow up to this question, I have an issue with the visualization of the volume when the volume spacing is higher than the SliceWidget spacing. If I navigate the volume using keyboard arrows or mouse wheel, there is no problem. But if I drag and drop in the slider on the top of the SliceWidget, I can get to “intermediate” slices where a merge between slices is displayed (see attached screenshot to show the effect).

I tried to manually set the SliceWidget offset using the SetSliceOffset function, but it doesn’t seem to have any effect when using drag and drop.

Is there any way to really force the SliceWidget minimum offset so that it matches the spacing of the displayed foreground volume?

Thank you


Slice widget’s spacing is set by default to be the same as the voxel spacing along that axis (you can change from auto to a custom value in the slice controller widget). So, it seems that your problem is that using the slice offset slider you can make smaller steps.

I’m not sure how to solve this in general. Slicer does not enforce snapping to middle of a slice, as often there is no exact slice position (when there are multiple images with different geometries, or when slice view is not aligned with image axes) and you can move the slice to any position by shift + mouse move or when you jump to a markup that is not in the middle of a slice, etc.

You may implement a solution in your particular workflow: observe the slice node and whenever it is changed, update its position to snap to the middle of a slice of a specific volume. Instead of updating the position in the observer callback, probably you need to use a resettable timer with a timeout of a fraction of a second.