I am glad to announce that after a few force-pushes, the pull request to add Eigen3 as an internal third party module is ready for review.
Kudos to @matt.mccormick @jcfr and @bpaniagua for the support !
-
Introduce Eigen3 as an internal ThirdParty module. It allows remote modules to use
find_package(Eigen3)
where Eigen3_DIR points to the internal ITK. This is convenient for modules bridging with third parties modules that are using Eigen, so they do not have to change the third party reference to the Eigen targetEigen3::Eigen
. One instance of such a module is ITKTotalVariation, that aims to bring total variation regularization (denoising) bridging the third-party library proxTV -
The first use of Eigen3 is in
itkSymmetricEigenAnalysis.h.
A flagm_UseEigenLibrary
is added to allow using Eigen3 with aEigen::Matrix<TValue, Dynamic, Dynamic>
(where the size is unknown at compile time).
Also another class in the same header has been added: SymmetricEigenAnalysisFixedDimension
, that allows usage of Eigen::Matrix<TValue, Dimension, Dimension>
that performs optimized computations.
Current tests have been expanded to exercise the added features.
- Performance test:
Using this image, and this example --modifying the SymmetricEigenAnalysis there accordingly–
with the command
for i in {1..10}; do ./BoneEnhancementExamples ~/Data/BoneEnhancement/001-CT.nii ~/Data/BoneEnhancement/out_preprocessed.nrrd ~/Data/BoneEnhancement/out_measure.nrrd 0 0 3 2 2 2; done
Results:
Eigen FixedDimension: 40.19
Old -const netlib-: 48.12
Eigen Dynamic: 57.10
Which is around 16%
faster when using the fixed dimension.
- Classes that have been modified to use the faster SymmetricEigenAnalysisFixedDimension:
Modules/Core/Common/include/itkSymmetricSecondRankTensor.h
Modules/Filtering/ImageFeature/include/itkHessian3DToVesselnessMeasureImageFilter.h
Modules/Filtering/ImageFeature/include/itkHessianToObjectnessMeasureImageFilter.hxx
Modules/Registration/Common/include/itkLandmarkBasedTransformInitializer.hxx
Beyond the shown usage for computing eigenvalues, Eigen3 would allow ITK to reach and bridge with more existing algorithms.