[vtkusers] interactive volume slicing

Alessio Balzide mail_di_ale at yahoo.it
Thu Oct 11 04:55:51 EDT 2007


sorry, forget my previous post..
I just found the solution:

for whoever could be interested, this is my working :) callback:

void callback(vtkObject *caller, unsigned long event_id, void *clientdata, void *calldata)
{
  vtkRenderWindowInteractor *interactor = static_cast< vtkRenderWindowInteractor* >( clientdata );
  //why is this necessary?
  vtkInteractorStyleUser *style = static_cast< vtkInteractorStyleUser* >( caller ); 
 
  switch( event_id ){
    case vtkCommand::CharEvent:
      switch( style->GetChar() ){
        case 'h':
          scroll_Z=scroll_Z+10;
          global_XYslice->SetDisplayExtent(0,127, 0,127, scroll_Z,scroll_Z);
          g_win->Render();
        break; 
      }
    break;
  }
}

thanks anyway..



Alessio Balzide <mail_di_ale at yahoo.it> ha scritto: 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_______________________________________________
This is the private VTK discussion list. 
Please keep messages on-topic. Check the FAQ at: http://www.vtk.org/Wiki/VTK_FAQ
Follow this link to subscribe/unsubscribe:
http://www.vtk.org/mailman/listinfo/vtkusers


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

---------------------------------
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/8196b26e/attachment.htm>


More information about the vtkusers mailing list