cropping 3d volume

Hello, i have segmented the liver from 199 CT slices of the same patient (DICOM images).

How can i crop the volume in order to contain only the segmented liver? I also have to write the 3D cropped volume back to the 199 images (I thought to use the example DicomSeriesReadSeriesWrite.cxx for this)…but how can i crop my volume? I dont have a fix dimension…

Thanks for any help!

Does this discussion help you? How about this one? Spatial objects have been significantly refactored about a month ago, keep it in mind of you use the second approach.

thank u again @dzenanz for all your help. Is it possible to do something that is like

volume = volume( volume > 0 ) ?

in practise i want my filter to work only on the volume > 0, is it possible?