[vtkusers] Reading standard image types

Jim Peterson jimcp at cox.net
Sat Oct 16 14:10:58 EDT 2010


David Doria wrote:
> Is there a filter that will read png, jpg, etc images based on their
> file extension (that is, without having to explicitly declare a
> vtkJPEGReader or vtkPNGReader, etc)? If not, would you use it if it
> existed?
>
>   
Does vtkImageReader2Factory fill this bill?

// vtkImageReader2Factory: This class is used to create a vtkImageReader2
// object given a path name to a file.  It calls CanReadFile on all
// available readers until one of them returns true.  The available reader
// list comes from three places.  In the InitializeReaders function of this
// class, built-in VTK classes are added to the list, users can call
// RegisterReader, or users can create a vtkObjectFactory that has
// CreateObject method that returns a new vtkImageReader2 sub class when
// given the string "vtkImageReaderObject".  This way applications can be
// extended with new readers via a plugin dll or by calling RegisterReader.
// Of course all of the readers that are part of the vtk release are made
// automatically available.
//

HTH,
Jim



More information about the vtkusers mailing list