I wrote my own reader plugin, which can reader data from a file successfully
However, I also add some options on the UI to control how to convert raw data into vtk data, but these control option have nothing with raw data, if these options changed, we only need to change the “convert process”, not necessarily read data again.
But after I change these option on UI and click “Apply” button again, the process will call “RequestData”, which have to read data again.
My question what is the best practice in my situation?
How can I avoid unnecessary data reading?
Thanks and Best Regards,
Use a cache for the raw data in your reader.
You may want to have multiple level of cache as well as internal vtkMTimeType variable to keep track of which cache is invalidated or not when changing an option.
How can i distinguish it is data file changed or only “data convert option” change?
For the first case, I need read file again, while for the second case i only need do “convert” again?
Any existing example in paraview?
As I said, you have to use your own vtkMTimeType variable in your class.
Take a look into
Filters/OpenTurns/vtkOTDensityMap.cxx, it’s not a reader but it uses three level of caches, the concept is the same.
Thank you for your prompt answers!
You could cache the data you are reading in the reader object, and only read new data if the data is not cached.
This way, you could use the data in memory (if its there) and only change the conversion process when a parameter changes.
Hope this helps,
Thank you Dan for your reply!
This is helpful!