Page MenuHomePhabricator

[ModelFit] More efficient pixel based fitting when masks are used
Closed, WontfixPublic

Description

Status: Currently we use the old multithread filter infrastructure of itk 4.x. This is inefficient when we fit on an image and using a mask, because most of the threads will idle arround sooner then later because, the have nothing to do (no mask). This is due to the fact that the whole image is tiled and distributed. When a mask is given it makes more sense to just tile the region that is realy covered by the mask. The rest of the image can be just with a default N/A values.

This should be tackeled as soon we have migrated to itk 5 (T27437). Then we should also check, how we could use the now threading functionalities because they are not necessarily bound to the old region tiling schema anymore.

Related Objects

Event Timeline

floca triaged this task as Normal priority.May 22 2020, 10:13 PM
floca created this task.
floca added a project: Restricted Project.

After rethinking the problem, I have come to the conclusion that there is a simplier straight forward solution that does not need to wait for ITK v5 and maybe new features.

It could be solved the following way:

  1. Rework the itk::MultiOutputNaryFunctorImageFilter
    • filter should alllow also mask that are a subgeometry of the input(s)
    • Override generate output to
      • 1 If no mask is set or Mask geometry equals input geometry -> use default implementation
      • 2. If mask is a subgeometry of input, 1) graft the outputs, 2) fill everything with 0., 3) take the region of the mask and pass it to the region splitter, the rest should be like in the default implementation.
  1. Rework the Pixelbased generator class.
    • the generator should use the auto crop filter on the mask to reduce it to minimal possible size befor passing it to the itk filter.

This combined will only thread over the minimal region covered by the mask, which should substentially boost the performances for small mask use cases.

@kompan @thomass I added you to let you know, in case performance is still an issue in your supported projects. Let me know.

kislinsk added a project: Auto-closed.
kislinsk added a subscriber: kislinsk.

Hi there! 🙂

This task was auto-closed according to our Task Lifecycle Management.
Please follow this link for more information and don't forget that you are encouraged to reasonable re-open tasks to revive them. 🚑

Best wishes,
The MITK devs