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?
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?
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.