[Paraview] Custom plugin reader with time series

Dominik Szczerba domi at vision.ee.ethz.ch
Mon May 12 15:46:12 EDT 2008


OK after a longer try and error session I finally figured it out. Here 
is what was not clear to me from the Wiki:

Your old working time unaware reader (vtkMyReader) is moved from 
'sources' to 'internal_sources', as in the Wiki. But you need to rename 
it to something else, like vtkMyReaderCore, while name the NEW time 
aware reader (class="vtkFileSeriesReader" in FileSeriesReaderProxy) as 
vtkMyReader (original name). Then GUI xml needs not be changed, neither 
cmake input, and loading time series works at the least expense. 
Alternatively you can name the new reader with a new name, but then you 
need to change the GUI xml, a little longer way.

Thanks,

Dominik

Dominik Szczerba wrote:
> I followed the Wiki and moved my reader to internal_sources, and added 
> corresponding entry to 'sources' with
> 
> <SubProxy>
> <Proxy name="Reader" proxygroup="internal_sources" 
> proxyname="vtkHDF5ImageReader">
> </Proxy>
> </SubProxy>
> 
> (the rest copy/paste from the original readers.xml)
> 
> Now opening my files in PV results in:
> 
> ERROR: In 
> /scratch/domel/src/ParaView3-cvs-20080505/Servers/ServerManager/vtkSMProxyManager.cxx, 
> line 329
> vtkSMProxyManager (0x81882e8): No proxy that matches: group=sources and 
> proxy=vtkHDF5ImageReader were found.
> 
> Failed to create proxy:  "sources" ,  "vtkHDF5ImageReader"
> Error opening file
> 
> Of course, it is now in internal_sources! What have I missed?
> I tried manipulating the cmake input or gui xml to now success.
> 
> Thanks and regards -- Dominik
> 
> 
> Berk Geveci wrote:
>> http://www.vtk.org/Wiki/Animating_legacy_VTK_file_series
>>
>> Warning: The implementation may change somewhat in the future.
>>
>> -berk
>>
>> On Sun, May 11, 2008 at 4:31 AM, Dominik Szczerba
>> <domi at vision.ee.ethz.ch> wrote:
>>> OK so this is basically about reading the series myself explicitly. 
>>> But one
>>> thing is not clear to me: I am deriving my readers from 
>>> vtkDataReader, after
>>> UnstructuredGridReader and StructuredPointsReader, who can read time 
>>> series
>>> somehow, so this functionality must be already in somewhere (upstream).
>>> There is no explicit time series handling in those classes and yet they
>>> work, so why mine do not? I can see that you do derive your reader from
>>> vtkUnstructuredGridAlgorithm, and not vtkDataReader, why? I wonder if I
>>> really have to re-implement it and if there is no simpler way to 
>>> achieve the
>>> goal, like taking advantage of some existing functionality.
>>> Thanks, Dominik
>>>
>>> Mike Jackson wrote:
>>>> Take a look at
>>>> <http://titanium.imts.us/viewvc/Task_4/PVDislocation/src/DislocationReaders/vtkPrdsMultiOutDislocationReader.cxx?view=markup> 
>>>>
>>>>  to see how I did a time series reader.
>>>>
>>>> Basically in RequestInformation  you will need to determine the the
>>>> range of times that your data covers, probably by opening each file or
>>>> some other means. Then set
>>>>    double timeRange[2];
>>>>    timeRange[0] = lowestTimeValue
>>>>    timeRange[1] = highesetTimeValue
>>>>    outInfo->Set(vtkStreamingDemandDrivenPipeline::TIME_RANGE(),
>>>> timeRange, 2);
>>>>
>>>> Also, you will need to have the following in your header:
>>>>
>>>>   vtkSetMacro(TimeStep, int);
>>>>   vtkGetMacro(TimeStep, int);
>>>>
>>>>  int GetNumberOfTimeSteps();
>>>>
>>>> Now, down in the RequestData() Method you can get the requested time
>>>> step from the
>>>> pipeline and then open and read the data from the proper data file.
>>>>
>>>> int tsLength =
>>>> outInfo->Length(vtkStreamingDemandDrivenPipeline::TIME_STEPS());
>>>>  double* steps =
>>>> outInfo->Get(vtkStreamingDemandDrivenPipeline::TIME_STEPS());
>>>>  // Check if a particular time was requested.
>>>>  if(outInfo->Has(vtkStreamingDemandDrivenPipeline::UPDATE_TIME_STEPS())) 
>>>>
>>>>  {
>>>>    // Get the requested time step. We only supprt requests of a single
>>>> time
>>>>    // step in this reader right now
>>>>    double *requestedTimeSteps =
>>>> outInfo->Get(vtkStreamingDemandDrivenPipeline::UPDATE_TIME_STEPS());
>>>>    this->TimeValue = requestedTimeSteps[0];
>>>>
>>>>    // find the first time value larger than requested time value
>>>>    // this logic could be improved
>>>>    int cnt = 0;
>>>>    while (cnt < tsLength-1 && steps[cnt] < this->TimeValue)
>>>>      {
>>>>      cnt++;
>>>>      }
>>>>    this->ActualTimeStep = cnt;
>>>>  }
>>>>
>>>>  if (this->TimeStep > -1)
>>>>  {
>>>>    this->ActualTimeStep = this->TimeStep;
>>>>  }
>>>>
>>>>  if (this->ActualTimeStep >= this->TimeStepRange[0] &&
>>>> this->ActualTimeStep <= this->TimeStepRange[1]) {
>>>>    vtkSmartPointer<DislocationReader> reader =
>>>> vtkSmartPointer<DislocationReader>::New();
>>>>    reader->SetFileName(this->FileName);
>>>>    reader->SetTimeStep(this->ActualTimeStep);
>>>>    //reader->SetInformationVector(outputVector);
>>>>    reader->SetFileOffsets(this->FileOffsets);
>>>>    reader->read();
>>>>    vtkUnstructuredGrid* grid;
>>>>    grid = reader->GetDislocations();
>>>>    dislocations->ShallowCopy(grid);
>>>>
>>>>   // dislocations->SetBlock(0, grid);    // Block 0 is the Dislocation
>>>> Data
>>>>    grid = reader->GetSimulationBox();
>>>>    simBox->ShallowCopy(grid);
>>>>    //dislocations->SetBlock(1, grid); // Block 1 is the Simulation 
>>>> Limits
>>>>  } else {
>>>>      std::cout << "vtkPrdsMultiOutDislocationReader: Timestep was out
>>>> of Range: " << this->ActualTimeStep << std::endl;
>>>>      std::cout << "vtkPrdsMultiOutDislocationReader: Timestep Range:"
>>>> << this->TimeStepRange[0] << " -> " << this->TimeStepRange[1] <<
>>>> std::endl;
>>>>      return 0;
>>>>  }
>>>>
>>>>
>>>> This code is specific to my case where I have a whole separate reader
>>>> for my data where I feed it the name of the file to read and then tell
>>>> it to read the file and get the output. This may also be the case for
>>>> you also.
>>>>
>>>> Hope some of the helps.
>>>>
>>>> Mike
>>>>
>>>> On Sat, May 10, 2008 at 6:03 AM, Dominik Szczerba
>>>> <domi at vision.ee.ethz.ch> wrote:
>>>>> Hi,
>>>>> I have successfully implemented a reader for my data as a PV 
>>>>> plugin. It
>>>>> loads separate files correctly, refuses, however, to read the whole
>>>>> series
>>>>> (file_01.h5, file_02.h5, etc.). How do I go about achieving the same
>>>>> effect
>>>>> as the native readers to have a series as transient data?
>>>>> Thanks for any hints.
>>>>> -- 
>>>>> Dominik Szczerba, Ph.D.
>>>>> Computer Vision Lab CH-8092 Zurich
>>>>> http://www.vision.ee.ethz.ch/~domi
>>>>> _______________________________________________
>>> -- 
>>> Dominik Szczerba, Ph.D.
>>> Computer Vision Lab CH-8092 Zurich
>>> http://www.vision.ee.ethz.ch/~domi
>>> _______________________________________________
>>> ParaView mailing list
>>> ParaView at paraview.org
>>> http://www.paraview.org/mailman/listinfo/paraview
>>>
> 

-- 
Dominik Szczerba, Ph.D.
Computer Vision Lab CH-8092 Zurich
http://www.vision.ee.ethz.ch/~domi


More information about the ParaView mailing list