otb merge requestshttps://gitlab.orfeo-toolbox.org/orfeotoolbox/otb/-/merge_requests2023-06-23T04:54:21Zhttps://gitlab.orfeo-toolbox.org/orfeotoolbox/otb/-/merge_requests/528Support of ITK 5.0 in OTB (wip)2023-06-23T04:54:21ZCédric TraizetSupport of ITK 5.0 in OTB (wip)#### Summary
ITK 5.0 has been [released](https://discourse.itk.org/t/itk-5-0-0-has-been-released/1931) !
This merge request is based on the work done in !194, the original branch ( `cs-si:itk5_preperation`) has been rebased on top of ...#### Summary
ITK 5.0 has been [released](https://discourse.itk.org/t/itk-5-0-0-has-been-released/1931) !
This merge request is based on the work done in !194, the original branch ( `cs-si:itk5_preperation`) has been rebased on top of develop, and additional changes have been made to make the branch compatible with the release.
#### Rationale
See the [ITK 5 migration guidelines](https://github.com/InsightSoftwareConsortium/ITK/blob/master/Documentation/ITK5MigrationGuide.md)
Prior to ITK 5.0, only a subset of C+11 functionality was used, when available, through backports and macros. ITK now requires a C+11 standard compiler. And this get rid of lot of macros. Move to C++11 does not affect OTB since it has already moved to a higher standard (C++14).
Another important API change in ITK is its threading model. This affects OTB , Remote Modules and projects depending on OTB (both official and unofficial) in large scale. This merge request approaches threading model issues between ITK 5.0 and OTB. We had observed a 99% of passing test with our changeset while not breaking compatibility with ITK 4.x.
This MR does not fully cover compatibility yet. There can be classes of filters that are not covered by testing and hence remain un-patched.
Until debian-testing, OpenSUSE, ubuntu and many others pick up the yet-to-release ITK 5.0, it is important to keep support of ITK 4.x. Even though binary packages and superbuild can use alpha version but still a compatibility layer is necessary.
There are several levels of compatibility:
- `ITKV4_COMPATIBILITY=ON` and `ITK_LEGACY_REMOVE=OFF`
- `ITKV4_COMPATIBILITY=OFF` and `ITK_LEGACY_REMOVE=OFF`
- `ITKV4_COMPATIBILITY=OFF` and `ITK_LEGACY_REMOVE=ON`
For now the code compiles with the first level of compatibility, but there are still issues with classes using spatial objects (most tests are failing, and the `SpatialObjectToImageDrawing` test has been commented for now because it doesn't compile). According to the guidelines, I think we should aim for the second level of compatibility, but this implies some additional API changes.
#### Implementation Details
TODO
#### Copyright
The copyright owner is *CNES* and has signed the ORFEO ToolBox Contributor License Agreement.
<hr>
***Check before merging:***
- All discussions are resolved
- At least 2 :thumbsup: votes from core developers, no :thumbsdown: vote.
- The feature branch is (reasonably) up-to-date with the base branch
- Dashboard is green
- Copyright owner has signed the ORFEO ToolBox Contributor License Agreement
- Optionally, run `git diff develop... -U0 --no-color | clang-format-diff.py -p1 -i` on latest changes and commitCédric TraizetCédric Traizet