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

Jonathan Borduas jonathan.borduas at caboma.com
Wed Jan 18 11:00:57 EST 2017


Thank you Utkarsh for your answer.

We choose a IF Statement implementation for now.

Jonathan


From: Utkarsh Ayachit [mailto:utkarsh.ayachit at kitware.com]
Sent: Tuesday, January 17, 2017 4:55 PM
To: Jonathan Borduas <jonathan.borduas at caboma.com>
Cc: paraview-developers at paraview.org
Subject: Re: [Paraview-developers] How can I get a proper vtk reader class from a filename with extension

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<mailto: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/b41d27999a4ac854f4a0e61d98d09c53e7583a60/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 );[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<http://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/20170118/360bcc93/attachment-0001.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: image001.png
Type: image/png
Size: 174 bytes
Desc: image001.png
URL: <http://public.kitware.com/pipermail/paraview-developers/attachments/20170118/360bcc93/attachment-0001.png>


More information about the Paraview-developers mailing list