[vtkusers] vtkMetaImageReader

Jon Haitz Legarreta jhlegarreta at vicomtech.org
Thu Nov 21 08:49:04 EST 2013


Hi Susanne,
the metaimage header should have an NDims field set to 3. You may find the
class reference [1] useful.

HTH,
JON HAITZ

[1] http://www.vtk.org/doc/nightly/html/classvtkMetaImageReader.html#details



On 21 November 2013 14:34, Susanne Schmalkalt <Susanne.Schmalkalt at gmx.de>wrote:

> 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
>
> _______________________________________________
> Powered by www.kitware.com
>
> Visit other Kitware open-source projects at
> http://www.kitware.com/opensource/opensource.html
>
> Please keep messages on-topic and check the VTK FAQ at:
> http://www.vtk.org/Wiki/VTK_FAQ
>
> Follow this link to subscribe/unsubscribe:
> http://www.vtk.org/mailman/listinfo/vtkusers
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20131121/fae4e7df/attachment.htm>


More information about the vtkusers mailing list