vtkImageData 3D cropping

Hi, I’m having a trouble of vtkImageData.
Basically, I used vtkImageData to read and store the DICOM. And use vtkVolume to display this image. See the pic below.

And now I want to define a 3D polygon (say Three-dimensional hexagon) inside the volume, and I want crop that region out of the vtkVolume. (Hide the image data of the interaction part). Is there a way to do that?

You can get clipping planes from a box widget and set it in the in the volume mapper.

This and most other generic DICOM image import, viewing, and processing features that you may consider adding to your application in the next few years are already available in extensible, customizable, VTK-based application frameworks, such as 3D Slicer, MITK, or various flavors or ParaView. So, if you want to build a full-featured, robust application then you can get there much quicker by relying on these frameworks for providing all the basic features. You can then focus your efforts on implementing the new, special features that distinguish your application from all the existing DICOM viewer/analysis/processing applications.

Hi, thank you for your reply.

About the box widget, is this only works for cube? I mean the box widget is a Hexahedron. I may not be clear enough about the question. So basically I want to cut this green region out. Is there a way?


I’m writing my own application with the vtk right now. About the 3D slicer and etc, are these apps or they have some libraries I can use?

vedo provide a example which may help: example/advanced/pointsCutMesh1.py

This method can cut a surface rather than a volume.

Yeah. I also found several ways to do it for surface. But not sure if there is a way for volume. But thank you.

With 3D Slicer you can make free-hand cuts into a volume, in 3D and 2D views. See a short video here:

If you only use Slicer core features then after you draw the in the view you need to manually click to update the volume, but if you need simpler user experience then you can easily automate this with a short Python script. You can join the discussion and ask more questions here.

This is so helpful!! Thank you!!