[vtkusers] Show whole volume under a slice

Lonni Besançon lonni.besancon at gmail.com
Thu Feb 25 08:43:01 EST 2016


Hello,

I set up all the code to make a cutting plane move the way I want it and I
can actually get in an other image the actual slice that I'm looking at.
However, what I'm trying to achieve now is different. Say my slice is in the
middle of my volume I would to see half of that volume on my screen. I
actually managed to do it a while ago with the simple BUNNY example and
vtkPolyData but it does not work at all with my volume. 

Here is my code (skippin irrelevant parts to simplify reading):

/        Renderer = vtkRenderer::New();
	Renderer->SetBackground(.3, .6, .3);
	RenderWindow->AddRenderer(Renderer.Get());

	reader = vtkSmartPointer<vtkDataSetReader>::New();
	reader->SetFileName(filename.c_str());
	reader->Update();
	imageData = vtkSmartPointer<vtkImageData>::New();
	imageData->ShallowCopy(reader->GetOutput());
        vtkSmartPointer<vtkOpenGLGPUVolumeRayCastMapper> volumeMapper =
vtkOpenGLGPUVolumeRayCastMapper::New();
	volumeMapper->SetInputData(imageData);

        vtkSmartPointer<vtkVolume> volume =
vtkSmartPointer<vtkVolume>::New();
	volume->SetMapper(volumeMapper);
	volume->SetProperty(volumeProperty);
	mainActor = volume ; //mainActor is a Prop3D
        Renderer->AddViewProp(mainActor);
	Renderer->ResetCamera();

 ....

        plane = vtkSmartPointer<vtkPlane>::New();
	plane->SetTransform(vtkTransform::New());
	plane->SetNormal(0,0,1);
	plane->SetOrigin(0,0,20);

        clipper = vtkSmartPointer<vtkClipDataSet>::New();
	clipper->SetInputConnection(reader->GetOutputPort());
	clipper->SetClipFunction(plane);
	clipper->InsideOutOn();

	mapperSliceData = vtkSmartPointer<vtkPolyDataMapper>::New();
	mapperSliceData->SetInputConnection(clipper->GetOutputPort());
  
	slicedActor = vtkSmartPointer<vtkActor>::New();
	slicedActor->SetMapper(mapperSliceData);


	Renderer->AddActor(slicedActor);
	ctxView->Render();
/

Not only this piece of code does show me what I'd like to see, but above all
it is extremely slow.
Would you mind taking a look at the code and help me solve this problem?

Thanks in advance




--
View this message in context: http://vtk.1045678.n5.nabble.com/Show-whole-volume-under-a-slice-tp5736839.html
Sent from the VTK - Users mailing list archive at Nabble.com.


More information about the vtkusers mailing list