Reading File Series
Overview
One feature we lost in 3.0 is the ability to read and animate file series. The common use cases for file series are:
- Read and animate a series of files. The file format used usually does not support time natively. The user ends up writing one file per time step. The files are named with a certain pattern such as foo_0.vtk, foo_1.vtk etc...
- Read a file series and treat it as time-dependent data, allowing time-aware algorithms such as plot over time, particle tracking etc.
Solution
File Series Reader
vtkFileSeriesReader is a time-aware reader that keeps track of a series of files and delegates the actual reading to an internal reader. It's public API allows addition of files (and possibly a file pattern). Once all files are added, it reports available time steps in RequestInformation(). In RequestUpdateExtent(), it takes the update request, converts it to a file name and sets this file name on the internal reader. Other than these, it forwards all pipeline requests to the internal reader. vtkFileSeriesReader also supports CanReadFile(). It forwards calls to the method to the internal reader if it supports it and returns the result. In order to support different reader types not necessarily with a common reader superclass, the vtkFileSeriesReader uses client/server streams to invoke certain methods on the internal reader.
In order to add a file series reader, you have to define 2 proxies. The first one is a proxy for the internal reader defined as usual. I will be putting these in an internal_sources group. Second, you have to define a FileSeriesReaderProxy that has a Reader sub-proxy pointing to the internal reader. This is the proxy that is exposed to the GUI. vtkSMFileSeriesReaderProxy is a pretty simple class. All it does is to call SetReader on the vtkFileSeriesReader with the internal reader.