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!