Accessing Reader Properties From a Programmable Filter

Hello all,

I am reading in a time series dataset through the xdmf reader then manipulating the multi-block dataset in a programmable filter.
The way I manipulate the MBDS is dependent upon the files that make up this time series.

Currently I have a line of code in the programmable filter where I set the directory containing these files.
This programmable filter will eventually be employed by many users on many data sets, so obviously it is not ideal to have to manually set this line of code in every session.

I see that this directory is listed under Properties in the Information panel of the reader.
Is there a way to programmatically access this information from within the programmable filter?
If it makes any difference, the programmable filter directly follows the reader in the pipeline.

If so, the end goal is to build a custom filter/plugin with all of the necessary code baked in.

Accessing this information would be… simple… through the paraview.simple module but I know this doesn’t work within a programmable filter, and as far as I know only VTK information is passed down the ParaView pipeline.

Thank you,
Theodore

The short answer is no. The only connection between the reader and the filter is through the pipeline and the generated data and neither have any standard ways of encoding information like filename in it.

You have a few options:

  1. create a new programmable source/reader that internally does both things, reading using using the Xdmf reader and then doing whatever transformations your current filter does.
  2. have a Python macro that opens the file and create the filter with appropriate parameters set for passing the directory.
  3. create a Prgrammable reader/source that uses Xdmf reader internally but then adds the filename/directory to FieldData in generated output. Now your filter downstream to look for presense of this new field data in its input dataset and then do the needful.

Thanks for your reply Utkarsh.

Option 1 seems like the best option for my situation. However, I’m unsure of how to access the Xdmf reader within the programmable filter framework. Could you point me to a resource that would help me figure this out?

Any searching I’ve done leads back to the Xdmf reader in the paraview.simple module.

Thanks again,
Theodore

# for reader using Xdmf3 library
from paraview.vtk.vtkIOXmdf3 import vtkXdmf3Reader
# or for reader using legacy Xdmf2 library
from paraview.vtk.vtkIOXmdf2 import vtkXdmfReader

Now these are Python wrapped VTK readers, so you can access API documented here and here.

Thank you again, I’ve been able to create the programmable source just as I needed!