What possibilities do I have with vtk to catch errors?

Hi there,

i am currently developing a small Java program on Windows.
It uses a slider, which draws the respective visible layer by an ImageData-Object.
Every time the slider is changed, the layer of a vtkImageSlice is reset and updated. Afterwards my panel (vtkCanvas) is repainted.
After several slide changes the following error messages appear and sometimes the program crashes.

(40.429s) [ ] vtkExecutive.cxx:780 ERR| vtkCompositeDataPipeline (0000000037EB5460): UpdateInformation invoked during another request. Returning failure to algorithm vtkImageResliceMapper(000000005FA71230).

How can I generally react to errors with vtk? or How can I fix this error?
What possibilities do I have with vtk to catch errors?

Any hint is welcome!

Is it a VTK slider or a Java/Swing slider?

It is a Java component, more precisely a JavaFX component (Slider).

So, without the code, I guess the change event is firing too fast, and thus requesting algorithm recalculations too often, for the VTK pipeline to handle. Perhaps you could get the pointer to the vtkAlgorithm with a call to vtkExecutive::getAlgorithm() and query whether it’s finished with vtkAlgorithm::getProgress(). Can you post de code of the slider’s update event?

Checking if a process is finished would be very helpful. But how do you do that with vtk and java? Specially for longer operations, like importing imagedatas.

Anyway, here is the code snippet:
public void onSliderChanged() {
double[] o = imgResliceMapper.GetSlicePlane().GetOrigin();
imgResliceMapper.GetSlicePlane().SetOrigin(slider.getValue(), o[1], o[2]);
imageSlice.Update();
canvas.repaint();
}

vtkImageResliceMapper is a vtkAlgorithm. Try monitoring the number returned by imgResliceMapper.GetProgress() to avoid overwhelming VTK with frequent updates:

public void onSliderChanged() {
    double[] o = imgResliceMapper.GetSlicePlane().GetOrigin();
    imgResliceMapper.GetSlicePlane().SetOrigin(slider.getValue(), o[1], o[2]);
    imageSlice.Update();
    while(  imgResliceMapper.GetProgress() < MAX_PROGRESS )
    {
          ; 
    }
    canvas.repaint();
} 

I’ve never used GetProgress() myself nor the documentation explains it. So, you have to discover which value translates to computation completed (e.g. printing the value returned) for the MAX_PROGRESS constant.

Of course the code above assumes the computation inside vtkImageResliceMapper takes place in another thread.

I will try it and report later.
Thanks for your time.