[vtkusers] vtkExtractVOI extract a image

liuy liuyang at fimmu.com
Thu Aug 11 22:12:51 EDT 2005


Hi,
  I  use vtkExtractVOI to extract a image,code as follows:

vtkVolume16Reader *reader=vtkVolume16Reader::New();
 reader->SetFilePrefix("c:\\too\\too");
 reader->SetDataSpacing(1,1,1.5);
 reader->SetDataDimensions(512,512);
 reader->SetDataByteOrderToLittleEndian();
 reader->SetImageRange(1,100);
 
vtkExtractVOI *voi=vtkExtractVOI::New();
      voi->SetInput(reader->GetOutput());
      voi->SetVOI(0,400,0,400,10,10);
vtkImageMapper *mapper=vtkImageMapper::New();
    mapper->SetInput(voi->GetOutput()); 
   

  vtkActor2D *actor=vtkActor2D::New();
   actor->SetMapper(mapper);

  vtkRenderer *render=vtkRenderer::New();
  render->AddActor(actor);
        
  vtkRenderWindow *renwin=vtkRenderWindow::New();
    renwin->AddRenderer(render);
       renwin->SetSize(800,600);
    
 
    vtkCamera *aCamera = vtkCamera :: New();
     aCamera->SetViewUp (0, 0, -1);
       aCamera->SetPosition (0, 1, 0);
       aCamera->SetFocalPoint (0, 0, 0);
       aCamera->ComputeViewPlaneNormal();
    
vtkRenderWindowInteractor *iren=vtkRenderWindowInteractor::New();
       iren->SetRenderWindow(renwin);
       iren->Initialize();
 
 render->SetActiveCamera(aCamera);
 render->ResetCamera();   
 render->Render();
    iren->Start();

but when 5th parameter of setVOI is not 0,such as 10 or 5 etc,i can't display the image .I don't know what's the problem.

Thanks.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20050812/72080b20/attachment.htm>


More information about the vtkusers mailing list