I had done surface rendering using vtk marching cubes and now I need to do clipping in that.
I searched and found how to do clipping in volume rendered output(i.e.; using ray casting method) .But I need to do clipping in surface rendered output. so I created a vtkClipPolyData
plane->SetOrigin(0.0, 0.0, pDoc->fBounds[4]);
plane->SetNormal(1.0, -1.0, -1.0);
clipper->SetInputConnection(//marchingcubes variable here//->GetOutputPort());
clipper->SetClipFunction(plane);
clipper->SetValue(.5);
clipper->Update();
polydata = clipper->GetOutput();//vtkPolyData//
mapper->SetInput(polydata);//vtkPolyDataMapper//
actor->SetMapper(mapper);//vtkActor//
And I am getting the clipped output.but the problem is I need to create a slider bar and as the slider is dragged the clipping should appear in axial view back and forth .Is my question clear? Can anybody help?
You can try using a vtkSliderWidget. There's an example of how to use it here. On its callback, you can set the clipping plane's position.
Another option: You could use a vtkImplicitPlaneWidget2 (note: the 2 there is because there's a new and an old version - use the '2' versions whenever possible).