Page MenuHomePhabricator

Migrate MITK to use ITK 5.x
Closed, ResolvedPublic

Description

MITK should migrate to use the ITK 5.x series. This task is meant to document findings, overall progress etc..

Official migration guide is here: https://github.com/InsightSoftwareConsortium/ITK/blob/master/Documentation/ITK5MigrationGuide.md

TODOs
  • After migration, we should go through all filters that implement ThreadedGenerateData(), to check, if they have a constructor that calls this->DynamicMultiThreadingOff();. Otherwise they should override DynamicThreadedGenerateData() instead.

Revisions and Commits

rMITK MITK
Restricted Differential Revision
Restricted Differential Revision
Restricted Differential Revision
Restricted Differential Revision
Restricted Differential Revision
Restricted Differential Revision
Restricted Differential Revision
Restricted Differential Revision
Restricted Differential Revision
Restricted Differential Revision
Restricted Differential Revision
Restricted Differential Revision
Restricted Differential Revision
Restricted Differential Revision
Restricted Differential Revision
Restricted Differential Revision
Restricted Differential Revision
Restricted Differential Revision
Restricted Differential Revision
Restricted Differential Revision
Restricted Differential Revision
Restricted Differential Revision
Restricted Differential Revision
Restricted Differential Revision
Restricted Differential Revision
Restricted Differential Revision
Restricted Differential Revision
Restricted Differential Revision
Restricted Differential Revision
Restricted Differential Revision
Restricted Differential Revision
Restricted Differential Revision
Restricted Differential Revision
Restricted Differential Revision
Restricted Differential Revision
Restricted Differential Revision
Restricted Differential Revision
Restricted Differential Revision
Restricted Differential Revision
Restricted Differential Revision
Restricted Differential Revision
Restricted Differential Revision
Restricted Differential Revision
Restricted Differential Revision
Restricted Differential Revision
Restricted Differential Revision
Restricted Differential Revision
Restricted Differential Revision
Restricted Differential Revision
Restricted Differential Revision
Restricted Differential Revision

Event Timeline

There are a very large number of changes, so older changes are hidden. Show Older Changes

Is this task finished or if not when is it planned?

Is this task finished or if not when is it planned?

We are currently working on it. Our plan is to finish the migration within the next weeks. It will be part of the next official release in October.

Can this also be matched with this other task I created?

https://phabricator.mitk.org/T28454

Can this also be matched with this other task I created?

https://phabricator.mitk.org/T28454

I only need help in one place if that part is cleared then I already refactored the Core to reflect the changes suitable for version 3.6.0 of CppMicroServices.

I cannot see your task since you set the policies too strict.

Fixed the task policy :D Did you get acces to it ?

Let me know if you got hold of it.

kislinsk added a revision: Restricted Differential Revision.Jun 28 2021, 2:18 PM

I continued migrating MITK. Without explicitly switching on any plugins, the Workbench already compiles and run. Switching on the WorkbenchRelease configuration (without MatchPoint, since I cannot currently compile it because of a compiler bug) compiles as well except for the following two classes which need a rewrite of their multi-threaded implementation, since the ITK base class changed its implementation in that regard:

  • mitk::ExtendedStatisticsImageFilter
  • mitk::ExtendedLabelStatisticsImageFilter

Will not be included in the upcoming release. Very likely will make it into the spring release, though, and we will have a few months time to discover bugs and other odd things after the upgrade if we resolve this task soon after the upcoming release.

Deleted branch from rMITK MITK: feature/T27437-ITK-v5.1.

Deleted branch from rMITK MITK: feature/T27437-migrate-to-ITK-5.

kislinsk added a revision: Restricted Differential Revision.Feb 18 2022, 11:52 AM
  • For the Differential build clients to continue working for both Diffs with and without the ITK v5 migration I had to add a few #if/#else blocks to the MITK-ProjectTemplate to distinguish between ITK v4 and v5. After the migration is merged in MITK, they can be removed again in favor of the ITK v5 adaptions.
Progress on fixed unit tests
  • itkTotalVariationDenoisingImageFilterTest
  • mitkImageStatisticsCalculatorTest
  • mitkImageStatisticsTextureAnalysisTest
  • mitkImageStatisticsHotspotTest_MaxOutsidePeak_10_20_xml
  • mitkImageStatisticsHotspotTest_TwoSegmentations_10_20_xml
  • itkStitchImageFilterTest
  • itkMultiOutputNaryFunctorImageFilterTest
  • itkMaskedStatisticsImageFilterTest
  • itkMaskedNaryStatisticsImageFilterTest
  • mitkPixelBasedParameterFitImageGeneratorTest
  • mitkMaskedDynamicImageStatisticsGeneratorTest

I checked the mitkImageStatisticsCalculatorTest and all tests that fail seem to be related to variance or the standard deviation = sqrt(variance). I double-checked the calculation of variance and it seems to be correct. SInce I get rather big differences to the hard-coded expected values even with a masked image as small as 4 pixels (1x0 + 3x255), I assume for now maybe it is the mask that is different after the migration. The mask is generated from a manually specified planar polygon. I need to write the generated mask to disk from before the migration and compare it with the current mask.

I found the issue: In our old image statistics filters variance was computed as follows:

variance = (sum_of_squares - (sum^2 / count)) / count

However in both ITK and WolframAlpha the divisor is slightly different:

variance = (sum_of_squares - (sum^2 / count)) / (count-1)

So we computed the variance wrong in the past and should adapt the expected values in the unit test.

Deleted branch from rMITK MITK: feature/T27437-ITK-v5.