The bottom of the first picture is not closed. If you want to achieve the same effect as the second picture, how can vtk do it or can vtk achieve such a task?


Hello,

This looks like a camera clipping issue. I guess what you could do is either to move back the camera, or to modify its clipping range. If changing the clipping range doesn’t solve your issue, it means that you’re camera is placed “inside” your dataset and you must back it.

To modify the clipping range, you can use vtkCamera::SetClippingRange(double, double). You can get the camera from your renderer with vtkRenderer::GetActiveCamera().

In python, this should look like

view = vtk.vtkContextView()
[...]
renderer = view.GetRenderer()
camera = renderer.GetActiveCamera()
camera.SetClippingRange(0.01, 1000) #default is [0.1, 1000]

Thank you, my second picture is the stl model generated by 3D Slicer, and the first picture is using vtk.vtkContourFilter() in vtk to extract the bone contours of each ct and combine them together. I found that I can’t just extract outline such that the middle of the model is empty

Hello,

Not sure to understand. Did you solve your issue / understand it?
Isn’t it a clipping range issue? Or are you saying that vtkContourFilter simply can’t achieve what you wanted?