[ITK-users] Mini-pipeline filters don't obey SetNumberOfThreads()

Joël Schaerer joel.schaerer at laposte.net
Thu Nov 6 05:47:49 EST 2014


Hi all,

I have noticed that a few filters don't give exactly the same output 
depending on the number of threads they are run with. While this is 
unlikely to change results in a meaningful way, it makes things more 
difficult to test and debug since results vary from machine to machine. 
I unfortunately don't have the time to dig deeper into this, but I know 
that the MattesMutualInformationMetric has this problem, and I suspect 
either the NormalizeImageFilter or the MultiResolutionImagePyramid to 
have it too.

This brings me to the second problem, which is that forcing the number 
of threads on mini-pipeline filters such as the NormalizeImageFilter 
doesn't work. That is, calling normalize_filter->SetNumberOfThreads(1) 
doesn't work as expected. The reason is actually pretty simple: the 
filter simply does not pass the information to the filters inside the 
mini-pipeline. I believe most other mini-pipeline filters will have the 
same problem.

Since the mini-pipeline filters are not accessible from outside the 
class, I am left with using 
itk::MultiThreader::SetGlobalMaximumNumberOfThreads which is of course 
not very satisfactory.

I don't see how to fix the problem without calling SetNumberOfThreads on 
each mini-pipline filter... Hopefully someone will have a better idea!

Joel


More information about the Insight-users mailing list