[Paraview-developers] How can I get a proper vtk reader class from a filename with extension

Utkarsh Ayachit utkarsh.ayachit at kitware.com
Tue Jan 17 16:54:51 EST 2017


In all honestly, this is not easy to pull off. Readers in VTK don't have
consistent API, as a result it's going to be very tricky to expose
properties on this new meta-reader that can work across all readers.

The problem you're specifically facing is that readers like PNGReader (and
several others) use meta-readers themselves to support things that the
original reader doesn't support e.g. reader file series. Also,
`vtkSMReaderFactory::GetReaderName` returns the name for the reader proxy,
not the class name for the reader.

Utkarsh

On Tue, Jan 17, 2017 at 11:30 AM, Jonathan Borduas <
jonathan.borduas at caboma.com> wrote:

> Hi Paraviewers,
>
>
>
> Got a bit of a challenge here.
>
>
>
> I’m trying to create a plugin with a custom reader, that is subclass of a
> vtkMetaReader, so it can read any file via readers registered with
> ParaView.
>
>
>
> All the implementations I saw use a If statement:
>
>
>
> https://github.com/Kitware/ParaView/blob/b41d27999a4ac854f4a0e61d98d09c
> 53e7583a60/ParaViewCore/ClientServerCore/Default/vtkNetworkImageSource.cxx
>
>
>
> But I would like to have something in sync with the available readers.
>
>
>
> For now I use something similar to:
>
>
>
> const char *readerName = readerFactory->GetReaderName();
> vtkObject *object = vtkObjectFactory::CreateInstance( readerName );[image:
> https://www.upwork.com/messages/rooms/room_38bea0513672a1d805f45ad03c83519e]
>
>
>
> But for a .PNG file I receive as readerName “vtkImageFileSeriesReader”
> instead of "vtkPNGReader".
>
>
>
> So basically my question is:
>
>
>
> How can I get a proper vtk reader class from a filename with extension?
>
> Thank you very much,
>
>
>
> Jonathan Borduas
>
> CTO, Caboma Inc.
>
> _______________________________________________
> Powered by www.kitware.com
>
> Visit other Kitware open-source projects at http://www.kitware.com/
> opensource/opensource.html
>
> Search the list archives at: http://markmail.org/search/?q=
> Paraview-developers
>
> Follow this link to subscribe/unsubscribe:
> http://public.kitware.com/mailman/listinfo/paraview-developers
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/paraview-developers/attachments/20170117/921258a3/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: image001.png
Type: image/png
Size: 174 bytes
Desc: not available
URL: <http://public.kitware.com/pipermail/paraview-developers/attachments/20170117/921258a3/attachment.png>


More information about the Paraview-developers mailing list