# Imagetovtkimagefilter update() blocks main thread for few seconds

**URL:** https://discourse.itk.org/t/imagetovtkimagefilter-update-blocks-main-thread-for-few-seconds/7429
**Category:** Engineering
**Tags:** itk
**Created:** [February 12, 2025, 6:47pm UTC](https://discourse.itk.org/t/imagetovtkimagefilter-update-blocks-main-thread-for-few-seconds/7429 "2025-02-12T18:47:18Z")
**Posts on this page:** 1
**Page:** 1

<div class="post-metadata">

### Author: ![Manjunath\_AV](https://discourse.itk.org/user_avatar/discourse.itk.org/manjunath_av/32/4461_2.png) [@Manjunath\_AV](https://discourse.itk.org/u/Manjunath_AV)
#### Post date: [February 12, 2025, 6:47pm UTC](https://discourse.itk.org/t/imagetovtkimagefilter-update-blocks-main-thread-for-few-seconds/7429/1 "2025-02-12T18:47:18Z")

</div>

I am working with ITK and VTK to convert an itk::Image to a vtkImageData using the following code:

typedef itk::ImageToVTKImageFilter ConverterType;  
typename ConverterType::Pointer converter = ConverterType::New();  
converter-\>SetInput(image);  
converter-\>Update();  
converter-\>UpdateOutputInformation();

The Update() function is a blocking call, and it takes 2-3 seconds to complete. During this time, my Qt UI freezes because Update() is blocking the main thread, which is responsible for UI rendering.

To solve this, I attempted to move the call to Update() into a separate thread using a QThread and also tried triggering the Update() using a timer. Unfortunately, both approaches resulted in a crash.

Has anyone faced a similar issue or have any recommendations on how to avoid blocking the UI thread? Ideally, I want the image conversion to occur asynchronously without freezing the UI. Any help would be greatly appreciated!
