[vtkusers] Save a 3D in a series of PNG images (reconstruction possible)

Matthieu Duvinage matthieu.duvinage at gmail.com
Sat Dec 13 05:40:35 EST 2008


Hi everybody,

In fact, I need to save a thresholded data in PNG files. For example, the
threshold data is given below, and I need to store this data into PNG files
and to be able to reconstruct the Vol data only thanks to these PNG files. I
have noticed that vtkPNGWriter is able to write 3D images but I don't have a
set of PNG files when I tried it. Moreover, the image I get is a black PNG
file.
 Do you have an idea ?
The other goal is to use PNG files from another application and to be able
to reconstruct the overall data and to render it. I suppose that the use of
vtkPNGreader allows this ?

Thanks

Matthieu

(avec vtkImageVOLReader* Vol = vtkImageVOLReader::New();)

vtkImageThreshold *mon_tre = vtkImageThreshold::New();
    mon_tre->SetInput(Vol->GetOutput());
    mon_tre->ThresholdByUpper(1300);
    mon_tre->SetInValue(0);
    mon_tre->SetOutValue(255);
    //mon_tre->ReplaceOutOff();
    //mon_tre->ReplaceInOn();
    mon_tre->Update();

vtkPNGWriter *writer=vtkPNGWriter::New();
    //w2i->SetInput(renWin);
    writer->SetInput(mon_tre->GetOutput());
    char *wfname=(char *)malloc(sizeof(char)*25);
    sprintf(wfname,"koursky2.png");

    writer->SetFileName(wfname);
    //renWin->Render();
    //w2i->Update();
    writer->Write();
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20081213/7ebd42b1/attachment.htm>


More information about the vtkusers mailing list