[vtkusers] vtkMetaImageReader

Adrian Gabriel Adrian.Gabriel at 4plus.de
Thu Nov 21 10:48:08 EST 2013


Hi Susi,
 
if I remember right, this is only an vtkImageActor isse, as the
metaImageReader handles the ZDim value in the mhd/mha headers
correctly.
 
Try using vtkImageSliceMapper instead of vtkImageActor (
http://www.vtk.org/Wiki/VTK/Examples/Cxx/Images/ImageSliceMapper )
 
Best regards
Adrian


--
Adrian Gabriel
Software Developer
4plus GmbH
Am Weichselgarten 36
D-91058 Erlangen
 
Tel.: +49-(0)9131-812928-919
E-Mail: adrian.gabriel at 4plus.de
Web: http://www.4plus.de 


>>> "Susanne Schmalkalt" <Susanne.Schmalkalt at gmx.de> 21.11.2013 14:34
>>>
Hallo,
 
I'm trying to read a 3d binary image (.mhd or .mha) via
vtkMetaImageReader. But the output is only 2d. How can I tell the
fileReader that my image has 3 dimensions?
 
That's my code:
 
 
 vtkSmartPointer<vtkMetaImageReader> fileReader=
    vtkSmartPointer<vtkMetaImageReader>::New();
 fileReader->SetFileName(filename);    
  fileReader->Update();
  // Visualize
  vtkSmartPointer<vtkImageActor> actor =
    vtkSmartPointer<vtkImageActor>::New();
  actor->GetMapper()->SetInputConnection(fileReader->GetOutputPort());
 
  vtkSmartPointer<vtkRenderer> renderer =
    vtkSmartPointer<vtkRenderer>::New();
  renderer->AddActor(actor);
  renderer->ResetCamera();
 
  vtkSmartPointer<vtkRenderWindow> renderWindow =
    vtkSmartPointer<vtkRenderWindow>::New();
  renderWindow->AddRenderer(renderer);
 
  vtkSmartPointer<vtkRenderWindowInteractor> renderWindowInteractor =
    vtkSmartPointer<vtkRenderWindowInteractor>::New();
  vtkSmartPointer<vtkInteractorStyleImage> style =
    vtkSmartPointer<vtkInteractorStyleImage>::New();
 
  renderWindowInteractor->SetInteractorStyle(style);
 
  renderWindowInteractor->SetRenderWindow(renderWindow);
  renderWindowInteractor->Initialize();
 
  renderWindowInteractor->Start();
 
Thanks!
Susi

4 Plus Gesellschaft für Software- und Hardwareentwicklung mbH;
Geschäftsführer: Hans Janschitz, Karl Kapp, Tibor Takàcs;
Sitz der Gesellschaft: Erlangen
Registergericht: Fürth, Nr. B7288
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20131121/e09e0e53/attachment.htm>


More information about the vtkusers mailing list