ParallelizeImageRegion with multiple images?


I am updating my code to ITK 5.0. In particular I’d like to take advantage of the parallelization improvements. However, the examples I’ve seen so far, e.g. only deal with parallelizing over one image. I need to parallelize over multiple images, of different types. What’s the recommended approach to do so? I don’t ParallelizeImageRegion() is really suitable for this?

(If you are interested, I would like to update this beast of a filter: to be a bit more sensible)


1 Like

Replace this by something like this

this->GetMultiThreader()->template ParallelizeImageRegion<OutputImageDimension>(
    [this](const OutputImageRegionType & fullRegion)
      { this->DynamicThreadedGenerateData(outputRegionForThread); }, this);

And rename ThreadedGenerateData into DynamicThreadedGenerateData as per migration guide.

1 Like

Thanks @dzenanz, I think I have something working now. I missed the migration guide when googling earlier.