[vtkusers] Box widget clip VOI
Massinissa Bandou
Massinissa.Bandou at USherbrooke.ca
Mon Aug 5 13:05:22 EDT 2013
Hi Jose,
I suggest you to create a boxwidget with a cube inside and store its bounds
in a vector. Then use setVOI() from vtkExtractVOI to extract the volume of
interest
for example
std::vector<double> vec;
std::vector<std::vector<double>> vector;
vtkSmartPointer<vtkCubeSource> cube =
vtkSmartPointer<vtkCubeSource>::New();
cube->SetBounds(-10,10,-10,10,-10,10);
vtkSmartPointer<vtkPolyDataMapper> cubeMapper =
vtkSmartPointer<vtkPolyDataMapper>::New();
cubeMapper->SetInput(cube->GetOutput());
vtkSmartPointer<vtkActor> cubeActor = vtkSmartPointer<vtkActor>::New();
cubeActor->SetMapper(cubeMapper);
cubeActor->GetProperty()->SetColor(0.0,0.0,1.0);
cubeActor->GetProperty()->SetOpacity(0.5);
vtkBoxWidget* boxWidget = vtkBoxWidget::New();
boxWidget->SetInteractor(this->Interactor);
boxWidget->SetPlaceFactor(1.25);
boxWidget->SetProp3D(cubeActor);
boxWidget->PlaceWidget();
boxWidget->On();
vtkTransform *t = vtkTransform::New();
vtkBoxWidget *widget = reinterpret_cast<vtkBoxWidget*>(caller);
widget->GetTransform(t);
widget->GetProp3D()->SetUserTransform(t);
//get the cube bounds
double bounds[6];
widget->GetProp3D()->GetBounds(bounds);
for(unsigned int i=0; i<6; i++){
vec.push_back(bounds[i]);
}
vector.push_back(vec);
then use vector to extract the volume of interest (setVOI(vector)).
--
View this message in context: http://vtk.1045678.n5.nabble.com/Box-widget-clip-VOI-tp5722486p5722487.html
Sent from the VTK - Users mailing list archive at Nabble.com.
More information about the vtkusers
mailing list