[Paraview] Python VTK readers

Berk Geveci berk.geveci at kitware.com
Tue Dec 1 06:56:16 EST 2009


> Suppose I have a filter that can process only a limited set of file types: I
> would like to test the actual type of a file before applying the filter, so
> I try this:
>
>   data = reader.GetDataInformation()
>   data.IsA("vtkImageData")
>
> which actually returns always 0, so I probably did not use the right method.

Try

di.GetDataSetTypeAsString() == 'vtkImageData'

-berk

On Tue, Dec 1, 2009 at 4:24 AM, Fred Fred <stan1313 at hotmail.fr> wrote:
>> Date: Mon, 30 Nov 2009 13:01:24 -0500
>> Subject: Re: [Paraview] Python VTK readers
>> From: utkarsh.ayachit at kitware.com
>> To: stan1313 at hotmail.fr
>> CC: paraview at paraview.org
>>
>> >   - reading legacy VTK files?
>> It's called "LegacyVTKReader"
>
> Ok it works but there is a mistake in this page:
> http://paraview.org/OnlineHelpCurrent/LegacyVTKFileReader.html
> since the name of the class is mentionned as "LegacyVTKFileReader"
>
>> >   - reading any VTK file? I mean a general VTK file reader able to call
>> > the
>> > appropriate reader, such as vtkDataSetReader in Tcl
>>
>> The equivalent of vtkDataSetReader is indeed the "LegacyVTKReader".
>
> Right
>
>> >   - some way to just read the header of a file and get the dataset type,
>> > in
>> > order to check if the file type is appropriate for a given processing
>> > task?
>>
>> How to plan on checking if the file type is appropriate? Not sure what
>> you are trying to do here.
>
> Suppose I have a filter that can process only a limited set of file types: I
> would like to test the actual type of a file before applying the filter, so
> I try this:
>
>   data = reader.GetDataInformation()
>   data.IsA("vtkImageData")
>
> which actually returns always 0, so I probably did not use the right method.
>
>> Utkarsh
>
> ________________________________
> PC, téléphones portables, souris hi-tech. à gagner grâce à Hotmail ! C'est
> ici !
> _______________________________________________
> Powered by www.kitware.com
>
> Visit other Kitware open-source projects at
> http://www.kitware.com/opensource/opensource.html
>
> Please keep messages on-topic and check the ParaView Wiki at:
> http://paraview.org/Wiki/ParaView
>
> Follow this link to subscribe/unsubscribe:
> http://www.paraview.org/mailman/listinfo/paraview
>
>


More information about the ParaView mailing list