[vtkusers] save a volume view as a MetaImage file

Stéphane CALANDE scalande at gmail.com
Thu Jan 15 10:00:18 EST 2009


Thank you very much Kevin,

It is exactly what I need !


Best regards,


Stéphane



2009/1/15 Kevin H. Hobbs <hobbsk at ohiou.edu>

> On Thursday 15 January 2009 06:55:32 Stéphane CALANDE wrote:
> > Hi vtk users,
> >
> >
> > I'm doing volume rendering but I would like to save a view into a
> MetaImage
> > file.
> >
> > I don't know exactly which input I have to give to the meta image writer.
> >
> > Can you help me ?
> >
>
> It sounds like you are trying to save a 2D image of what you see on the
> screen. You need something like :
>
>        // Renderer
>        vtkRenderer * renderer = vtkRenderer::New();
>        renderer->AddVolume( volume );
>
>        // Render Window
>        vtkRenderWindow * render_window = vtkRenderWindow::New();
>        render_window->AddRenderer( renderer );
>
>        // Window to Image
>        vtkWindowToImageFilter * win_2_image
>                = vtkWindowToImageFilter::New();
>        win_2_image->SetInputBufferTypeToRGBA();
>        win_2_image->SetInput( render_window );
>
>        // PNG Writer
>        vtkPNGWriter * writer = vtkPNGWriter::New();
>        writer->SetFileName( out_file_name );
>        writer->SetInputConnection( win_2_image->GetOutputPort() );
>
>        render_window->Render();
>
>        writer->Write();
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20090115/55d08318/attachment.htm>


More information about the vtkusers mailing list