[vtkusers] interactive volume slicing

Alessio Balzide mail_di_ale at yahoo.it
Thu Oct 11 04:37:15 EDT 2007


good morning everybody!
I'm visualizing a 3D "analyze" volume, slice by slice. Ok I can do that, but I cannot interact with the slices (moving them through the volume). Can someone explain me how to do that?

Here's my obviously-not-working idea: (the code is in C++)
I use "vtkInteractorStyleUser.h", create a callback and updatie the position of the slices. But it doesn't work.. even if I re-render the window. Why????

This is my code:
//Extract a slice
vtkExtractVOI *extractor_XY = vtkExtractVOI::New();
  extractor_XY->SetInputConnection(ImgReader->GetOutputPort());
  extractor_XY->SetVOI( 0, hdr.dim[1]-1, 0, hdr.dim[2]-1, scroll_Z, scroll_Z);
  extractor_XY->Update();
  global_extrator_XY = extractor_XY;

  //Create its texture
  vtkTexture *texture_XY = vtkTexture::New();
  texture_XY->SetInputConnection(extractor_XY->GetOutputPort());
  texture_XY->InterpolateOn();
  texture_XY->SetLookupTable(grayScaleLookupTable);
  texture_XY->MapColorScalarsThroughLookupTableOn();
  global_ texture_XY = texture_XY;

  //Create a plane for the texture
  vtkPlaneSource *plane_XY = vtkPlaneSource::New();
  plane_XY->SetXResolution(1);
  plane_XY->SetYResolution(1);
  plane_XY->SetOrigin(0.0, 0.0, scroll_Z);
  plane_XY->SetPoint1(hdr.dim[1]-1, 0.0, scroll_Z);
  plane_XY->SetPoint2(0.0, hdr.dim[1]-1, scroll_Z);
  global_plane_XY = plane_XY;

  //Shot it through the pipeline
  vtkPolyDataMapper *mapper_XY = vtkPolyDataMapper::New();
  mapper_XY->SetInputConnection(plane_XY->GetOutputPort());
  mapper_XY->ImmediateModeRenderingOn();
global_mapper_XY = mapper_XY;
  vtkActor *actorSlice_XY = vtkActor::New();
  actorSlice_XY->SetMapper(mapper_XY);
  actorSlice_XY->SetTexture(texture_XY);

and in the callback, I change the "scroll_Z" value, update the global variables, and re-render... Why the hell is it not working?????

Thanks for your comprehension
Ale






       
---------------------------------

---------------------------------
L'email della prossima generazione? Puoi averla con la nuova Yahoo! Mail
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20071011/49a05667/attachment.htm>


More information about the vtkusers mailing list