How to use Png Reader to geneate ImageData

Hi. I am new to VTK and I am wondering as to how I can generate Image Data after using png reader. Any form of help would be appreciated. Thanks!

There’s an example for this here :

This example sets up a pipeline to read the file and pass the output directly to a viewer. If you need to get the actual vtkImageData you can extract it as follows (I work mostly in Python so the following C++ may not be correct…)

// This is from the exmple
vtkSmartPointer<vtkPNGReader> reader =

vtkSmartPointer<vtkImageData> imageData;

imageData = reader->GetOutput()