# What possibilities do I have with vtk to catch errors?

**URL:** https://discourse.vtk.org/t/what-possibilities-do-i-have-with-vtk-to-catch-errors/4453
**Category:** Support
**Created:** [October 20, 2020, 11:22am UTC](https://discourse.vtk.org/t/what-possibilities-do-i-have-with-vtk-to-catch-errors/4453 "2020-10-20T11:22:39Z")
**Posts on this page:** 8
**Page:** 1

<div class="post-metadata">

### Author: ![Daniel](https://discourse.vtk.org/letter_avatar_proxy/v4/letter/d/3ec8ea/32.png) [@Daniel](https://discourse.vtk.org/u/Daniel)
#### Post date: [October 20, 2020, 11:22am UTC](https://discourse.vtk.org/t/what-possibilities-do-i-have-with-vtk-to-catch-errors/4453/1 "2020-10-20T11:22:39Z")

</div>

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!

---

<div class="post-metadata">

### Author: ![Paulo\_Carvalho](https://discourse.vtk.org/user_avatar/discourse.vtk.org/paulo_carvalho/32/370_2.png) [@Paulo\_Carvalho](https://discourse.vtk.org/u/Paulo_Carvalho)
#### Post date: [October 20, 2020, 5:17pm UTC](https://discourse.vtk.org/t/what-possibilities-do-i-have-with-vtk-to-catch-errors/4453/2 "2020-10-20T17:17:46Z")

</div>

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

---

<div class="post-metadata">

### Author: ![Daniel](https://discourse.vtk.org/letter_avatar_proxy/v4/letter/d/3ec8ea/32.png) [@Daniel](https://discourse.vtk.org/u/Daniel)
#### Post date: [October 21, 2020, 6:41am UTC](https://discourse.vtk.org/t/what-possibilities-do-i-have-with-vtk-to-catch-errors/4453/3 "2020-10-21T06:41:46Z")

</div>

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

---

<div class="post-metadata">

### Author: ![Paulo\_Carvalho](https://discourse.vtk.org/user_avatar/discourse.vtk.org/paulo_carvalho/32/370_2.png) [@Paulo\_Carvalho](https://discourse.vtk.org/u/Paulo_Carvalho)
#### Post date: [October 21, 2020, 1:11pm UTC](https://discourse.vtk.org/t/what-possibilities-do-i-have-with-vtk-to-catch-errors/4453/4 "2020-10-21T13:11:00Z")

</div>

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?

---

<div class="post-metadata">

### Author: ![Daniel](https://discourse.vtk.org/letter_avatar_proxy/v4/letter/d/3ec8ea/32.png) [@Daniel](https://discourse.vtk.org/u/Daniel)
#### Post date: [October 21, 2020, 1:46pm UTC](https://discourse.vtk.org/t/what-possibilities-do-i-have-with-vtk-to-catch-errors/4453/5 "2020-10-21T13:46:18Z")

</div>

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(); `  
`} `

---

<div class="post-metadata">

### Author: ![Paulo\_Carvalho](https://discourse.vtk.org/user_avatar/discourse.vtk.org/paulo_carvalho/32/370_2.png) [@Paulo\_Carvalho](https://discourse.vtk.org/u/Paulo_Carvalho)
#### Post date: [October 21, 2020, 1:59pm UTC](https://discourse.vtk.org/t/what-possibilities-do-i-have-with-vtk-to-catch-errors/4453/6 "2020-10-21T13:59:43Z")

</div>

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

```auto
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.

---

<div class="post-metadata">

### Author: ![Paulo\_Carvalho](https://discourse.vtk.org/user_avatar/discourse.vtk.org/paulo_carvalho/32/370_2.png) [@Paulo\_Carvalho](https://discourse.vtk.org/u/Paulo_Carvalho)
#### Post date: [October 21, 2020, 2:03pm UTC](https://discourse.vtk.org/t/what-possibilities-do-i-have-with-vtk-to-catch-errors/4453/7 "2020-10-21T14:03:46Z")

</div>

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

---

<div class="post-metadata">

### Author: ![Daniel](https://discourse.vtk.org/letter_avatar_proxy/v4/letter/d/3ec8ea/32.png) [@Daniel](https://discourse.vtk.org/u/Daniel)
#### Post date: [October 21, 2020, 2:19pm UTC](https://discourse.vtk.org/t/what-possibilities-do-i-have-with-vtk-to-catch-errors/4453/8 "2020-10-21T14:19:10Z")

</div>

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