Plugin Reader Based on Another Plugin

(Theodore Baltis) #1

Hello. I have built a Python-based reader plugin that works just fine for a single file.
It’s actually the reader I asked for help with here

But now I would like to use it to open a series of files. I’ve been attempting to use a simple XML-based plugin to create a vtkFileSeriesReader that references my single-file reader. This second plugin loads fine, but when used to open a file (or file series) it crashes because the SetFileName method of the underlying reader is never called.

The FileSeriesReader XML:

<ServerManagerConfiguration>
  <ProxyGroup name="sources">
    <SourceProxy class="vtkFileSeriesReader"
                 file_name_method="SetFileName"
                 label="My XDMF Reader Series"
                 name="MyXDMFReaderSeries"
                 si_class="vtkSIMetaReaderProxy">
      <Documentation long_help="Read Lagrangian XDMF data set from from a xmf dataset."
                     short_help="Read Lagrangian XDMF data set from from a xmf dataset.">
                     This XDMF reader loads data stored in xmf format. The 
                     output of this reader is a XDMF Dataset
                     dataset.</Documentation>
      <SubProxy>
        <!-- proxygroup="internal_sources" -->
        <Proxy name="Reader"
               proxygroup="sources"
               proxyname="MyXDMFReader"></Proxy>
        <ExposedProperties>
        </ExposedProperties>
      </SubProxy>
      <StringVectorProperty animateable="0"
                            clean_command="RemoveAllFileNames"
                            command="AddFileName"
                            name="FileName"
                            number_of_elements="0"
                            panel_visibility="default"
                            repeat_command="1">
        <FileListDomain name="files" />
        <Documentation>The list of files to be read by the 
        reader.</Documentation>
      </StringVectorProperty>
      <DoubleVectorProperty information_only="1"
                            name="TimestepValues"
                            repeatable="1">
        <TimeStepsInformationHelper />
        <Documentation>Available timestep values.</Documentation>
      </DoubleVectorProperty>
      <Hints>
        <ReaderFactory extensions="xmf"
                       file_description="Lagrangian Files" />
      </Hints>
    </SourceProxy>
  </ProxyGroup>
</ServerManagerConfiguration>

Perhaps the first question should be: Is it even possible to create a plugin that references another plugin? The above XML seems to pick up the previously loaded plugin just fine, as I can see references to it in the error, as seen below:

ERROR: In /home/shelf1/compile/visualization/src/paraview/5.6.0_gui/VTK/IO/Xdmf2/vtkXdmfReader.cxx, line 200
vtkXdmfReader (0x558a02db6ae0): Error opening file None

ERROR: In /home/shelf1/compile/visualization/src/paraview/5.6.0_gui/VTK/Common/ExecutionModel/vtkExecutive.cxx, line 782
vtkCompositeDataPipeline (0x558a02db5a00): Algorithm vtkXdmfReader(0x558a02db6ae0) returned failure for request: vtkInformation (0x558a02c709f0)
  Debug: Off
  Modified Time: 849987
  Reference Count: 1
  Registered Events: (none)
  Request: REQUEST_DATA_OBJECT
  ALGORITHM_AFTER_FORWARD: 1
  FORWARD_DIRECTION: 0

So if there is no issue with my general approach, what am I missing from this XML plugin?

Thanks,
Ted

(Theodore Baltis) #2

Perhaps an alternative approach is to modify my base reader to itself use the vtkFileSeriesReader class?

(Mathieu Westphal (Kitware)) #3

You should use the FileSeries only in the xml side, like you have done in the code you shown.
Hard to say why it doesn’t work without testing it, you may want to take a look into the already working reader that uses the FileSeries in ParaView.

the XMLPolyDataReader come to mind.