Multiprocessing LabelMap

Dear ITK community,

I am dealing with LabelMap, where for each label (and corresponding main image) I want to do image operations, say otsu-thresholding and subsequent filtering to obtain a blob (in itself a label - there can be multiple labels). I have made a code which iterates over each label objects to do this, but my image has thousands of labels and with a single thread it takes too long time to be feasible. I wonder whether multi-threading this by distributing labelled objects to separate threads could significantly make it faster. Is there any example that I can refer to build a code that processes individual labelled objects? Or any suggestions what the best way to deal such situation welcome. Thank you for your help.

You could take a look at instances of ParallelizeArray to see how it is invoked. You could also deep dive into one particular refactoring e.g. this one.

1 Like