Running optimizer in parallel

optimization
registration

(Gordian) #1

Hello,

i have a question regarding parallel optimization. The actual setup is more cpmplex. Therefore I try to simplify.

I have a reference image and multiple other images. I want to register the other images onto the reference image. The transformations are expected to be different (or weakly coupled).
Now I want to run each registration in parallel. This means I need to start multiple instances of optimizers (can be different optimizer types).

If I want to run the optimizers in parallel what would be the best approach?
The ITK offers three Mutlithreading options:
ThreadedGenerateData() -> This seems to be for single images to be splitted and processed .
itk::DomainThreader -> This seems to be the most feasable option.
itk::MultiThreader -> This might also work but with a lot of overhead code.

Have someone done something like this and could provide some insight?

Thanks,
Gordian


(Matt McCormick) #2

Hello Gordian,

The best approach is to use itk::MultiThreaderBase::ParallelizeImageRegion in ITK 5 Beta for the most flexibility, performance, and programming ease. Use a different optimizer instance in each thread because they will need independent optimization states.

HTH,
Matt


(Dženan Zukić) #3

You could also use ParallelizeArray method, so each index of the array corresponds to one moving image.

You could create a vector of file names of moving images, and parallelize over that. And the procedure you might want to run in parallel takes a pointer to the fixed image and a filename string. And that procedure could be just one of the example registration methods.


(Gordian) #4

The ITK i am using is a modified version of ITK-4.13. As far as I can see the functions you mentioned are not available.
Is there a possible replacement or an easy way to introduce the MultiThreaderBase class to 4.13?


(Matt McCormick) #5

@dzenanz is right, and ParallelizeArray is better for this case.

These functions are only available in ITK 5 as a result of a major amount of internal refactoring.