elastix icon indicating copy to clipboard operation
elastix copied to clipboard

ENH: Add `NumberOfThreads` property to itk::TransformixFilter

Open N-Dekker opened this issue 3 years ago • 4 comments
trafficstars

Addressed issue https://github.com/InsightSoftwareConsortium/ITKElastix/issues/163 "No option to set number of threads for Transformix", submitted by Sebastian van der Voort (@svdvoort).

N-Dekker avatar Aug 26 '22 08:08 N-Dekker

Sorry, after submitting this pull request, I started doubting. If TransformixFilter.SetNumberOfThreads is just equivalent to itk.MultiThreaderBase.SetGlobalMaximumNumberOfThreads, I think users should just call the itk.MultiThreaderBase member function directly.

N-Dekker avatar Oct 17 '22 14:10 N-Dekker

@N-Dekker There is a per-instance SetNumberOfWorkUnits on all ProcessObject's. When using ResampleImageFilter directly, for example, this can be set. Ideally, itk::TransformixFilter should expose this interface and pass the value to component classes.

thewtex avatar Oct 17 '22 17:10 thewtex

There is a per-instance SetNumberOfWorkUnits on all ProcessObject's. When using ResampleImageFilter directly, for example, this can be set. Ideally, itk::TransformixFilter should expose this interface and pass the value to component classes.

@thewtex Thanks for the suggestion Matt. I did give it an initial try before, with https://github.com/SuperElastix/elastix/compare/NumberOfWorkUnits It sets the NumberOfWorkUnits for each elastix component that is derived from itk::ProcessObject. However, I have not finished this approach, because it does not really limit the number of threads used by each individual component. The NumberOfWorkUnits is not (yet?) passed to each sub-object of each component. I don't know if it's already worth merging this incomplete commit. If users really want to reduce the number of threads, they should just call itk.MultiThreaderBase.SetGlobalMaximumNumberOfThreads anyway.

N-Dekker avatar Oct 17 '22 18:10 N-Dekker

@N-Dekker that's great, it looks like with some more work to propagate NumberOfWorkUnits to the sub-objects developers will be able to request the number of threads used on a per-filter basis.

thewtex avatar Oct 17 '22 18:10 thewtex