diff --git a/Documentation/Doxygen/BridgeNumerics.dox b/Documentation/Doxygen/BridgeNumerics.dox new file mode 100644 index 00000000000..280b5097bfa --- /dev/null +++ b/Documentation/Doxygen/BridgeNumerics.dox @@ -0,0 +1,57 @@ +/** + \page BridgeNumericsPage The itk::bridge Numerics Namespace + + \section BridgeNumericsIntent Intent + + \c itk::bridge holds convenience wrappers over third-party numerical + solvers, currently Eigen. They exist to ease the initial migration of code + away from the deprecated VNL algorithms: a call site that used + \c vnl_svd can be moved to \c itk::bridge::Math::SVD as a mechanical, + low-risk edit, without the caller first learning Eigen's API. + + \section BridgeNumericsNotCore Not part of the core ITK mission + + These are a migration aid, not a numerics library. ITK does not undertake to + maintain, validate, optimize, or preserve the API or ABI of anything in + \c itk::bridge to the standard it applies to the rest of the toolkit. + Specifically: + + \li The interfaces may change or be removed between releases without the + deprecation cycle that core ITK API changes receive. + \li The numerical behavior is that of the underlying backend. ITK does not + independently validate accuracy, conditioning, or convergence, and does + not guarantee bit-for-bit stability across backend versions. + \li Coverage is limited to what ITK's own migration needed. Absent + functionality will not necessarily be added. + + \section BridgeNumericsDownstream Guidance for downstream users + + \b Prefer \b calling \b Eigen \b directly. Downstream projects should depend + on Eigen (or another numerical library of their choosing) rather than on the + API or ABI of these convenience wrappers. Using \c itk::bridge as a + transitional step while retiring VNL is reasonable; treating it as a + permanent dependency is not. + + Code that needs a long-lived, supported numerical interface should call the + backend directly, where the API contract, versioning policy, and + documentation are those of the numerical library itself. + + \sa itk::bridge::Math::SVD + \sa itk::bridge::SymmetricEigenDecomposition +*/ + +/** + \namespace itk::bridge + \brief Convenience wrappers over third-party numerical backends, provided as + a migration aid rather than as supported ITK API. + + Anything in this namespace eases the initial move off the deprecated VNL + algorithms. It is not part of the core ITK mission to maintain or validate: + the API and ABI may change without the usual deprecation cycle, and the + numerical behavior is the backend's, not ITK's. + + Downstream users should prefer calling Eigen (or another numerical library) + directly rather than depending on these wrappers. + + \see \ref BridgeNumericsPage +*/ diff --git a/Documentation/docs/migration_guides/itk_6_migration_guide.md b/Documentation/docs/migration_guides/itk_6_migration_guide.md index 28da7130ca5..997b90ee51b 100644 --- a/Documentation/docs/migration_guides/itk_6_migration_guide.md +++ b/Documentation/docs/migration_guides/itk_6_migration_guide.md @@ -751,26 +751,51 @@ removed. The default (non-FFTW) FFT backend is now PocketFFT - `vnl_fft_prime_factors`, `gpfa`-family symbols, and the vxl `vnl_algo_test_fft*`/`test_convolve` tests are gone from the vendored tree. +## The `itk::bridge` namespace: a migration aid, not supported ITK API + +The Eigen-backed replacements named throughout this guide live in +`itk::bridge`. That namespace holds **convenience wrappers intended to ease the +initial burden of moving off the deprecated VNL algorithms** — a `vnl_svd` call +site can become `itk::bridge::Math::SVD` as a mechanical edit, without the +caller first learning Eigen's API. + +These wrappers are **not part of the core ITK mission to maintain or validate**: + +- The API and ABI may change, or be removed, without the deprecation cycle that + core ITK API changes receive. +- The numerical behavior is the backend's. ITK does not independently validate + accuracy, conditioning, or convergence, and does not guarantee bit-for-bit + stability across backend versions. +- Coverage extends only to what ITK's own migration required; missing + functionality will not necessarily be added. + +**Downstream users should prefer depending on Eigen (or another numerical +library) directly** rather than on the API/ABI of these wrappers. Using +`itk::bridge` as a transitional step while retiring VNL is reasonable; treating +it as a permanent dependency is not. Code that needs a long-lived, supported +numerical interface should call the backend directly, where the API contract, +versioning policy, and documentation are the numerical library's own. + ## Eigen-backed eigendecompositions replace netlib EISPACK `vnl_*_eigensystem` `vnl_real_eigensystem`, `vnl_symmetric_eigensystem`, and `vnl_generalized_eigensystem` (netlib EISPACK `rg`/`rs`/`rsg`), and the only other client `vnl_scatter_3x3`, are deprecated in favor of Eigen-backed -`itk::RealEigenDecomposition`, `itk::SymmetricEigenDecomposition`, and -`itk::GeneralizedEigenDecomposition`. Under `ITK_FUTURE_LEGACY_REMOVE` these +`itk::bridge::RealEigenDecomposition`, `itk::bridge::SymmetricEigenDecomposition`, and +`itk::bridge::GeneralizedEigenDecomposition`. Under `ITK_FUTURE_LEGACY_REMOVE` these classes and the entire `v3p/netlib/eispack/` subdirectory are excluded from the build. ### What you need to do -- Replace `vnl_symmetric_eigensystem` with `itk::SymmetricEigenDecomposition` +- Replace `vnl_symmetric_eigensystem` with `itk::bridge::SymmetricEigenDecomposition` (it mirrors the `V`/`D` members and `get_eigenvector`/`get_eigenvalue` accessors, so most call sites change only the type name and the include: - `itkSymmetricEigenDecomposition.h`). Use `itk::RealEigenDecomposition` and - `itk::GeneralizedEigenDecomposition` for the non-symmetric and + `itkBridgeSymmetricEigenDecomposition.h`). Use `itk::bridge::RealEigenDecomposition` and + `itk::bridge::GeneralizedEigenDecomposition` for the non-symmetric and symmetric-definite generalized problems. - For the eigenvalues/eigenvectors of a 3x3 scatter matrix, build the matrix - directly and feed `itk::SymmetricEigenDecomposition`. + directly and feed `itk::bridge::SymmetricEigenDecomposition`. ### A different correct representation — not a regression @@ -800,14 +825,14 @@ representation of the same result, not an indication of a failure.** Update such expected values to the new (now platform-stable) representatives; the migrated ITK tests have been updated this way. -## Optional Eigen-backed `itk::Math::SVD` +## Optional Eigen-backed `itk::bridge::Math::SVD` -A new opt-in, header-only `itk::Math::SVD` (`itkMathSVD.h`) provides an +A new opt-in, header-only `itk::bridge::Math::SVD` (`itkBridgeMathSVD.h`) provides an Eigen-backed singular value decomposition. It returns `U`, `W`, `V` as vnl types plus `PseudoInverse()`, `Solve()`, `Rank()` and `Recompose()` -- the dominant `vnl_svd` operations. `vnl_svd` is unchanged by this addition, but the direction is to -migrate ITK and downstream code onto `itk::Math::SVD` and ultimately **deprecate -and remove** the `vnl_svd` path. Prefer `itk::Math::SVD` in new code. +migrate ITK and downstream code onto `itk::bridge::Math::SVD` and ultimately **deprecate +and remove** the `vnl_svd` path. Prefer `itk::bridge::Math::SVD` in new code. A runtime-sized `vnl_matrix` of any shape is accepted: square inputs take a fast JacobiSVD/BDCSVD path; rectangular inputs use BDCSVD with thin U/V (`U` is m x k, @@ -818,7 +843,7 @@ signature. ### What you need to do -Nothing is required immediately, but prefer `itk::Math::SVD` in new code. The +Nothing is required immediately, but prefer `itk::bridge::Math::SVD` in new code. The `vnl_svd`-only operations (`nullvector`, `well_condition`, `singularities`) have no remaining callers in ITK, so the new API already covers every ITK use; the few remaining `vnl_svd` call sites are slated for migration as part of the broader @@ -854,7 +879,7 @@ accuracy. ### Deterministic signs -- a different correct representation -Like the eigendecomposition classes above, `itk::Math::SVD` canonicalizes the +Like the eigendecomposition classes above, `itk::bridge::Math::SVD` canonicalizes the singular-vector signs by default (reproducible across platforms and SIMD width), whereas `vnl_svd`'s signs depend on solver internals. Sign-invariant operations -- `U * V^T`, `PseudoInverse()`, `Solve()` -- are stable across the swap; code that diff --git a/Examples/RegistrationITKv4/ImageRegistration9.cxx b/Examples/RegistrationITKv4/ImageRegistration9.cxx index 83fcf1828eb..2635cdb06da 100644 --- a/Examples/RegistrationITKv4/ImageRegistration9.cxx +++ b/Examples/RegistrationITKv4/ImageRegistration9.cxx @@ -73,7 +73,7 @@ // that will monitor the evolution of the registration process. // #include "itkCommand.h" -#include "itkMathSVD.h" +#include "itkBridgeMathSVD.h" class CommandIterationUpdate : public itk::Command { public: @@ -113,7 +113,7 @@ class CommandIterationUpdate : public itk::Command p[0][1] = static_cast(optimizer->GetCurrentPosition()[1]); p[1][0] = static_cast(optimizer->GetCurrentPosition()[2]); p[1][1] = static_cast(optimizer->GetCurrentPosition()[3]); - const auto svd = itk::Math::SVD(p); + const auto svd = itk::bridge::Math::SVD(p); vnl_matrix r(2, 2); r = svd.U * svd.V.transpose(); const double angle = std::asin(r[1][0]); @@ -412,7 +412,7 @@ main(int argc, char * argv[]) p[0][1] = static_cast(finalParameters[1]); p[1][0] = static_cast(finalParameters[2]); p[1][1] = static_cast(finalParameters[3]); - const auto svd = itk::Math::SVD(p); + const auto svd = itk::bridge::Math::SVD(p); vnl_matrix r(2, 2); r = svd.U * svd.V.transpose(); const double angle = std::asin(r[1][0]); diff --git a/Modules/Core/Common/include/itkCholeskySolve.h b/Modules/Core/Common/include/itkBridgeCholeskySolve.h similarity index 95% rename from Modules/Core/Common/include/itkCholeskySolve.h rename to Modules/Core/Common/include/itkBridgeCholeskySolve.h index 89db9e9b074..172f602d12f 100644 --- a/Modules/Core/Common/include/itkCholeskySolve.h +++ b/Modules/Core/Common/include/itkBridgeCholeskySolve.h @@ -15,8 +15,8 @@ * limitations under the License. * *=========================================================================*/ -#ifndef itkCholeskySolve_h -#define itkCholeskySolve_h +#ifndef itkBridgeCholeskySolve_h +#define itkBridgeCholeskySolve_h #include "itkMacro.h" #include "vnl/vnl_matrix.h" @@ -24,7 +24,7 @@ #include "itk_eigen.h" #include ITK_EIGEN(Dense) -namespace itk +namespace itk::bridge { namespace Math { @@ -85,6 +85,6 @@ CholeskyLowerTriangle(const vnl_matrix & A) } } // namespace Math -} // namespace itk +} // namespace itk::bridge -#endif // itkCholeskySolve_h +#endif // itkBridgeCholeskySolve_h diff --git a/Modules/Core/Common/include/itkEigenDecompositionSignConvention.h b/Modules/Core/Common/include/itkBridgeEigenDecompositionSignConvention.h similarity index 92% rename from Modules/Core/Common/include/itkEigenDecompositionSignConvention.h rename to Modules/Core/Common/include/itkBridgeEigenDecompositionSignConvention.h index c4d5c7158e7..0173e6cc5af 100644 --- a/Modules/Core/Common/include/itkEigenDecompositionSignConvention.h +++ b/Modules/Core/Common/include/itkBridgeEigenDecompositionSignConvention.h @@ -15,13 +15,13 @@ * limitations under the License. * *=========================================================================*/ -#ifndef itkEigenDecompositionSignConvention_h -#define itkEigenDecompositionSignConvention_h +#ifndef itkBridgeEigenDecompositionSignConvention_h +#define itkBridgeEigenDecompositionSignConvention_h #include "vnl/vnl_matrix.h" #include -namespace itk::detail +namespace itk::bridge::detail { /** Canonicalize the sign of every eigenvector column of \a V so that its @@ -90,6 +90,6 @@ CanonicalizeColumnSignsPaired(TMatrixU & u, TMatrixV & paired) } } -} // namespace itk::detail +} // namespace itk::bridge::detail -#endif // itkEigenDecompositionSignConvention_h +#endif // itkBridgeEigenDecompositionSignConvention_h diff --git a/Modules/Core/Common/include/itkEigenDecompositionSolverInfo.h b/Modules/Core/Common/include/itkBridgeEigenDecompositionSolverInfo.h similarity index 87% rename from Modules/Core/Common/include/itkEigenDecompositionSolverInfo.h rename to Modules/Core/Common/include/itkBridgeEigenDecompositionSolverInfo.h index c7e19c0eb24..2bb4950c274 100644 --- a/Modules/Core/Common/include/itkEigenDecompositionSolverInfo.h +++ b/Modules/Core/Common/include/itkBridgeEigenDecompositionSolverInfo.h @@ -15,13 +15,13 @@ * limitations under the License. * *=========================================================================*/ -#ifndef itkEigenDecompositionSolverInfo_h -#define itkEigenDecompositionSolverInfo_h +#ifndef itkBridgeEigenDecompositionSolverInfo_h +#define itkBridgeEigenDecompositionSolverInfo_h #include "itk_eigen.h" #include ITK_EIGEN(Dense) -namespace itk::detail +namespace itk::bridge::detail { /** Human-readable name and likely cause for an Eigen solver status, so a @@ -43,6 +43,6 @@ EigenComputationInfoString(Eigen::ComputationInfo info) return "an unrecognized Eigen::ComputationInfo value"; } -} // namespace itk::detail +} // namespace itk::bridge::detail -#endif // itkEigenDecompositionSolverInfo_h +#endif // itkBridgeEigenDecompositionSolverInfo_h diff --git a/Modules/Core/Common/include/itkGeneralizedEigenDecomposition.h b/Modules/Core/Common/include/itkBridgeGeneralizedEigenDecomposition.h similarity index 92% rename from Modules/Core/Common/include/itkGeneralizedEigenDecomposition.h rename to Modules/Core/Common/include/itkBridgeGeneralizedEigenDecomposition.h index 1161641d32d..ff668a397bf 100644 --- a/Modules/Core/Common/include/itkGeneralizedEigenDecomposition.h +++ b/Modules/Core/Common/include/itkBridgeGeneralizedEigenDecomposition.h @@ -15,18 +15,18 @@ * limitations under the License. * *=========================================================================*/ -#ifndef itkGeneralizedEigenDecomposition_h -#define itkGeneralizedEigenDecomposition_h +#ifndef itkBridgeGeneralizedEigenDecomposition_h +#define itkBridgeGeneralizedEigenDecomposition_h #include "vnl/vnl_matrix.h" #include "vnl/vnl_vector.h" -#include "itkEigenDecompositionSignConvention.h" -#include "itkEigenDecompositionSolverInfo.h" +#include "itkBridgeEigenDecompositionSignConvention.h" +#include "itkBridgeEigenDecompositionSolverInfo.h" #include "itkMacro.h" #include "itk_eigen.h" #include ITK_EIGEN(Dense) -namespace itk +namespace itk::bridge { /** \class GeneralizedEigenDecomposition @@ -105,6 +105,6 @@ class GeneralizedEigenDecomposition MatrixType m_Eigenvectors; }; -} // namespace itk +} // namespace itk::bridge -#endif // itkGeneralizedEigenDecomposition_h +#endif // itkBridgeGeneralizedEigenDecomposition_h diff --git a/Modules/Core/Common/include/itkMathDeterminant.h b/Modules/Core/Common/include/itkBridgeMathDeterminant.h similarity index 93% rename from Modules/Core/Common/include/itkMathDeterminant.h rename to Modules/Core/Common/include/itkBridgeMathDeterminant.h index 83db69055bd..33eb7e1b0e5 100644 --- a/Modules/Core/Common/include/itkMathDeterminant.h +++ b/Modules/Core/Common/include/itkBridgeMathDeterminant.h @@ -15,8 +15,8 @@ * limitations under the License. * *=========================================================================*/ -#ifndef itkMathDeterminant_h -#define itkMathDeterminant_h +#ifndef itkBridgeMathDeterminant_h +#define itkBridgeMathDeterminant_h #include "itkMacro.h" #include "vnl/vnl_matrix.h" @@ -31,7 +31,10 @@ namespace itk // with itkMatrix.h; its body instantiates only where itk::Matrix is complete. template class Matrix; +} // namespace itk +namespace itk::bridge +{ namespace Math { namespace detail @@ -104,7 +107,7 @@ Determinant(const vnl_matrix & A) const unsigned int rows = A.rows(); if (rows != A.cols()) { - itkGenericExceptionMacro("itk::Math::Determinant requires a square matrix."); + itkGenericExceptionMacro("itk::bridge::Math::Determinant requires a square matrix."); } return detail::DynamicDeterminantEigen(A.data_block(), rows); } @@ -121,6 +124,6 @@ Determinant(const vnl_matrix_fixed & A) } } // namespace Math -} // namespace itk +} // namespace itk::bridge -#endif // itkMathDeterminant_h +#endif // itkBridgeMathDeterminant_h diff --git a/Modules/Core/Common/include/itkMathLDLT.h b/Modules/Core/Common/include/itkBridgeMathLDLT.h similarity index 85% rename from Modules/Core/Common/include/itkMathLDLT.h rename to Modules/Core/Common/include/itkBridgeMathLDLT.h index 2d37372b348..f76e41f4673 100644 --- a/Modules/Core/Common/include/itkMathLDLT.h +++ b/Modules/Core/Common/include/itkBridgeMathLDLT.h @@ -15,8 +15,8 @@ * limitations under the License. * *=========================================================================*/ -#ifndef itkMathLDLT_h -#define itkMathLDLT_h +#ifndef itkBridgeMathLDLT_h +#define itkBridgeMathLDLT_h #include "itkMacro.h" #include "itkArray.h" @@ -36,19 +36,19 @@ /** Capability macro. Downstream code selects the Eigen-backed symmetric solve * with, e.g.: * \code - * #if __has_include() - * # include + * #if __has_include() + * # include * #endif - * #ifdef ITK_MATH_HAS_SOLVE_SYMMETRIC - * x = itk::Math::SolveSymmetric(A, b); // itk::Array2D, itk::Array + * #ifdef ITK_BRIDGE_MATH_HAS_SOLVE_SYMMETRIC + * x = itk::bridge::Math::SolveSymmetric(A, b); // itk::Array2D, itk::Array * #else * x = vnl_cholesky(A.as_ref()).solve(b); // legacy vnl fallback * #endif * \endcode */ -#define ITK_MATH_HAS_SOLVE_SYMMETRIC 1 +#define ITK_BRIDGE_MATH_HAS_SOLVE_SYMMETRIC 1 -namespace itk +namespace itk::bridge { namespace Math { @@ -71,7 +71,7 @@ SolveSymmetricLDLTEigen(const TReal * aData, const TReal * bData, unsigned int n const Eigen::LDLT ldlt(aMap); if (ldlt.info() != Eigen::Success) { - itkGenericExceptionMacro("itk::Math::SolveSymmetric failed; input is likely non-finite (NaN/Inf)."); + itkGenericExceptionMacro("itk::bridge::Math::SolveSymmetric failed; input is likely non-finite (NaN/Inf)."); } Eigen::Map(xData, n) = ldlt.solve(bMap); } @@ -93,7 +93,7 @@ SolveSymmetricMatrixLDLTEigen(const TReal * aData, const TReal * bData, unsigned const Eigen::LDLT ldlt(aMap); if (ldlt.info() != Eigen::Success) { - itkGenericExceptionMacro("itk::Math::SolveSymmetric failed; input is likely non-finite (NaN/Inf)."); + itkGenericExceptionMacro("itk::bridge::Math::SolveSymmetric failed; input is likely non-finite (NaN/Inf)."); } Eigen::Map(xData, n, m) = ldlt.solve(bMap); } @@ -112,13 +112,13 @@ InverseSymmetricLDLTEigen(const TReal * aData, unsigned int n, TReal * invData) const Eigen::LDLT ldlt(aMap); if (ldlt.info() != Eigen::Success) { - itkGenericExceptionMacro("itk::Math::InverseSymmetric failed; input is likely non-finite (NaN/Inf)."); + itkGenericExceptionMacro("itk::bridge::Math::InverseSymmetric failed; input is likely non-finite (NaN/Inf)."); } const auto dAbs = ldlt.vectorD().cwiseAbs().eval(); const TReal dMax = dAbs.maxCoeff(); if (dMax == TReal{ 0 } || dAbs.minCoeff() <= dMax * static_cast(n) * std::numeric_limits::epsilon()) { - itkGenericExceptionMacro("itk::Math::InverseSymmetric failed; input matrix is singular."); + itkGenericExceptionMacro("itk::bridge::Math::InverseSymmetric failed; input matrix is singular."); } Eigen::Map(invData, n, n) = ldlt.solve(ColMajor::Identity(n, n)); } @@ -148,7 +148,7 @@ SolveSymmetric(const Array2D & A, const Array & b) const unsigned int n = A.rows(); if (n == 0 || A.cols() != n || b.size() != n) { - itkGenericExceptionMacro("itk::Math::SolveSymmetric requires a non-empty square A and a matching b."); + itkGenericExceptionMacro("itk::bridge::Math::SolveSymmetric requires a non-empty square A and a matching b."); } Array x(n); detail::SolveSymmetricLDLTEigen(A.data_block(), b.data_block(), n, x.data_block()); @@ -179,7 +179,7 @@ SolveSymmetric(const vnl_matrix & A, const vnl_vector & b) const unsigned int n = A.rows(); if (n == 0 || A.cols() != n || b.size() != n) { - itkGenericExceptionMacro("itk::Math::SolveSymmetric requires a non-empty square A and a matching b."); + itkGenericExceptionMacro("itk::bridge::Math::SolveSymmetric requires a non-empty square A and a matching b."); } vnl_vector x(n); detail::SolveSymmetricLDLTEigen(A.data_block(), b.data_block(), n, x.data_block()); @@ -208,7 +208,7 @@ SolveSymmetric(const Array2D & A, const Array2D & B) const unsigned int n = A.rows(); if (n == 0 || A.cols() != n || B.rows() != n) { - itkGenericExceptionMacro("itk::Math::SolveSymmetric requires a non-empty square A and a matching B."); + itkGenericExceptionMacro("itk::bridge::Math::SolveSymmetric requires a non-empty square A and a matching B."); } Array2D X(n, B.cols()); detail::SolveSymmetricMatrixLDLTEigen(A.data_block(), B.data_block(), n, B.cols(), X.data_block()); @@ -231,7 +231,7 @@ InverseSymmetric(const Array2D & A) const unsigned int n = A.rows(); if (n == 0 || A.cols() != n) { - itkGenericExceptionMacro("itk::Math::InverseSymmetric requires a non-empty square A."); + itkGenericExceptionMacro("itk::bridge::Math::InverseSymmetric requires a non-empty square A."); } Array2D inv(n, n); detail::InverseSymmetricLDLTEigen(A.data_block(), n, inv.data_block()); @@ -246,7 +246,7 @@ SolveSymmetric(const vnl_matrix & A, const vnl_matrix & B) const unsigned int n = A.rows(); if (n == 0 || A.cols() != n || B.rows() != n) { - itkGenericExceptionMacro("itk::Math::SolveSymmetric requires a non-empty square A and a matching B."); + itkGenericExceptionMacro("itk::bridge::Math::SolveSymmetric requires a non-empty square A and a matching B."); } vnl_matrix X(n, B.cols()); detail::SolveSymmetricMatrixLDLTEigen(A.data_block(), B.data_block(), n, B.cols(), X.data_block()); @@ -261,7 +261,7 @@ InverseSymmetric(const vnl_matrix & A) const unsigned int n = A.rows(); if (n == 0 || A.cols() != n) { - itkGenericExceptionMacro("itk::Math::InverseSymmetric requires a non-empty square A."); + itkGenericExceptionMacro("itk::bridge::Math::InverseSymmetric requires a non-empty square A."); } vnl_matrix inv(n, n); detail::InverseSymmetricLDLTEigen(A.data_block(), n, inv.data_block()); @@ -269,6 +269,6 @@ InverseSymmetric(const vnl_matrix & A) } } // namespace Math -} // namespace itk +} // namespace itk::bridge -#endif // itkMathLDLT_h +#endif // itkBridgeMathLDLT_h diff --git a/Modules/Core/Common/include/itkMathSVD.h b/Modules/Core/Common/include/itkBridgeMathSVD.h similarity index 95% rename from Modules/Core/Common/include/itkMathSVD.h rename to Modules/Core/Common/include/itkBridgeMathSVD.h index f320e24d413..bbbf87e5d2c 100644 --- a/Modules/Core/Common/include/itkMathSVD.h +++ b/Modules/Core/Common/include/itkBridgeMathSVD.h @@ -15,11 +15,11 @@ * limitations under the License. * *=========================================================================*/ -#ifndef itkMathSVD_h -#define itkMathSVD_h +#ifndef itkBridgeMathSVD_h +#define itkBridgeMathSVD_h #include "itkMacro.h" -#include "itkEigenDecompositionSignConvention.h" +#include "itkBridgeEigenDecompositionSignConvention.h" #include "vnl/vnl_matrix.h" #include "vnl/vnl_matrix_fixed.h" #include "vnl/vnl_vector.h" @@ -33,12 +33,15 @@ namespace itk { -// Forward-declared to break the itkMatrix.h <-> itkMathSVD.h include cycle; the -// itk::Matrix SVD overload needs the complete type only at instantiation, where -// the caller has already included itkMatrix.h. +// Forward-declared to break the itkMatrix.h <-> itkBridgeMathSVD.h include +// cycle; the itk::Matrix SVD overload needs the complete type only at +// instantiation, where the caller has already included itkMatrix.h. template class Matrix; +} // namespace itk +namespace itk::bridge +{ namespace Math { @@ -410,7 +413,7 @@ DynamicSquareSVDEigen(const TReal * inData, unsigned int n, TReal * uData, TReal const auto extract = [&](const auto & svd) { if (svd.info() != Eigen::Success) { - itkGenericExceptionMacro("itk::Math::SVD failed; input is likely non-finite (NaN/Inf)."); + itkGenericExceptionMacro("itk::bridge::Math::SVD failed; input is likely non-finite (NaN/Inf)."); } uMap = svd.matrixU(); vMap = svd.matrixV(); @@ -453,7 +456,7 @@ SquareSVDEigen(const TReal * inData, TReal * uData, TReal * wData, TReal * vData const Eigen::JacobiSVD svd(inMap); if (svd.info() != Eigen::Success) { - itkGenericExceptionMacro("itk::Math::SVD failed; input is likely non-finite (NaN/Inf)."); + itkGenericExceptionMacro("itk::bridge::Math::SVD failed; input is likely non-finite (NaN/Inf)."); } Eigen::Map uMap(uData); @@ -488,7 +491,7 @@ RectangularSVDEigen(const TReal * inData, const Eigen::BDCSVD svd(inMap); if (svd.info() != Eigen::Success) { - itkGenericExceptionMacro("itk::Math::SVD failed; input is likely non-finite (NaN/Inf)."); + itkGenericExceptionMacro("itk::bridge::Math::SVD failed; input is likely non-finite (NaN/Inf)."); } Eigen::Map uMap(uData, rows, k); Eigen::Map vMap(vData, cols, k); @@ -504,7 +507,7 @@ RectangularSVDEigen(const TReal * inData, // The Eigen JacobiSVD/BDCSVD instantiations behind the detail engines dominate // compile memory: without pre-instantiation, GCC needs ~2 GB per translation unit // that inverts an itk::Matrix. Declare the common specializations extern and define -// them once in itkMathSVD.cxx so consumers link instead of re-instantiating them. +// them once in itkBridgeMathSVD.cxx so consumers link instead of re-instantiating them. #if defined(ITKCommon_EXPORTS) # define ITKCommon_EXPORT_EXPLICIT ITK_TEMPLATE_EXPORT #else @@ -577,7 +580,7 @@ SVD(const vnl_matrix_fixed & A, bool canonicalizeSigns = true detail::SquareSVDEigen(A.data_block(), result.U.data_block(), result.W.data_block(), result.V.data_block()); if (canonicalizeSigns) { - itk::detail::CanonicalizeColumnSignsPaired(result.U, result.V); + itk::bridge::detail::CanonicalizeColumnSignsPaired(result.U, result.V); } return result; } @@ -602,7 +605,7 @@ SVD(const vnl_matrix_fixed & A, bool canonicalizeSigns = tr A.data_block(), VRows, VCols, result.U.data_block(), result.W.data_block(), result.V.data_block()); if (canonicalizeSigns) { - itk::detail::CanonicalizeColumnSignsPaired(result.U, result.V); + itk::bridge::detail::CanonicalizeColumnSignsPaired(result.U, result.V); } return result; } @@ -626,7 +629,7 @@ SVD(const vnl_matrix & A, bool canonicalizeSigns = true) const unsigned int cols = A.cols(); if (rows == 0 || cols == 0) { - itkGenericExceptionMacro("itk::Math::SVD requires a non-empty matrix."); + itkGenericExceptionMacro("itk::bridge::Math::SVD requires a non-empty matrix."); } const unsigned int k = (rows < cols) ? rows : cols; SVDResult result; @@ -645,12 +648,12 @@ SVD(const vnl_matrix & A, bool canonicalizeSigns = true) } if (canonicalizeSigns) { - itk::detail::CanonicalizeColumnSignsPaired(result.U, result.V); + itk::bridge::detail::CanonicalizeColumnSignsPaired(result.U, result.V); } return result; } } // namespace Math -} // namespace itk +} // namespace itk::bridge -#endif // itkMathSVD_h +#endif // itkBridgeMathSVD_h diff --git a/Modules/Core/Common/include/itkQRDecomposition.h b/Modules/Core/Common/include/itkBridgeQRDecomposition.h similarity index 97% rename from Modules/Core/Common/include/itkQRDecomposition.h rename to Modules/Core/Common/include/itkBridgeQRDecomposition.h index 81728a559ab..68477c97bbd 100644 --- a/Modules/Core/Common/include/itkQRDecomposition.h +++ b/Modules/Core/Common/include/itkBridgeQRDecomposition.h @@ -15,8 +15,8 @@ * limitations under the License. * *=========================================================================*/ -#ifndef itkQRDecomposition_h -#define itkQRDecomposition_h +#ifndef itkBridgeQRDecomposition_h +#define itkBridgeQRDecomposition_h #include "itkMacro.h" #include "vnl/vnl_matrix.h" @@ -24,7 +24,7 @@ #include "itk_eigen.h" #include ITK_EIGEN(Dense) -namespace itk +namespace itk::bridge { /** \class QRDecomposition @@ -165,6 +165,6 @@ class QRDecomposition bool m_Square{ false }; }; -} // namespace itk +} // namespace itk::bridge -#endif // itkQRDecomposition_h +#endif // itkBridgeQRDecomposition_h diff --git a/Modules/Core/Common/include/itkRealEigenDecomposition.h b/Modules/Core/Common/include/itkBridgeRealEigenDecomposition.h similarity index 94% rename from Modules/Core/Common/include/itkRealEigenDecomposition.h rename to Modules/Core/Common/include/itkBridgeRealEigenDecomposition.h index 83081f607e4..4624a661d06 100644 --- a/Modules/Core/Common/include/itkRealEigenDecomposition.h +++ b/Modules/Core/Common/include/itkBridgeRealEigenDecomposition.h @@ -15,18 +15,18 @@ * limitations under the License. * *=========================================================================*/ -#ifndef itkRealEigenDecomposition_h -#define itkRealEigenDecomposition_h +#ifndef itkBridgeRealEigenDecomposition_h +#define itkBridgeRealEigenDecomposition_h #include "vnl/vnl_matrix.h" #include "vnl/vnl_vector.h" #include -#include "itkEigenDecompositionSolverInfo.h" +#include "itkBridgeEigenDecompositionSolverInfo.h" #include "itkMacro.h" #include "itk_eigen.h" #include ITK_EIGEN(Dense) -namespace itk +namespace itk::bridge { /** \class RealEigenDecomposition @@ -98,6 +98,6 @@ class RealEigenDecomposition ComplexMatrixType m_Eigenvectors; }; -} // namespace itk +} // namespace itk::bridge -#endif // itkRealEigenDecomposition_h +#endif // itkBridgeRealEigenDecomposition_h diff --git a/Modules/Core/Common/include/itkSymmetricEigenDecomposition.h b/Modules/Core/Common/include/itkBridgeSymmetricEigenDecomposition.h similarity index 93% rename from Modules/Core/Common/include/itkSymmetricEigenDecomposition.h rename to Modules/Core/Common/include/itkBridgeSymmetricEigenDecomposition.h index 09961602cfd..5c2b569bb93 100644 --- a/Modules/Core/Common/include/itkSymmetricEigenDecomposition.h +++ b/Modules/Core/Common/include/itkBridgeSymmetricEigenDecomposition.h @@ -15,19 +15,19 @@ * limitations under the License. * *=========================================================================*/ -#ifndef itkSymmetricEigenDecomposition_h -#define itkSymmetricEigenDecomposition_h +#ifndef itkBridgeSymmetricEigenDecomposition_h +#define itkBridgeSymmetricEigenDecomposition_h #include "vnl/vnl_matrix.h" #include "vnl/vnl_vector.h" #include "vnl/vnl_diag_matrix.h" -#include "itkEigenDecompositionSignConvention.h" -#include "itkEigenDecompositionSolverInfo.h" +#include "itkBridgeEigenDecompositionSignConvention.h" +#include "itkBridgeEigenDecompositionSolverInfo.h" #include "itkMacro.h" #include "itk_eigen.h" #include ITK_EIGEN(Dense) -namespace itk +namespace itk::bridge { /** \class SymmetricEigenDecomposition @@ -125,6 +125,6 @@ class SymmetricEigenDecomposition } }; -} // namespace itk +} // namespace itk::bridge -#endif // itkSymmetricEigenDecomposition_h +#endif // itkBridgeSymmetricEigenDecomposition_h diff --git a/Modules/Core/Common/include/itkExtractImageFilter.hxx b/Modules/Core/Common/include/itkExtractImageFilter.hxx index c84087f98e5..8e1680da388 100644 --- a/Modules/Core/Common/include/itkExtractImageFilter.hxx +++ b/Modules/Core/Common/include/itkExtractImageFilter.hxx @@ -19,7 +19,7 @@ #define itkExtractImageFilter_hxx #include "itkImageAlgorithm.h" -#include "itkMathDeterminant.h" +#include "itkBridgeMathDeterminant.h" #include "itkObjectFactory.h" #include "itkProgressReporter.h" @@ -194,7 +194,7 @@ ExtractImageFilter::GenerateOutputInformation() break; case DirectionCollapseStrategyEnum::DIRECTIONCOLLAPSETOSUBMATRIX: { - if (Math::Determinant(outputDirection.GetVnlMatrix()) == 0.0) + if (bridge::Math::Determinant(outputDirection.GetVnlMatrix()) == 0.0) { itkExceptionStringMacro("Invalid submatrix extracted for collapsed direction."); } @@ -202,7 +202,7 @@ ExtractImageFilter::GenerateOutputInformation() break; case DirectionCollapseStrategyEnum::DIRECTIONCOLLAPSETOGUESS: { - if (Math::Determinant(outputDirection.GetVnlMatrix()) == 0.0) + if (bridge::Math::Determinant(outputDirection.GetVnlMatrix()) == 0.0) { outputDirection.SetIdentity(); } diff --git a/Modules/Core/Common/include/itkHexahedronCell.hxx b/Modules/Core/Common/include/itkHexahedronCell.hxx index f1ad184b6a7..0a7db1a7321 100644 --- a/Modules/Core/Common/include/itkHexahedronCell.hxx +++ b/Modules/Core/Common/include/itkHexahedronCell.hxx @@ -19,7 +19,7 @@ #define itkHexahedronCell_hxx #include "itkMath.h" #include "vnl/vnl_matrix_fixed.h" -#include "itkMathDeterminant.h" +#include "itkBridgeMathDeterminant.h" #include // For copy_n. @@ -398,7 +398,7 @@ HexahedronCell::EvaluatePosition(CoordinateType * x, } // ONLY 3x3 determinants are supported. - const double d = Math::Determinant(mat); + const double d = bridge::Math::Determinant(mat); // spell-check-disable // d=vtkMath::Determinant3x3(rcol,scol,tcol); // spell-check-enable @@ -431,9 +431,9 @@ HexahedronCell::EvaluatePosition(CoordinateType * x, mat3.put(2, i, fcol[i]); } double params[Self::CellDimension3D]{ 0.5, 0.5, 0.5 }; - pcoords[0] = params[0] - Math::Determinant(mat1) / d; - pcoords[1] = params[1] - Math::Determinant(mat2) / d; - pcoords[2] = params[2] - Math::Determinant(mat3) / d; + pcoords[0] = params[0] - bridge::Math::Determinant(mat1) / d; + pcoords[1] = params[1] - bridge::Math::Determinant(mat2) / d; + pcoords[2] = params[2] - bridge::Math::Determinant(mat3) / d; if (pcoord) { diff --git a/Modules/Core/Common/include/itkImageBase.hxx b/Modules/Core/Common/include/itkImageBase.hxx index 19b480950bd..07c73113d34 100644 --- a/Modules/Core/Common/include/itkImageBase.hxx +++ b/Modules/Core/Common/include/itkImageBase.hxx @@ -34,7 +34,7 @@ #include "itkSpatialOrientation.h" #include #include "itkMath.h" -#include "itkMathDeterminant.h" +#include "itkBridgeMathDeterminant.h" namespace itk { @@ -134,7 +134,7 @@ ImageBase::SetDirection(const DirectionType & direction) { bool modified = false; - if (Math::Determinant(direction.GetVnlMatrix()) == 0.0) + if (bridge::Math::Determinant(direction.GetVnlMatrix()) == 0.0) { itkExceptionMacro("Bad direction, determinant is 0. Refusing to change direction from " << this->m_Direction << " to " << direction); diff --git a/Modules/Core/Common/include/itkMatrix.h b/Modules/Core/Common/include/itkMatrix.h index 0115acd2b1c..3d3ee4f37f7 100644 --- a/Modules/Core/Common/include/itkMatrix.h +++ b/Modules/Core/Common/include/itkMatrix.h @@ -24,10 +24,10 @@ #include #include "vnl/vnl_matrix_fixed.hxx" // Get the templates #include "vnl/vnl_transpose.h" -#include "itkMathSVD.h" +#include "itkBridgeMathSVD.h" #include "vnl/vnl_matrix.h" -// GetInverse is Eigen-backed via itk::Math::SVD, but ITK 5.4 exposed +// GetInverse is Eigen-backed via itk::bridge::Math::SVD, but ITK 5.4 exposed // vnl_matrix_inverse (and through it vnl_svd / vnl_diag_matrix) transitively to // every itkMatrix.h consumer. Retain that surface for release-5.4 source // compatibility in default builds; ITK proper includes what it uses, so @@ -38,8 +38,8 @@ # include "vnl/algo/vnl_matrix_inverse.h" # undef ITK_VNL_SVD_TRANSITIONAL_INCLUDE #endif -#include "itkMathDeterminant.h" -// GetInverse's singular check is Eigen-backed via itk::Math::Determinant, but +#include "itkBridgeMathDeterminant.h" +// GetInverse's singular check is Eigen-backed via itk::bridge::Math::Determinant, but // ITK 5.4 exposed vnl_determinant transitively through this header; keep it // reachable during the deprecation window so downstream code still compiles. #if !defined(ITK_LEGACY_REMOVE) && !defined(ITK_FUTURE_LEGACY_REMOVE) @@ -329,11 +329,11 @@ class ITK_TEMPLATE_EXPORT Matrix [[nodiscard]] inline vnl_matrix_fixed GetInverse() const { - if (Math::Determinant(m_Matrix) == T{}) + if (bridge::Math::Determinant(m_Matrix) == T{}) { itkGenericExceptionMacro("Singular matrix. Determinant is 0."); } - return vnl_matrix_fixed{ Math::SVD(m_Matrix.as_ref()).PseudoInverse() }; + return vnl_matrix_fixed{ bridge::Math::SVD(m_Matrix.as_ref()).PseudoInverse() }; } /** Return the transposed matrix. */ diff --git a/Modules/Core/Common/include/itkQuadrilateralCell.hxx b/Modules/Core/Common/include/itkQuadrilateralCell.hxx index f81eec486d1..febbd51534b 100644 --- a/Modules/Core/Common/include/itkQuadrilateralCell.hxx +++ b/Modules/Core/Common/include/itkQuadrilateralCell.hxx @@ -18,7 +18,7 @@ #ifndef itkQuadrilateralCell_hxx #define itkQuadrilateralCell_hxx #include "itkMath.h" -#include "itkMathDeterminant.h" +#include "itkBridgeMathDeterminant.h" #include // For copy_n. @@ -333,7 +333,7 @@ QuadrilateralCell::EvaluatePosition(CoordinateType * x, mat.put(1, i, scol[i]); } - const double d = Math::Determinant(mat); + const double d = bridge::Math::Determinant(mat); // spell-check-disable // d=vtkMath::Determinant2x2(rcol,scol); // spell-check-enable @@ -356,8 +356,8 @@ QuadrilateralCell::EvaluatePosition(CoordinateType * x, mat2.put(1, i, fcol[i]); } - pcoords[0] = params[0] - Math::Determinant(mat1) / d; - pcoords[1] = params[1] - Math::Determinant(mat2) / d; + pcoords[0] = params[0] - bridge::Math::Determinant(mat1) / d; + pcoords[1] = params[1] - bridge::Math::Determinant(mat2) / d; if (pcoord) { diff --git a/Modules/Core/Common/include/itkTetrahedronCell.hxx b/Modules/Core/Common/include/itkTetrahedronCell.hxx index 816c515b2ae..20814911455 100644 --- a/Modules/Core/Common/include/itkTetrahedronCell.hxx +++ b/Modules/Core/Common/include/itkTetrahedronCell.hxx @@ -17,7 +17,7 @@ *=========================================================================*/ #ifndef itkTetrahedronCell_hxx #define itkTetrahedronCell_hxx -#include "itkMathDeterminant.h" +#include "itkBridgeMathDeterminant.h" #include // For copy_n. @@ -106,7 +106,7 @@ TetrahedronCell::EvaluatePosition(CoordinateType * x, mat.put(1, i, c2[i]); mat.put(2, i, c3[i]); } - const double det = Math::Determinant(mat); + const double det = bridge::Math::Determinant(mat); if (det == 0.0) { return false; @@ -119,7 +119,7 @@ TetrahedronCell::EvaluatePosition(CoordinateType * x, mat.put(2, i, c3[i]); } - pcoords[0] = Math::Determinant(mat) / det; + pcoords[0] = bridge::Math::Determinant(mat) / det; for (unsigned int i = 0; i < PointDimension; ++i) { @@ -128,7 +128,7 @@ TetrahedronCell::EvaluatePosition(CoordinateType * x, mat.put(2, i, c3[i]); } - pcoords[1] = Math::Determinant(mat) / det; + pcoords[1] = bridge::Math::Determinant(mat) / det; for (unsigned int i = 0; i < PointDimension; ++i) { @@ -137,7 +137,7 @@ TetrahedronCell::EvaluatePosition(CoordinateType * x, mat.put(2, i, rhs[i]); } - pcoords[2] = Math::Determinant(mat) / det; + pcoords[2] = bridge::Math::Determinant(mat) / det; const double p4 = 1.0 - pcoords[0] - pcoords[1] - pcoords[2]; diff --git a/Modules/Core/Common/include/itkVariableSizeMatrix.h b/Modules/Core/Common/include/itkVariableSizeMatrix.h index cc421acbb48..469bc7b11c8 100644 --- a/Modules/Core/Common/include/itkVariableSizeMatrix.h +++ b/Modules/Core/Common/include/itkVariableSizeMatrix.h @@ -21,7 +21,7 @@ #include "itkPoint.h" #include "itkCovariantVector.h" #include "vnl/vnl_matrix_fixed.h" -#include "itkMathSVD.h" +#include "itkBridgeMathSVD.h" #if !defined(ITK_LEGACY_REMOVE) && !defined(ITK_FUTURE_LEGACY_REMOVE) # include "vnl/algo/vnl_matrix_inverse.h" // transitional transitive include; dropped on ITK legacy removal #endif @@ -212,7 +212,7 @@ class ITK_TEMPLATE_EXPORT VariableSizeMatrix [[nodiscard]] inline vnl_matrix GetInverse() const { - return itk::Math::SVD(m_Matrix).PseudoInverse(); + return itk::bridge::Math::SVD(m_Matrix).PseudoInverse(); } /** Return the transposed matrix. */ diff --git a/Modules/Core/Common/include/itkVersor.hxx b/Modules/Core/Common/include/itkVersor.hxx index f9f633e9631..09441d14c5a 100644 --- a/Modules/Core/Common/include/itkVersor.hxx +++ b/Modules/Core/Common/include/itkVersor.hxx @@ -20,7 +20,7 @@ #include "itkNumericTraits.h" #include "itkMath.h" -#include "itkMathDeterminant.h" +#include "itkBridgeMathDeterminant.h" namespace itk { @@ -327,12 +327,13 @@ Versor::Set(const MatrixType & mat) itk::Math::Absolute(I[2][0]) > epsilon || itk::Math::Absolute(I[2][1]) > epsilon || itk::Math::Absolute(I[0][0] - itk::NumericTraits::OneValue()) > epsilonDiff || itk::Math::Absolute(I[1][1] - itk::NumericTraits::OneValue()) > epsilonDiff || - itk::Math::Absolute(I[2][2] - itk::NumericTraits::OneValue()) > epsilonDiff || Math::Determinant(I) < 0) + itk::Math::Absolute(I[2][2] - itk::NumericTraits::OneValue()) > epsilonDiff || + bridge::Math::Determinant(I) < 0) { itkGenericExceptionMacro("The following matrix does not represent rotation to within an epsion of " << epsilon << '.' << std::endl << m << std::endl - << "det(m * m transpose) is: " << Math::Determinant(I) << std::endl + << "det(m * m transpose) is: " << bridge::Math::Determinant(I) << std::endl << "m * m transpose is:" << std::endl << I); } diff --git a/Modules/Core/Common/src/CMakeLists.txt b/Modules/Core/Common/src/CMakeLists.txt index bbd24aa41e3..ec86dbdc59c 100644 --- a/Modules/Core/Common/src/CMakeLists.txt +++ b/Modules/Core/Common/src/CMakeLists.txt @@ -95,7 +95,7 @@ set( itkLoggerOutput.cxx itkLoggerThreadWrapper.cxx itkLogOutput.cxx - itkMathSVD.cxx + itkBridgeMathSVD.cxx itkMemoryProbe.cxx itkMemoryProbesCollectorBase.cxx itkMemoryUsageObserver.cxx diff --git a/Modules/Core/Common/src/itkMathSVD.cxx b/Modules/Core/Common/src/itkBridgeMathSVD.cxx similarity index 95% rename from Modules/Core/Common/src/itkMathSVD.cxx rename to Modules/Core/Common/src/itkBridgeMathSVD.cxx index 4e69de406f0..850c27dae7b 100644 --- a/Modules/Core/Common/src/itkMathSVD.cxx +++ b/Modules/Core/Common/src/itkBridgeMathSVD.cxx @@ -15,12 +15,12 @@ * limitations under the License. * *=========================================================================*/ -#include "itkMathSVD.h" +#include "itkBridgeMathSVD.h" -// Define once here the Eigen JacobiSVD/BDCSVD specializations that itkMathSVD.h +// Define once here the Eigen JacobiSVD/BDCSVD specializations that itkBridgeMathSVD.h // declares extern, so consumer translation units link instead of paying the // per-TU Eigen instantiation cost. -namespace itk +namespace itk::bridge { namespace Math { @@ -47,4 +47,4 @@ RectangularSVDEigen(const double *, unsigned int, unsigned int, double * ITK_GCC_PRAGMA_DIAG_POP() } // namespace detail } // namespace Math -} // namespace itk +} // namespace itk::bridge diff --git a/Modules/Core/Common/test/CMakeLists.txt b/Modules/Core/Common/test/CMakeLists.txt index 18e63994a63..6476e2afd94 100644 --- a/Modules/Core/Common/test/CMakeLists.txt +++ b/Modules/Core/Common/test/CMakeLists.txt @@ -1429,7 +1429,7 @@ set( itkBSplineKernelFunctionGTest.cxx itkBuildInformationGTest.cxx itkByteSwapGTest.cxx - itkCholeskySolveGTest.cxx + itkBridgeCholeskySolveGTest.cxx itkCommandObserverObjectGTest.cxx itkCommonTypeTraitsGTest.cxx itkCompensatedSummationGTest.cxx @@ -1484,11 +1484,11 @@ set( itkMathGTest.cxx itkMathRoundGTest.cxx itkMathVnlParityGTest.cxx - itkMathSVDGTest.cxx - itkMathLDLTGTest.cxx + itkBridgeMathSVDGTest.cxx + itkBridgeMathLDLTGTest.cxx itkVnlCholeskyEngineGTest.cxx itkVnlMatlabReadGTest.cxx - itkMathDeterminantGTest.cxx + itkBridgeMathDeterminantGTest.cxx itkVnlSVDEngineGTest.cxx itkMatrixExponentialGTest.cxx itkMatrixGTest.cxx @@ -1508,10 +1508,10 @@ set( itkPointSetGTest.cxx itkPrintHelperGTest.cxx itkPriorityQueueGTest.cxx - itkGeneralizedEigenDecompositionGTest.cxx - itkQRDecompositionGTest.cxx - itkRealEigenDecompositionGTest.cxx - itkSymmetricEigenDecompositionGTest.cxx + itkBridgeGeneralizedEigenDecompositionGTest.cxx + itkBridgeQRDecompositionGTest.cxx + itkBridgeRealEigenDecompositionGTest.cxx + itkBridgeSymmetricEigenDecompositionGTest.cxx itkRealTimeClockGTest.cxx itkRealTimeIntervalGTest.cxx itkRealTimeStampGTest.cxx diff --git a/Modules/Core/Common/test/itkCholeskySolveGTest.cxx b/Modules/Core/Common/test/itkBridgeCholeskySolveGTest.cxx similarity index 83% rename from Modules/Core/Common/test/itkCholeskySolveGTest.cxx rename to Modules/Core/Common/test/itkBridgeCholeskySolveGTest.cxx index d9ea71892ec..3fd9effecb4 100644 --- a/Modules/Core/Common/test/itkCholeskySolveGTest.cxx +++ b/Modules/Core/Common/test/itkBridgeCholeskySolveGTest.cxx @@ -17,7 +17,7 @@ *=========================================================================*/ // First include the header file to be tested: -#include "itkCholeskySolve.h" +#include "itkBridgeCholeskySolve.h" // Exercise the deprecated VNL engine for the old-vs-new equivalence checks. // The VNL symbol is unavailable under ITK_FUTURE_LEGACY_REMOVE. @@ -55,7 +55,7 @@ MakeSPD(unsigned int n) // A x = b is recovered: residual ||A x - b|| is tiny. -TEST(CholeskySolve, SolveResidual) +TEST(BridgeCholeskySolve, SolveResidual) { const unsigned int n = 5; const vnl_matrix A = MakeSPD(n); @@ -65,18 +65,18 @@ TEST(CholeskySolve, SolveResidual) b[i] = static_cast(i) - 1.5; } - const vnl_vector x = itk::Math::SolveSymmetricPositiveDefinite(A, b); + const vnl_vector x = itk::bridge::Math::SolveSymmetricPositiveDefinite(A, b); const vnl_vector residual = A * x - b; EXPECT_LT(residual.two_norm() / b.two_norm(), 1e-12); } // CholeskyLowerTriangle returns L with A == L L'. -TEST(CholeskySolve, LowerTriangleReconstructsMatrix) +TEST(BridgeCholeskySolve, LowerTriangleReconstructsMatrix) { const unsigned int n = 4; const vnl_matrix A = MakeSPD(n); - const vnl_matrix L = itk::Math::CholeskyLowerTriangle(A); + const vnl_matrix L = itk::bridge::Math::CholeskyLowerTriangle(A); // L is lower triangular. for (unsigned int i = 0; i < n; ++i) @@ -94,7 +94,7 @@ TEST(CholeskySolve, LowerTriangleReconstructsMatrix) #ifndef ITK_FUTURE_LEGACY_REMOVE // The Eigen-backed itk:: solve agrees with the native vnl_cholesky engine. -TEST(CholeskySolve, EquivalentToVnlCholesky) +TEST(BridgeCholeskySolve, EquivalentToVnlCholesky) { const unsigned int n = 6; const vnl_matrix A = MakeSPD(n); @@ -104,7 +104,7 @@ TEST(CholeskySolve, EquivalentToVnlCholesky) b[i] = std::cos(0.5 * (i + 1)); } - const vnl_vector xItk = itk::Math::SolveSymmetricPositiveDefinite(A, b); + const vnl_vector xItk = itk::bridge::Math::SolveSymmetricPositiveDefinite(A, b); const vnl_cholesky chol(A, vnl_cholesky::quiet); const vnl_vector xVnl = chol.solve(b); @@ -115,7 +115,7 @@ TEST(CholeskySolve, EquivalentToVnlCholesky) // Single-precision path solves correctly. -TEST(CholeskySolve, FloatResidual) +TEST(BridgeCholeskySolve, FloatResidual) { const unsigned int n = 4; const vnl_matrix A = MakeSPD(n); @@ -125,19 +125,19 @@ TEST(CholeskySolve, FloatResidual) b[i] = static_cast(i) + 0.25f; } - const vnl_vector x = itk::Math::SolveSymmetricPositiveDefinite(A, b); + const vnl_vector x = itk::bridge::Math::SolveSymmetricPositiveDefinite(A, b); const vnl_vector residual = A * x - b; EXPECT_LT(residual.two_norm() / b.two_norm(), 1e-4f); } // CholeskyLowerTriangle rejects a non-positive-definite matrix instead of returning a garbage factor. -TEST(CholeskySolve, LowerTriangleRejectsNonPositiveDefinite) +TEST(BridgeCholeskySolve, LowerTriangleRejectsNonPositiveDefinite) { vnl_matrix A(2, 2); A(0, 0) = 1.0; A(0, 1) = 2.0; A(1, 0) = 2.0; A(1, 1) = 1.0; // symmetric but indefinite (eigenvalues 3, -1) - EXPECT_THROW(itk::Math::CholeskyLowerTriangle(A), itk::ExceptionObject); + EXPECT_THROW(itk::bridge::Math::CholeskyLowerTriangle(A), itk::ExceptionObject); } diff --git a/Modules/Core/Common/test/itkGeneralizedEigenDecompositionGTest.cxx b/Modules/Core/Common/test/itkBridgeGeneralizedEigenDecompositionGTest.cxx similarity index 85% rename from Modules/Core/Common/test/itkGeneralizedEigenDecompositionGTest.cxx rename to Modules/Core/Common/test/itkBridgeGeneralizedEigenDecompositionGTest.cxx index 05cdf584ef7..a5dcccc0e0c 100644 --- a/Modules/Core/Common/test/itkGeneralizedEigenDecompositionGTest.cxx +++ b/Modules/Core/Common/test/itkBridgeGeneralizedEigenDecompositionGTest.cxx @@ -15,7 +15,7 @@ * limitations under the License. * *=========================================================================*/ -#include "itkGeneralizedEigenDecomposition.h" +#include "itkBridgeGeneralizedEigenDecomposition.h" #include "itkConfigure.h" #ifndef ITK_FUTURE_LEGACY_REMOVE # define ITK_LEGACY_TEST @@ -31,9 +31,9 @@ namespace // Frobenius residual of the generalized identity A V == B V D. template TReal -GeneralizedResidual(const vnl_matrix & A, - const vnl_matrix & B, - const itk::GeneralizedEigenDecomposition & ge) +GeneralizedResidual(const vnl_matrix & A, + const vnl_matrix & B, + const itk::bridge::GeneralizedEigenDecomposition & ge) { const vnl_matrix & V = ge.GetEigenvectors(); vnl_matrix D(V.rows(), V.cols(), TReal{ 0 }); @@ -49,7 +49,7 @@ GeneralizedResidual(const vnl_matrix & A, // Scavenged from VXL test_generalized_eigensystem: A x = lambda B x with A // symmetric, B symmetric positive-definite. (Roles match the vnl ctor's // (A, B) order; the VXL test's residual is C V - S V D for gev(C, S).) -TEST(GeneralizedEigenDecomposition, SymmetricDefinitePencil) +TEST(BridgeGeneralizedEigenDecomposition, SymmetricDefinitePencil) { const double Adata[36] = { 30.0000, -3.4273, 13.9254, 13.7049, -2.4446, 20.2380, -3.4273, 13.7049, -2.4446, 1.3659, 3.6702, -0.2282, @@ -67,7 +67,7 @@ TEST(GeneralizedEigenDecomposition, SymmetricDefinitePencil) B(0, 1) = B(1, 0) = 1.0; B(2, 3) = B(3, 2) = -2.0; - const itk::GeneralizedEigenDecomposition ge(A, B); + const itk::bridge::GeneralizedEigenDecomposition ge(A, B); // Eigenvalues are real and ascending. for (unsigned int i = 1; i < 6; ++i) @@ -79,7 +79,7 @@ TEST(GeneralizedEigenDecomposition, SymmetricDefinitePencil) // B = I reduces to the ordinary symmetric eigenproblem; this mirrors how // ImagePCAShapeModelEstimator invokes the solver. -TEST(GeneralizedEigenDecomposition, IdentityPencilMatchesStandard) +TEST(BridgeGeneralizedEigenDecomposition, IdentityPencilMatchesStandard) { vnl_matrix A(3, 3, 0.0); A(0, 0) = 2.0; @@ -94,7 +94,7 @@ TEST(GeneralizedEigenDecomposition, IdentityPencilMatchesStandard) I(i, i) = 1.0; } - const itk::GeneralizedEigenDecomposition ge(A, I); + const itk::bridge::GeneralizedEigenDecomposition ge(A, I); EXPECT_LT(GeneralizedResidual(A, I, ge), 1e-12); // For B = I the eigenvectors are orthonormal: V^T V == I. @@ -108,7 +108,7 @@ TEST(GeneralizedEigenDecomposition, IdentityPencilMatchesStandard) } } -TEST(GeneralizedEigenDecomposition, FloatInstantiation) +TEST(BridgeGeneralizedEigenDecomposition, FloatInstantiation) { vnl_matrix A(2, 2); A(0, 0) = 3.0f; @@ -118,14 +118,14 @@ TEST(GeneralizedEigenDecomposition, FloatInstantiation) B(0, 0) = 2.0f; B(1, 1) = 4.0f; - const itk::GeneralizedEigenDecomposition ge(A, B); + const itk::bridge::GeneralizedEigenDecomposition ge(A, B); EXPECT_LT(GeneralizedResidual(A, B, ge), 1e-5f); } // Non-finite input leaves the Eigen solver in a non-Success state; the wrapper // turns that into an exception so callers do not silently consume a garbage // decomposition. -TEST(GeneralizedEigenDecomposition, NonFiniteInputThrows) +TEST(BridgeGeneralizedEigenDecomposition, NonFiniteInputThrows) { const double nan = std::numeric_limits::quiet_NaN(); vnl_matrix A(2, 2, 0.0); @@ -137,7 +137,7 @@ TEST(GeneralizedEigenDecomposition, NonFiniteInputThrows) B(0, 1) = B(1, 0) = nan; try { - const itk::GeneralizedEigenDecomposition ge(A, B); + const itk::bridge::GeneralizedEigenDecomposition ge(A, B); FAIL() << "expected an exception for non-finite input"; } catch (const itk::ExceptionObject & e) @@ -155,7 +155,7 @@ TEST(GeneralizedEigenDecomposition, NonFiniteInputThrows) #ifndef ITK_FUTURE_LEGACY_REMOVE // Equivalence: the Eigen-backed solver reproduces the eigenvalues of the // deprecated netlib vnl_generalized_eigensystem it replaces (both ascending). -TEST(GeneralizedEigenDecomposition, MatchesDeprecatedVnlEngine) +TEST(BridgeGeneralizedEigenDecomposition, MatchesDeprecatedVnlEngine) { vnl_matrix A(3, 3, 0.0); A(0, 0) = 2.0; @@ -169,8 +169,8 @@ TEST(GeneralizedEigenDecomposition, MatchesDeprecatedVnlEngine) B(2, 2) = 4.0; B(0, 1) = B(1, 0) = 0.5; - const vnl_generalized_eigensystem vnlEngine(A, B); - const itk::GeneralizedEigenDecomposition itkEngine(A, B); + const vnl_generalized_eigensystem vnlEngine(A, B); + const itk::bridge::GeneralizedEigenDecomposition itkEngine(A, B); const vnl_vector vnlEigenvalues = vnlEngine.D.get_diagonal(); const vnl_vector & itkEigenvalues = itkEngine.GetEigenvalues(); diff --git a/Modules/Core/Common/test/itkMathDeterminantGTest.cxx b/Modules/Core/Common/test/itkBridgeMathDeterminantGTest.cxx similarity index 74% rename from Modules/Core/Common/test/itkMathDeterminantGTest.cxx rename to Modules/Core/Common/test/itkBridgeMathDeterminantGTest.cxx index e2f777a9d02..da8d147c5f4 100644 --- a/Modules/Core/Common/test/itkMathDeterminantGTest.cxx +++ b/Modules/Core/Common/test/itkBridgeMathDeterminantGTest.cxx @@ -17,7 +17,7 @@ *=========================================================================*/ // First include the header file to be tested: -#include "itkMathDeterminant.h" +#include "itkBridgeMathDeterminant.h" #include "itkMatrix.h" @@ -52,41 +52,41 @@ FillMatrix(const double src[VDim][VDim]) } // namespace // Closed-form 2x2 reference: ad - bc. -TEST(MathDeterminant, TwoByTwoAnalytic) +TEST(BridgeMathDeterminant, TwoByTwoAnalytic) { const auto A = FillMatrix(kM2); const double expected = kM2[0][0] * kM2[1][1] - kM2[0][1] * kM2[1][0]; - EXPECT_NEAR(itk::Math::Determinant(A), expected, 1e-14); + EXPECT_NEAR(itk::bridge::Math::Determinant(A), expected, 1e-14); } // Closed-form 3x3 reference: cofactor expansion along the first row. -TEST(MathDeterminant, ThreeByThreeAnalytic) +TEST(BridgeMathDeterminant, ThreeByThreeAnalytic) { const auto A = FillMatrix(kM3); const double expected = kM3[0][0] * (kM3[1][1] * kM3[2][2] - kM3[1][2] * kM3[2][1]) - kM3[0][1] * (kM3[1][0] * kM3[2][2] - kM3[1][2] * kM3[2][0]) + kM3[0][2] * (kM3[1][0] * kM3[2][1] - kM3[1][1] * kM3[2][0]); - EXPECT_NEAR(itk::Math::Determinant(A), expected, 1e-14); + EXPECT_NEAR(itk::bridge::Math::Determinant(A), expected, 1e-14); } // The three overloads (itk::Matrix, vnl_matrix_fixed, vnl_matrix) return the // same value for the same data. -TEST(MathDeterminant, OverloadConsistency) +TEST(BridgeMathDeterminant, OverloadConsistency) { const auto A = FillMatrix(kM3); const vnl_matrix_fixed fixedA = A.GetVnlMatrix(); const vnl_matrix dynA = fixedA.as_matrix(); - const double d = itk::Math::Determinant(A); - EXPECT_DOUBLE_EQ(itk::Math::Determinant(fixedA), d); - EXPECT_NEAR(itk::Math::Determinant(dynA), d, 1e-14); + const double d = itk::bridge::Math::Determinant(A); + EXPECT_DOUBLE_EQ(itk::bridge::Math::Determinant(fixedA), d); + EXPECT_NEAR(itk::bridge::Math::Determinant(dynA), d, 1e-14); } // Identity has unit determinant; a diagonal matrix yields the product of its // diagonal; both stress the direct fixed-size path. -TEST(MathDeterminant, IdentityAndDiagonal) +TEST(BridgeMathDeterminant, IdentityAndDiagonal) { - EXPECT_DOUBLE_EQ(itk::Math::Determinant(itk::Matrix::GetIdentity()), 1.0); + EXPECT_DOUBLE_EQ(itk::bridge::Math::Determinant(itk::Matrix::GetIdentity()), 1.0); itk::Matrix D; D.SetIdentity(); @@ -94,11 +94,11 @@ TEST(MathDeterminant, IdentityAndDiagonal) D(1, 1) = -3.0; D(2, 2) = 0.5; D(3, 3) = 4.0; - EXPECT_DOUBLE_EQ(itk::Math::Determinant(D), 2.0 * -3.0 * 0.5 * 4.0); + EXPECT_DOUBLE_EQ(itk::bridge::Math::Determinant(D), 2.0 * -3.0 * 0.5 * 4.0); } // A rank-deficient matrix (two identical rows) has a zero determinant. -TEST(MathDeterminant, SingularIsZero) +TEST(BridgeMathDeterminant, SingularIsZero) { itk::Matrix A; A(0, 0) = 1.0; @@ -110,12 +110,12 @@ TEST(MathDeterminant, SingularIsZero) A(2, 0) = 4.0; A(2, 1) = 5.0; A(2, 2) = 6.0; - EXPECT_NEAR(itk::Math::Determinant(A), 0.0, 1e-14); + EXPECT_NEAR(itk::bridge::Math::Determinant(A), 0.0, 1e-14); } // Upper-triangular determinant is the product of the diagonal; exercises the // runtime PartialPivLU path at a size beyond the direct formulas. -TEST(MathDeterminant, LargeTriangular) +TEST(BridgeMathDeterminant, LargeTriangular) { constexpr unsigned int N = 6; vnl_matrix A(N, N, 0.0); @@ -129,44 +129,44 @@ TEST(MathDeterminant, LargeTriangular) A(i, j) = 0.3 * (i + 1) + 0.7 * j; // upper triangle does not affect det } } - EXPECT_NEAR(itk::Math::Determinant(A), expected, 1e-10 * std::abs(expected)); + EXPECT_NEAR(itk::bridge::Math::Determinant(A), expected, 1e-10 * std::abs(expected)); } // det(cA) = c^n det(A) for an n x n matrix. -TEST(MathDeterminant, ScalingLaw) +TEST(BridgeMathDeterminant, ScalingLaw) { const auto A = FillMatrix(kM3); - const double base = itk::Math::Determinant(A); + const double base = itk::bridge::Math::Determinant(A); itk::Matrix scaled = A * 2.0; - EXPECT_NEAR(itk::Math::Determinant(scaled), 8.0 * base, 1e-13); + EXPECT_NEAR(itk::bridge::Math::Determinant(scaled), 8.0 * base, 1e-13); } // float instantiation computes with float precision. -TEST(MathDeterminant, FloatType) +TEST(BridgeMathDeterminant, FloatType) { const auto A = FillMatrix(kM2); const float expected = static_cast(kM2[0][0] * kM2[1][1] - kM2[0][1] * kM2[1][0]); - EXPECT_NEAR(itk::Math::Determinant(A), expected, 1e-6f); + EXPECT_NEAR(itk::bridge::Math::Determinant(A), expected, 1e-6f); } // A non-square dynamic matrix is a usage error. -TEST(MathDeterminant, NonSquareThrows) +TEST(BridgeMathDeterminant, NonSquareThrows) { const vnl_matrix rect(2, 3, 1.0); - EXPECT_THROW(itk::Math::Determinant(rect), itk::ExceptionObject); + EXPECT_THROW(itk::bridge::Math::Determinant(rect), itk::ExceptionObject); } // Equivalence with the vnl engines being supplemented, on well- and // ill-conditioned inputs, by relative agreement. -TEST(MathDeterminant, MatchesVnl) +TEST(BridgeMathDeterminant, MatchesVnl) { const auto A3 = FillMatrix(kM3); const vnl_matrix_fixed f3 = A3.GetVnlMatrix(); - EXPECT_NEAR(itk::Math::Determinant(A3), vnl_det(f3), 1e-13); + EXPECT_NEAR(itk::bridge::Math::Determinant(A3), vnl_det(f3), 1e-13); const vnl_matrix d3 = f3.as_matrix(); const double ref = vnl_determinant(d3); - EXPECT_NEAR(itk::Math::Determinant(d3), ref, 1e-13 * std::max(1.0, std::abs(ref))); + EXPECT_NEAR(itk::bridge::Math::Determinant(d3), ref, 1e-13 * std::max(1.0, std::abs(ref))); // Ill-conditioned: a scaled Hilbert-like matrix. constexpr unsigned int N = 8; @@ -175,5 +175,5 @@ TEST(MathDeterminant, MatchesVnl) for (unsigned int j = 0; j < N; ++j) H(i, j) = 1.0 / (i + j + 1.0); const double refH = vnl_determinant(H); - EXPECT_NEAR(itk::Math::Determinant(H), refH, 1e-9 * std::max(1.0, std::abs(refH))); + EXPECT_NEAR(itk::bridge::Math::Determinant(H), refH, 1e-9 * std::max(1.0, std::abs(refH))); } diff --git a/Modules/Core/Common/test/itkMathLDLTGTest.cxx b/Modules/Core/Common/test/itkBridgeMathLDLTGTest.cxx similarity index 79% rename from Modules/Core/Common/test/itkMathLDLTGTest.cxx rename to Modules/Core/Common/test/itkBridgeMathLDLTGTest.cxx index b54f18ce5eb..145f366b36f 100644 --- a/Modules/Core/Common/test/itkMathLDLTGTest.cxx +++ b/Modules/Core/Common/test/itkBridgeMathLDLTGTest.cxx @@ -17,7 +17,7 @@ *=========================================================================*/ // First include the header file to be tested: -#include "itkMathLDLT.h" +#include "itkBridgeMathLDLT.h" // Exercise the deprecated VNL engines as cross-check oracles. // They are unavailable under ITK_FUTURE_LEGACY_REMOVE. @@ -55,11 +55,11 @@ MakeSPD(unsigned int n, T shift) } // namespace // The capability macro must be defined by the header. -#ifndef ITK_MATH_HAS_SOLVE_SYMMETRIC -# error "itkMathLDLT.h must define ITK_MATH_HAS_SOLVE_SYMMETRIC" +#ifndef ITK_BRIDGE_MATH_HAS_SOLVE_SYMMETRIC +# error "itkBridgeMathLDLT.h must define ITK_BRIDGE_MATH_HAS_SOLVE_SYMMETRIC" #endif -TEST(MathLDLT, DynamicMatchesVnlCholeskyOnSPD) +TEST(BridgeMathLDLT, DynamicMatchesVnlCholeskyOnSPD) { for (unsigned int n : { 1u, 2u, 3u, 6u, 12u, 20u }) { @@ -70,7 +70,7 @@ TEST(MathLDLT, DynamicMatchesVnlCholeskyOnSPD) b[i] = std::cos(0.3 * i + 1.0); } - const itk::Array x = itk::Math::SolveSymmetric(A, b); + const itk::Array x = itk::bridge::Math::SolveSymmetric(A, b); ASSERT_EQ(x.size(), n); #ifndef ITK_FUTURE_LEGACY_REMOVE // Reference: itk::Array2D / itk::Array upcast to their vnl bases. @@ -86,7 +86,7 @@ TEST(MathLDLT, DynamicMatchesVnlCholeskyOnSPD) } } -TEST(MathLDLT, FixedMatchesDynamic) +TEST(BridgeMathLDLT, FixedMatchesDynamic) { constexpr unsigned int VDim = 4; const itk::Array2D Ad = MakeSPD(VDim, 0.3); @@ -103,8 +103,8 @@ TEST(MathLDLT, FixedMatchesDynamic) bf[i] = bd[i] = std::cos(0.3 * i + 1.0); } - const itk::Vector xf = itk::Math::SolveSymmetric(Af, bf); - const itk::Array xd = itk::Math::SolveSymmetric(Ad, bd); + const itk::Vector xf = itk::bridge::Math::SolveSymmetric(Af, bf); + const itk::Array xd = itk::bridge::Math::SolveSymmetric(Ad, bd); for (unsigned int i = 0; i < VDim; ++i) { EXPECT_NEAR(xf[i], xd[i], 1e-12) << "i=" << i; @@ -113,7 +113,7 @@ TEST(MathLDLT, FixedMatchesDynamic) // LDLT solves indefinite symmetric systems where a plain Cholesky (SPD-only) // would fail -- the key robustness property motivating the JLF adoption. -TEST(MathLDLT, HandlesIndefiniteSymmetric) +TEST(BridgeMathLDLT, HandlesIndefiniteSymmetric) { constexpr unsigned int n = 3; itk::Matrix A; @@ -127,14 +127,14 @@ TEST(MathLDLT, HandlesIndefiniteSymmetric) b[1] = 2.0; b[2] = -1.0; - const itk::Vector x = itk::Math::SolveSymmetric(A, b); + const itk::Vector x = itk::bridge::Math::SolveSymmetric(A, b); const itk::Vector r = A * x - b; EXPECT_LT(r.GetNorm(), 1e-10); } // The vnl convenience overload (for consumers still holding vnl types, e.g. the // ANTs joint-label-fusion MxBar) must agree with the ITK-typed path. -TEST(MathLDLT, VnlConvenienceMatchesItkTyped) +TEST(BridgeMathLDLT, VnlConvenienceMatchesItkTyped) { constexpr unsigned int n = 8; const itk::Array2D A = MakeSPD(n, 0.5); @@ -147,8 +147,8 @@ TEST(MathLDLT, VnlConvenienceMatchesItkTyped) // vnl overload: A / b upcast to their vnl bases. const vnl_matrix & Avnl = A; const vnl_vector & bvnl = b; - const vnl_vector xvnl = itk::Math::SolveSymmetric(Avnl, bvnl); - const itk::Array xitk = itk::Math::SolveSymmetric(A, b); + const vnl_vector xvnl = itk::bridge::Math::SolveSymmetric(Avnl, bvnl); + const itk::Array xitk = itk::bridge::Math::SolveSymmetric(A, b); ASSERT_EQ(xvnl.size(), n); for (unsigned int i = 0; i < n; ++i) @@ -157,12 +157,12 @@ TEST(MathLDLT, VnlConvenienceMatchesItkTyped) } } -TEST(MathLDLT, InverseSymmetricMatchesVnl) +TEST(BridgeMathLDLT, InverseSymmetricMatchesVnl) { for (unsigned int n : { 1u, 3u, 6u, 12u }) { const itk::Array2D A = MakeSPD(n, 0.5); - const itk::Array2D inv = itk::Math::InverseSymmetric(A); + const itk::Array2D inv = itk::bridge::Math::InverseSymmetric(A); ASSERT_EQ(inv.rows(), n); #ifndef ITK_FUTURE_LEGACY_REMOVE const vnl_matrix ref = vnl_matrix_inverse(A).inverse(); @@ -186,24 +186,24 @@ TEST(MathLDLT, InverseSymmetricMatchesVnl) } } -TEST(MathLDLT, InverseSymmetricThrowsOnSingular) +TEST(BridgeMathLDLT, InverseSymmetricThrowsOnSingular) { // Rank-1 symmetric matrix [[1,2],[2,4]] is exactly singular. itk::Array2D A(2, 2); A(0, 0) = 1.0; A(0, 1) = A(1, 0) = 2.0; A(1, 1) = 4.0; - EXPECT_THROW(itk::Math::InverseSymmetric(A), itk::ExceptionObject); + EXPECT_THROW(itk::bridge::Math::InverseSymmetric(A), itk::ExceptionObject); const vnl_matrix & Avnl = A; - EXPECT_THROW(itk::Math::InverseSymmetric(Avnl), itk::ExceptionObject); + EXPECT_THROW(itk::bridge::Math::InverseSymmetric(Avnl), itk::ExceptionObject); itk::Array2D zero(3, 3); zero.fill(0.0); - EXPECT_THROW(itk::Math::InverseSymmetric(zero), itk::ExceptionObject); + EXPECT_THROW(itk::bridge::Math::InverseSymmetric(zero), itk::ExceptionObject); } -TEST(MathLDLT, MatrixRhsSolveMatchesColumnwise) +TEST(BridgeMathLDLT, MatrixRhsSolveMatchesColumnwise) { constexpr unsigned int n = 6; const itk::Array2D A = MakeSPD(n, 0.4); @@ -216,7 +216,7 @@ TEST(MathLDLT, MatrixRhsSolveMatchesColumnwise) } } - const itk::Array2D X = itk::Math::SolveSymmetric(A, B); + const itk::Array2D X = itk::bridge::Math::SolveSymmetric(A, B); // A X == B const vnl_matrix prod = A * X; for (unsigned int i = 0; i < n; ++i) @@ -228,7 +228,7 @@ TEST(MathLDLT, MatrixRhsSolveMatchesColumnwise) } } -TEST(MathLDLT, FloatPrecision) +TEST(BridgeMathLDLT, FloatPrecision) { const itk::Array2D A = MakeSPD(5, 0.5f); itk::Array b(5); @@ -236,7 +236,7 @@ TEST(MathLDLT, FloatPrecision) { b[i] = static_cast(std::cos(0.3 * i)); } - const itk::Array x = itk::Math::SolveSymmetric(A, b); + const itk::Array x = itk::bridge::Math::SolveSymmetric(A, b); const vnl_vector r = A * x - b; EXPECT_LT(r.inf_norm(), 1e-4f); } diff --git a/Modules/Core/Common/test/itkMathSVDGTest.cxx b/Modules/Core/Common/test/itkBridgeMathSVDGTest.cxx similarity index 87% rename from Modules/Core/Common/test/itkMathSVDGTest.cxx rename to Modules/Core/Common/test/itkBridgeMathSVDGTest.cxx index 055e88612c5..2ed121b03af 100644 --- a/Modules/Core/Common/test/itkMathSVDGTest.cxx +++ b/Modules/Core/Common/test/itkBridgeMathSVDGTest.cxx @@ -18,7 +18,7 @@ // First include the header file to be tested: #include "itkMatrix.h" -#include "itkMathSVD.h" +#include "itkBridgeMathSVD.h" // This test cross-checks against the vnl_svd reference engine; mark it so it keeps // compiling once vnl_svd is deprecated under ITK_LEGACY_REMOVE. The oracle is @@ -48,11 +48,11 @@ MakeFixed() } // namespace // A == U diag(W) V^T for fixed-size square matrices, float and double. -TEST(MathSVD, FixedReconstructs) +TEST(BridgeMathSVD, FixedReconstructs) { { const auto A = MakeFixed(); - const auto r = itk::Math::SVD(A); + const auto r = itk::bridge::Math::SVD(A); double err{}; for (unsigned int i = 0; i < 3; ++i) for (unsigned int j = 0; j < 3; ++j) @@ -66,7 +66,7 @@ TEST(MathSVD, FixedReconstructs) } { const auto A = MakeFixed(); - const auto r = itk::Math::SVD(A); + const auto r = itk::bridge::Math::SVD(A); float err{}; for (unsigned int i = 0; i < 6; ++i) for (unsigned int j = 0; j < 6; ++j) @@ -82,10 +82,10 @@ TEST(MathSVD, FixedReconstructs) #ifndef ITK_FUTURE_LEGACY_REMOVE // Singular values agree with vnl_svd (the engine being supplemented). -TEST(MathSVD, SingularValuesMatchVnl) +TEST(BridgeMathSVD, SingularValuesMatchVnl) { const auto A = MakeFixed(); - const auto r = itk::Math::SVD(A); + const auto r = itk::bridge::Math::SVD(A); const vnl_svd ref(A.as_matrix()); for (unsigned int i = 0; i < 6; ++i) EXPECT_NEAR(r.W[i], ref.W()(i, i), 1e-12); @@ -94,10 +94,10 @@ TEST(MathSVD, SingularValuesMatchVnl) // Default canonicalization makes the largest-magnitude element of each U column // positive, giving a deterministic, build-independent sign convention. -TEST(MathSVD, SignsCanonical) +TEST(BridgeMathSVD, SignsCanonical) { const auto A = MakeFixed(); - const auto r = itk::Math::SVD(A); + const auto r = itk::bridge::Math::SVD(A); for (unsigned int j = 0; j < 4; ++j) { unsigned int pivot = 0; @@ -116,7 +116,7 @@ TEST(MathSVD, SignsCanonical) // U V^T is invariant to the SVD sign/basis ambiguity: it matches vnl_svd even // for a degenerate (repeated singular value) matrix. This is the property the // geometry call sites (orthogonalization) rely on. -TEST(MathSVD, UVtransposeInvariantOnDegenerate) +TEST(BridgeMathSVD, UVtransposeInvariantOnDegenerate) { // Rotation * diag(1,1,3): two equal singular values (degenerate subspace). vnl_matrix_fixed R; @@ -140,7 +140,7 @@ TEST(MathSVD, UVtransposeInvariantOnDegenerate) A(i, 2) = R(i, 2) * 3.0; } - const auto r = itk::Math::SVD(A, /*canonicalizeSigns=*/false); + const auto r = itk::bridge::Math::SVD(A, /*canonicalizeSigns=*/false); const vnl_svd ref(A.as_matrix()); const vnl_matrix_fixed rotEig = r.U * r.V.transpose(); const vnl_matrix rotVnl = ref.U() * ref.V().transpose(); @@ -153,12 +153,12 @@ TEST(MathSVD, UVtransposeInvariantOnDegenerate) #endif // ITK_FUTURE_LEGACY_REMOVE // The itk::Matrix overload forwards to the same computation. -TEST(MathSVD, ItkMatrixOverload) +TEST(BridgeMathSVD, ItkMatrixOverload) { itk::Matrix A; A.SetIdentity(); A(0, 2) = 0.5; - const auto r = itk::Math::SVD(A); + const auto r = itk::bridge::Math::SVD(A); double err{}; for (unsigned int i = 0; i < 3; ++i) for (unsigned int j = 0; j < 3; ++j) @@ -173,7 +173,7 @@ TEST(MathSVD, ItkMatrixOverload) // Runtime-sized square overload, exercising both the small (JacobiSVD) and large // (BDCSVD) engine branches. -TEST(MathSVD, DynamicReconstructs) +TEST(BridgeMathSVD, DynamicReconstructs) { for (const unsigned int n : { 3u, 6u, 7u, 20u }) // 6 -> JacobiSVD, 7 -> BDCSVD (crossover) { @@ -182,7 +182,7 @@ TEST(MathSVD, DynamicReconstructs) for (unsigned int j = 0; j < n; ++j) A(i, j) = std::sin(0.7 * i + 1.3 * j) + (i == j ? 3.0 : 0.0); - const auto r = itk::Math::SVD(A); + const auto r = itk::bridge::Math::SVD(A); double err{}; for (unsigned int i = 0; i < n; ++i) for (unsigned int j = 0; j < n; ++j) @@ -203,17 +203,17 @@ TEST(MathSVD, DynamicReconstructs) } // An empty runtime input is rejected. -TEST(MathSVD, DynamicRejectsEmpty) +TEST(BridgeMathSVD, DynamicRejectsEmpty) { const vnl_matrix A(0, 0); - EXPECT_THROW(itk::Math::SVD(A), itk::ExceptionObject); + EXPECT_THROW(itk::bridge::Math::SVD(A), itk::ExceptionObject); } // PseudoInverse() agrees with vnl_svd and satisfies the Moore-Penrose identity. -TEST(MathSVD, PseudoInverseMatchesVnl) +TEST(BridgeMathSVD, PseudoInverseMatchesVnl) { const auto A = MakeFixed(); - const auto pinv = itk::Math::SVD(A).PseudoInverse(); + const auto pinv = itk::bridge::Math::SVD(A).PseudoInverse(); #ifndef ITK_FUTURE_LEGACY_REMOVE const vnl_matrix pinvVnl = vnl_svd(A.as_matrix()).pinverse(); double dInv = 0.0; @@ -233,14 +233,14 @@ TEST(MathSVD, PseudoInverseMatchesVnl) } // Solve() returns the solution of A x = b for a well-conditioned A. -TEST(MathSVD, SolveMatchesVnl) +TEST(BridgeMathSVD, SolveMatchesVnl) { const auto A = MakeFixed(); vnl_vector_fixed b; for (unsigned int i = 0; i < 4; ++i) b[i] = static_cast(i + 1); - const auto x = itk::Math::SVD(A).Solve(b); + const auto x = itk::bridge::Math::SVD(A).Solve(b); // residual A x - b is ~0 for a full-rank A const vnl_vector_fixed residual = A * x - b; @@ -256,18 +256,18 @@ TEST(MathSVD, SolveMatchesVnl) #ifndef ITK_FUTURE_LEGACY_REMOVE // WellCondition() (sigma_min/sigma_max) agrees with vnl_svd::well_condition(), // the accessor the NIfTI direction-cosine check migrated onto. -TEST(MathSVD, WellConditionMatchesVnl) +TEST(BridgeMathSVD, WellConditionMatchesVnl) { const auto A = MakeFixed(); - EXPECT_NEAR(itk::Math::SVD(A).WellCondition(), vnl_svd(A.as_matrix()).well_condition(), 1e-12); + EXPECT_NEAR(itk::bridge::Math::SVD(A).WellCondition(), vnl_svd(A.as_matrix()).well_condition(), 1e-12); } // DeterminantMagnitude() (product of singular values) agrees with // vnl_svd::determinant_magnitude(), the accessor the Mahalanobis check migrated onto. -TEST(MathSVD, DeterminantMagnitudeMatchesVnl) +TEST(BridgeMathSVD, DeterminantMagnitudeMatchesVnl) { const auto A = MakeFixed(); - const double itkDet = itk::Math::SVD(A).DeterminantMagnitude(); + const double itkDet = itk::bridge::Math::SVD(A).DeterminantMagnitude(); const double vnlDet = vnl_svd(A.as_matrix()).determinant_magnitude(); EXPECT_NEAR(itkDet, vnlDet, 1e-10 * std::abs(vnlDet)); } @@ -275,9 +275,9 @@ TEST(MathSVD, DeterminantMagnitudeMatchesVnl) // rank() reports full rank for a well-conditioned matrix and the reduced rank of // a deliberately rank-deficient one. -TEST(MathSVD, Rank) +TEST(BridgeMathSVD, Rank) { - EXPECT_EQ(itk::Math::SVD(MakeFixed()).Rank(), 6u); + EXPECT_EQ(itk::bridge::Math::SVD(MakeFixed()).Rank(), 6u); // Two identical rows -> rank 2 for a 3x3. vnl_matrix A(3, 3, 0.0); @@ -290,13 +290,13 @@ TEST(MathSVD, Rank) A(2, 0) = 4.0; A(2, 1) = 0.0; A(2, 2) = 1.0; - EXPECT_EQ(itk::Math::SVD(A).Rank(), 2u); + EXPECT_EQ(itk::bridge::Math::SVD(A).Rank(), 2u); } // Ill-conditioned input (6x6 Hilbert, condition ~1e7): reconstruction stays // accurate and the singular values still agree with vnl_svd. Stresses the engines // where Jacobi and BDC can diverge, which the well-conditioned fixtures do not. -TEST(MathSVD, IllConditionedMatchesVnl) +TEST(BridgeMathSVD, IllConditionedMatchesVnl) { constexpr unsigned int N = 6; vnl_matrix A(N, N); @@ -304,7 +304,7 @@ TEST(MathSVD, IllConditionedMatchesVnl) for (unsigned int j = 0; j < N; ++j) A(i, j) = 1.0 / (i + j + 1.0); // Hilbert - const auto r = itk::Math::SVD(A); + const auto r = itk::bridge::Math::SVD(A); #ifndef ITK_FUTURE_LEGACY_REMOVE // singular values agree relative to the largest @@ -329,7 +329,7 @@ TEST(MathSVD, IllConditionedMatchesVnl) // canonicalizeSigns actually controls the output (a test that fails if the flag // were ignored): true yields canonical signs and differs from the raw false result. -TEST(MathSVD, CanonicalizeFlagControlsSigns) +TEST(BridgeMathSVD, CanonicalizeFlagControlsSigns) { // Scan several matrices: true must always be canonical, false must preserve // Eigen's raw signs, and at least one raw column must be non-canonical (proving @@ -344,8 +344,8 @@ TEST(MathSVD, CanonicalizeFlagControlsSigns) for (unsigned int j = 0; j < 4; ++j) A(i, j) = std::sin(0.37 * seed + 0.7 * i + 1.9 * j) + (i == j ? 1.0 : 0.0); - const auto rTrue = itk::Math::SVD(A, true); - const auto rFalse = itk::Math::SVD(A, false); + const auto rTrue = itk::bridge::Math::SVD(A, true); + const auto rFalse = itk::bridge::Math::SVD(A, false); for (unsigned int j = 0; j < 4; ++j) { @@ -376,14 +376,14 @@ TEST(MathSVD, CanonicalizeFlagControlsSigns) } // The runtime overload also canonicalizes (the dynamic SvdFlip path). -TEST(MathSVD, DynamicSignsCanonical) +TEST(BridgeMathSVD, DynamicSignsCanonical) { vnl_matrix A(5, 5); for (unsigned int i = 0; i < 5; ++i) for (unsigned int j = 0; j < 5; ++j) A(i, j) = std::sin(0.9 * i + 1.7 * j) + (i == j ? 2.0 : 0.0); - const auto r = itk::Math::SVD(A); + const auto r = itk::bridge::Math::SVD(A); for (unsigned int j = 0; j < 5; ++j) { unsigned int pivot = 0; @@ -396,7 +396,7 @@ TEST(MathSVD, DynamicSignsCanonical) // Repeated singular values (degenerate spectrum) still reconstruct exactly, even // though the singular-vector basis within the degenerate subspace is arbitrary. -TEST(MathSVD, DegenerateSpectrumReconstructs) +TEST(BridgeMathSVD, DegenerateSpectrumReconstructs) { // diag(2,2,2,5): a triply-repeated singular value. vnl_matrix A(4, 4, 0.0); @@ -404,7 +404,7 @@ TEST(MathSVD, DegenerateSpectrumReconstructs) A(1, 1) = 2.0; A(2, 2) = 2.0; A(3, 3) = 5.0; - const auto r = itk::Math::SVD(A); + const auto r = itk::bridge::Math::SVD(A); double err = 0.0; for (unsigned int i = 0; i < 4; ++i) for (unsigned int j = 0; j < 4; ++j) @@ -419,10 +419,10 @@ TEST(MathSVD, DegenerateSpectrumReconstructs) // Recompose() with no truncation reconstructs A; a threshold zeroes the small // singular value, yielding the rank-reduced reconstruction. -TEST(MathSVD, Recompose) +TEST(BridgeMathSVD, Recompose) { const auto A = MakeFixed(); - const auto recon = itk::Math::SVD(A).Recompose(); + const auto recon = itk::bridge::Math::SVD(A).Recompose(); double err = 0.0; for (unsigned int i = 0; i < 4; ++i) for (unsigned int j = 0; j < 4; ++j) @@ -434,7 +434,7 @@ TEST(MathSVD, Recompose) B(0, 0) = 5.0; B(1, 1) = 3.0; B(2, 2) = 1e-9; - const auto truncated = itk::Math::SVD(B).Recompose(1e-6); + const auto truncated = itk::bridge::Math::SVD(B).Recompose(1e-6); EXPECT_NEAR(truncated(0, 0), 5.0, 1e-10); EXPECT_NEAR(truncated(1, 1), 3.0, 1e-10); EXPECT_NEAR(truncated(2, 2), 0.0, 1e-12); @@ -442,7 +442,7 @@ TEST(MathSVD, Recompose) // Rectangular (tall and wide): thin factors reconstruct A, shapes are correct, // and PseudoInverse()/Solve() match vnl_svd and satisfy the Moore-Penrose identity. -TEST(MathSVD, Rectangular) +TEST(BridgeMathSVD, Rectangular) { const unsigned int dims[2][2] = { { 5, 3 }, { 3, 5 } }; // tall, wide for (const auto & d : dims) @@ -455,7 +455,7 @@ TEST(MathSVD, Rectangular) for (unsigned int j = 0; j < n; ++j) A(i, j) = std::sin(0.6 * i + 1.1 * j) + (i == j ? 1.0 : 0.0); - const auto r = itk::Math::SVD(A); + const auto r = itk::bridge::Math::SVD(A); EXPECT_EQ(r.U.rows(), m); EXPECT_EQ(r.U.cols(), k); EXPECT_EQ(r.V.rows(), n); @@ -498,7 +498,7 @@ TEST(MathSVD, Rectangular) } // Rectangular least-squares Solve() matches vnl_svd (the BSpline refinement use). -TEST(MathSVD, RectangularSolveMatchesVnl) +TEST(BridgeMathSVD, RectangularSolveMatchesVnl) { vnl_matrix A(5, 3); // overdetermined for (unsigned int i = 0; i < 5; ++i) @@ -508,7 +508,7 @@ TEST(MathSVD, RectangularSolveMatchesVnl) for (unsigned int i = 0; i < 5; ++i) b[i] = static_cast(i) - 1.5; - const vnl_vector x = itk::Math::SVD(A).Solve(b); + const vnl_vector x = itk::bridge::Math::SVD(A).Solve(b); EXPECT_EQ(x.size(), 3u); #ifndef ITK_FUTURE_LEGACY_REMOVE const vnl_vector xVnl = vnl_svd(A).solve(b); @@ -517,7 +517,7 @@ TEST(MathSVD, RectangularSolveMatchesVnl) } // NullVector() matches vnl_svd::nullvector() up to sign, and lies in the nullspace. -TEST(MathSVD, NullVector) +TEST(BridgeMathSVD, NullVector) { // Rank-2 square 3x3: third row = row0 + row1. vnl_matrix A(3, 3); @@ -530,7 +530,7 @@ TEST(MathSVD, NullVector) for (unsigned int j = 0; j < 3; ++j) A(2, j) = A(0, j) + A(1, j); - const vnl_vector nv = itk::Math::SVD(A).NullVector(); + const vnl_vector nv = itk::bridge::Math::SVD(A).NullVector(); EXPECT_LT((A * nv).inf_norm(), 1e-12); #ifndef ITK_FUTURE_LEGACY_REMOVE @@ -542,25 +542,25 @@ TEST(MathSVD, NullVector) // Fixed-size overload agrees. vnl_matrix_fixed Af; Af.copy_in(A.data_block()); - const vnl_vector_fixed nvf = itk::Math::SVD(Af).NullVector(); + const vnl_vector_fixed nvf = itk::bridge::Math::SVD(Af).NullVector(); EXPECT_LT((A * nvf.as_vector()).inf_norm(), 1e-12); } // NullVector() refuses an underdetermined input whose thin V cannot span the nullspace. -TEST(MathSVD, NullVectorRejectsUnderdetermined) +TEST(BridgeMathSVD, NullVectorRejectsUnderdetermined) { vnl_matrix A(2, 4); A.fill(1.0); A(0, 1) = 2.0; A(1, 3) = 3.0; - EXPECT_THROW(itk::Math::SVD(A).NullVector(), itk::ExceptionObject); + EXPECT_THROW(itk::bridge::Math::SVD(A).NullVector(), itk::ExceptionObject); } // RecomposeWith() reproduces A for unmodified W and honors hand-edited values. -TEST(MathSVD, RecomposeWith) +TEST(BridgeMathSVD, RecomposeWith) { const auto Af = MakeFixed(); - const auto r = itk::Math::SVD(Af); + const auto r = itk::bridge::Math::SVD(Af); const vnl_matrix_fixed same = r.RecomposeWith(r.W); double err = 0.0; @@ -593,7 +593,7 @@ TEST(MathSVD, RecomposeWith) // Fixed rectangular overload: factors match the dynamic path and the // pseudo-inverse matches the vnl_svd reference (the itkTransform Jacobian use). -TEST(MathSVD, FixedRectangular) +TEST(BridgeMathSVD, FixedRectangular) { constexpr unsigned int rows = 5; constexpr unsigned int cols = 3; @@ -602,8 +602,8 @@ TEST(MathSVD, FixedRectangular) for (unsigned int j = 0; j < cols; ++j) Af(i, j) = std::cos(0.4 * i + 0.9 * j) + (i == j ? 2.0 : 0.0); - const auto rf = itk::Math::SVD(Af); - const auto rd = itk::Math::SVD(vnl_matrix(Af.as_matrix())); + const auto rf = itk::bridge::Math::SVD(Af); + const auto rd = itk::bridge::Math::SVD(vnl_matrix(Af.as_matrix())); for (unsigned int k = 0; k < 3; ++k) EXPECT_NEAR(rf.W[k], rd.W[k], 1e-12); @@ -620,6 +620,6 @@ TEST(MathSVD, FixedRectangular) vnl_matrix_fixed Adef = Af; for (unsigned int i = 0; i < rows; ++i) Adef(i, 2) = Adef(i, 0) + Adef(i, 1); - const vnl_vector_fixed nv = itk::Math::SVD(Adef).NullVector(); + const vnl_vector_fixed nv = itk::bridge::Math::SVD(Adef).NullVector(); EXPECT_LT((Adef.as_matrix() * nv.as_vector()).inf_norm(), 1e-12); } diff --git a/Modules/Core/Common/test/itkQRDecompositionGTest.cxx b/Modules/Core/Common/test/itkBridgeQRDecompositionGTest.cxx similarity index 73% rename from Modules/Core/Common/test/itkQRDecompositionGTest.cxx rename to Modules/Core/Common/test/itkBridgeQRDecompositionGTest.cxx index dac2651d9f7..0e4d2f58351 100644 --- a/Modules/Core/Common/test/itkQRDecompositionGTest.cxx +++ b/Modules/Core/Common/test/itkBridgeQRDecompositionGTest.cxx @@ -17,7 +17,7 @@ *=========================================================================*/ // First include the header file to be tested: -#include "itkQRDecomposition.h" +#include "itkBridgeQRDecomposition.h" // Exercise the deprecated VNL engine for the old-vs-new equivalence checks. // The VNL symbol is unavailable under ITK_FUTURE_LEGACY_REMOVE. @@ -45,28 +45,28 @@ MakeMatrix(unsigned int rows, unsigned int cols) // Q R reconstructs A. -TEST(QRDecomposition, ReconstructsMatrix) +TEST(BridgeQRDecomposition, ReconstructsMatrix) { - const vnl_matrix A = MakeMatrix(5, 5); - const itk::QRDecomposition qr(A); - const vnl_matrix reconstructed = qr.GetQ() * qr.GetR(); + const vnl_matrix A = MakeMatrix(5, 5); + const itk::bridge::QRDecomposition qr(A); + const vnl_matrix reconstructed = qr.GetQ() * qr.GetR(); EXPECT_LT((reconstructed - A).fro_norm() / A.fro_norm(), 1e-12); } // Q is orthonormal: Q^T Q == I. -TEST(QRDecomposition, OrthonormalQ) +TEST(BridgeQRDecomposition, OrthonormalQ) { - const vnl_matrix A = MakeMatrix(6, 4); - const itk::QRDecomposition qr(A); - vnl_matrix ident(6, 6); + const vnl_matrix A = MakeMatrix(6, 4); + const itk::bridge::QRDecomposition qr(A); + vnl_matrix ident(6, 6); ident.set_identity(); EXPECT_LT((qr.GetQ().transpose() * qr.GetQ() - ident).fro_norm(), 1e-12); } // A x = b solved; residual tiny. -TEST(QRDecomposition, SolveResidual) +TEST(BridgeQRDecomposition, SolveResidual) { const unsigned int n = 5; const vnl_matrix A = MakeMatrix(n, n); @@ -74,14 +74,14 @@ TEST(QRDecomposition, SolveResidual) for (unsigned int i = 0; i < n; ++i) b[i] = static_cast(i) - 1.5; - const itk::QRDecomposition qr(A); - const vnl_vector x = qr.Solve(b); + const itk::bridge::QRDecomposition qr(A); + const vnl_vector x = qr.Solve(b); EXPECT_LT((A * x - b).two_norm() / b.two_norm(), 1e-10); } // Multi-column RHS: each column solves against the one shared factorization. -TEST(QRDecomposition, SolveMatrixRHS) +TEST(BridgeQRDecomposition, SolveMatrixRHS) { const unsigned int n = 5; const unsigned int k = 3; @@ -91,8 +91,8 @@ TEST(QRDecomposition, SolveMatrixRHS) for (unsigned int j = 0; j < k; ++j) B(i, j) = std::cos(0.3 * (i + 1) * (j + 2)); - const itk::QRDecomposition qr(A); - const vnl_matrix X = qr.Solve(B); + const itk::bridge::QRDecomposition qr(A); + const vnl_matrix X = qr.Solve(B); ASSERT_EQ(X.rows(), n); ASSERT_EQ(X.cols(), k); EXPECT_LT((A * X - B).fro_norm() / B.fro_norm(), 1e-10); @@ -103,7 +103,7 @@ TEST(QRDecomposition, SolveMatrixRHS) // Overdetermined (rows > cols) multi-column solve yields the least-squares // solution, characterized by the normal equations A^T (A X - B) == 0. -TEST(QRDecomposition, SolveMatrixRHSOverdetermined) +TEST(BridgeQRDecomposition, SolveMatrixRHSOverdetermined) { const unsigned int m = 6; const unsigned int n = 3; @@ -114,8 +114,8 @@ TEST(QRDecomposition, SolveMatrixRHSOverdetermined) for (unsigned int j = 0; j < k; ++j) B(i, j) = std::cos(0.35 * (i + 1) * (j + 2)) - 0.2 * (j + 1); - const itk::QRDecomposition qr(A); - const vnl_matrix X = qr.Solve(B); + const itk::bridge::QRDecomposition qr(A); + const vnl_matrix X = qr.Solve(B); ASSERT_EQ(X.rows(), n); ASSERT_EQ(X.cols(), k); EXPECT_LT((A.transpose() * (A * X - B)).fro_norm() / (A.transpose() * B).fro_norm(), 1e-10); @@ -126,7 +126,7 @@ TEST(QRDecomposition, SolveMatrixRHSOverdetermined) #ifndef ITK_FUTURE_LEGACY_REMOVE // itk:: solve and determinant agree with the (sign-stable) legacy vnl_qr. -TEST(QRDecomposition, EquivalentToVnlQR) +TEST(BridgeQRDecomposition, EquivalentToVnlQR) { const unsigned int n = 6; const vnl_matrix A = MakeMatrix(n, n); @@ -134,8 +134,8 @@ TEST(QRDecomposition, EquivalentToVnlQR) for (unsigned int i = 0; i < n; ++i) b[i] = std::cos(0.5 * (i + 1)); - const itk::QRDecomposition qrItk(A); - vnl_qr qrVnl(A); + const itk::bridge::QRDecomposition qrItk(A); + vnl_qr qrVnl(A); EXPECT_LT((qrItk.Solve(b) - qrVnl.solve(b)).two_norm() / qrVnl.solve(b).two_norm(), 1e-10); EXPECT_NEAR(qrItk.GetDeterminant(), qrVnl.determinant(), 1e-9 * std::abs(qrVnl.determinant()) + 1e-12); @@ -144,7 +144,7 @@ TEST(QRDecomposition, EquivalentToVnlQR) // Multi-column solve matches legacy vnl_qr column-for-column. This is the exact // operation itkLandmarkBasedTransformInitializer relies on (square Q, matrix C). -TEST(QRDecomposition, MatrixRHSEquivalentToVnlQR) +TEST(BridgeQRDecomposition, MatrixRHSEquivalentToVnlQR) { for (const unsigned int n : { 3u, 4u, 6u }) { @@ -155,7 +155,7 @@ TEST(QRDecomposition, MatrixRHSEquivalentToVnlQR) for (unsigned int j = 0; j < k; ++j) B(i, j) = std::cos(0.4 * (i + 1) * (j + 2)) - 0.3 * (j + 1); - const vnl_matrix xItk = itk::QRDecomposition(A).Solve(B); + const vnl_matrix xItk = itk::bridge::QRDecomposition(A).Solve(B); const vnl_matrix xVnl = vnl_qr(A).solve(B); EXPECT_LT((xItk - xVnl).fro_norm() / xVnl.fro_norm(), 1e-10); } @@ -163,12 +163,12 @@ TEST(QRDecomposition, MatrixRHSEquivalentToVnlQR) // Inverse matches legacy vnl_qr.inverse(). -TEST(QRDecomposition, InverseEquivalentToVnlQR) +TEST(BridgeQRDecomposition, InverseEquivalentToVnlQR) { for (const unsigned int n : { 2u, 3u, 5u }) { const vnl_matrix A = MakeMatrix(n, n); - const vnl_matrix invItk = itk::QRDecomposition(A).Inverse(); + const vnl_matrix invItk = itk::bridge::QRDecomposition(A).Inverse(); const vnl_matrix invVnl = vnl_qr(A).inverse(); EXPECT_LT((invItk - invVnl).fro_norm() / invVnl.fro_norm(), 1e-10); @@ -181,19 +181,19 @@ TEST(QRDecomposition, InverseEquivalentToVnlQR) // Single-precision path reconstructs. -TEST(QRDecomposition, FloatReconstructs) +TEST(BridgeQRDecomposition, FloatReconstructs) { - const vnl_matrix A = MakeMatrix(4, 4); - const itk::QRDecomposition qr(A); + const vnl_matrix A = MakeMatrix(4, 4); + const itk::bridge::QRDecomposition qr(A); EXPECT_LT((qr.GetQ() * qr.GetR() - A).fro_norm() / A.fro_norm(), 1e-5f); } // Solve rejects an underdetermined system (rows < cols) instead of reading out of bounds. -TEST(QRDecomposition, SolveRejectsUnderdetermined) +TEST(BridgeQRDecomposition, SolveRejectsUnderdetermined) { - const vnl_matrix A = MakeMatrix(3, 5); - const itk::QRDecomposition qr(A); - const vnl_vector b(3, 1.0); + const vnl_matrix A = MakeMatrix(3, 5); + const itk::bridge::QRDecomposition qr(A); + const vnl_vector b(3, 1.0); EXPECT_THROW(qr.Solve(b), itk::ExceptionObject); } diff --git a/Modules/Core/Common/test/itkRealEigenDecompositionGTest.cxx b/Modules/Core/Common/test/itkBridgeRealEigenDecompositionGTest.cxx similarity index 82% rename from Modules/Core/Common/test/itkRealEigenDecompositionGTest.cxx rename to Modules/Core/Common/test/itkBridgeRealEigenDecompositionGTest.cxx index eb77f4a7e23..ec4a59092bb 100644 --- a/Modules/Core/Common/test/itkRealEigenDecompositionGTest.cxx +++ b/Modules/Core/Common/test/itkBridgeRealEigenDecompositionGTest.cxx @@ -15,7 +15,7 @@ * limitations under the License. * *=========================================================================*/ -#include "itkRealEigenDecomposition.h" +#include "itkBridgeRealEigenDecomposition.h" #include "itkConfigure.h" #ifndef ITK_FUTURE_LEGACY_REMOVE # define ITK_LEGACY_TEST // exercise the deprecated vnl class for equivalence @@ -36,7 +36,7 @@ namespace // assert against (individual eigenvector signs are arbitrary). template TReal -EigenResidual(const vnl_matrix & A, const itk::RealEigenDecomposition & eig) +EigenResidual(const vnl_matrix & A, const itk::bridge::RealEigenDecomposition & eig) { using Complex = std::complex; const auto & lambda = eig.GetEigenvalues(); @@ -62,15 +62,15 @@ EigenResidual(const vnl_matrix & A, const itk::RealEigenDecomposition S(Sdata, 6, 6); - const itk::RealEigenDecomposition eig(S); + const vnl_matrix S(Sdata, 6, 6); + const itk::bridge::RealEigenDecomposition eig(S); for (unsigned int i = 0; i < 6; ++i) { @@ -80,17 +80,17 @@ TEST(RealEigenDecomposition, SymmetricInputRealSpectrum) } // Scavenged from VXL test_real_eigensystem::test_4x4 (general/unsympathetic). -TEST(RealEigenDecomposition, GeneralMatrix) +TEST(BridgeRealEigenDecomposition, GeneralMatrix) { const double Xdata[16] = { 686, 526, 701, 47, 588, 91, 910, 736, 930, 653, 762, 328, 846, 415, 262, 632 }; const vnl_matrix X(Xdata, 4, 4); - const itk::RealEigenDecomposition eig(X); + const itk::bridge::RealEigenDecomposition eig(X); EXPECT_LT(EigenResidual(X, eig), 1e-10); } // A real matrix with a genuinely complex spectrum: 2-D rotation by theta has // eigenvalues exp(+/- i theta). Exercises the complex-conjugate path. -TEST(RealEigenDecomposition, ComplexSpectrumRotation) +TEST(BridgeRealEigenDecomposition, ComplexSpectrumRotation) { const double theta = 0.7; vnl_matrix R(2, 2); @@ -99,7 +99,7 @@ TEST(RealEigenDecomposition, ComplexSpectrumRotation) R(1, 0) = std::sin(theta); R(1, 1) = std::cos(theta); - const itk::RealEigenDecomposition eig(R); + const itk::bridge::RealEigenDecomposition eig(R); EXPECT_LT(EigenResidual(R, eig), 1e-13); double maxImag = 0; @@ -110,14 +110,14 @@ TEST(RealEigenDecomposition, ComplexSpectrumRotation) EXPECT_NEAR(maxImag, std::sin(theta), 1e-13); } -TEST(RealEigenDecomposition, Identity) +TEST(BridgeRealEigenDecomposition, Identity) { vnl_matrix I(3, 3, 0.0); for (unsigned int i = 0; i < 3; ++i) { I(i, i) = 1.0; } - const itk::RealEigenDecomposition eig(I); + const itk::bridge::RealEigenDecomposition eig(I); for (unsigned int i = 0; i < 3; ++i) { EXPECT_NEAR(std::real(eig.GetEigenvalues()[i]), 1.0, 1e-14); @@ -125,17 +125,17 @@ TEST(RealEigenDecomposition, Identity) } } -TEST(RealEigenDecomposition, FloatInstantiation) +TEST(BridgeRealEigenDecomposition, FloatInstantiation) { - const float data[4] = { 2.0f, 0.0f, 0.0f, 3.0f }; - const vnl_matrix A(data, 2, 2); - const itk::RealEigenDecomposition eig(A); + const float data[4] = { 2.0f, 0.0f, 0.0f, 3.0f }; + const vnl_matrix A(data, 2, 2); + const itk::bridge::RealEigenDecomposition eig(A); EXPECT_LT(EigenResidual(A, eig), 1e-5f); } // Non-finite input leaves the Eigen solver in a non-Success state; the wrapper // surfaces that as an exception rather than returning a garbage decomposition. -TEST(RealEigenDecomposition, NonFiniteInputThrows) +TEST(BridgeRealEigenDecomposition, NonFiniteInputThrows) { const double nan = std::numeric_limits::quiet_NaN(); vnl_matrix M(2, 2, 0.0); @@ -144,7 +144,7 @@ TEST(RealEigenDecomposition, NonFiniteInputThrows) M(0, 1) = M(1, 0) = nan; try { - const itk::RealEigenDecomposition eig{ M }; + const itk::bridge::RealEigenDecomposition eig{ M }; FAIL() << "expected an exception for non-finite input"; } catch (const itk::ExceptionObject & e) @@ -163,13 +163,13 @@ TEST(RealEigenDecomposition, NonFiniteInputThrows) // Equivalence: the Eigen-backed solver yields the same (complex) spectrum as // the deprecated netlib vnl_real_eigensystem. General eigenvalues are unsorted, // so compare as multisets. -TEST(RealEigenDecomposition, EquivalenceWithVnl) +TEST(BridgeRealEigenDecomposition, EquivalenceWithVnl) { const double data[9] = { 0.0, -1.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 2.0 }; // spectrum {i, -i, 2} const vnl_matrix A(data, 3, 3); - const vnl_real_eigensystem vnlEngine(A); - const itk::RealEigenDecomposition itkEngine(A); + const vnl_real_eigensystem vnlEngine(A); + const itk::bridge::RealEigenDecomposition itkEngine(A); auto sorted = [](std::vector> v) { std::sort(v.begin(), v.end(), [](const std::complex & a, const std::complex & b) { diff --git a/Modules/Core/Common/test/itkSymmetricEigenDecompositionGTest.cxx b/Modules/Core/Common/test/itkBridgeSymmetricEigenDecompositionGTest.cxx similarity index 70% rename from Modules/Core/Common/test/itkSymmetricEigenDecompositionGTest.cxx rename to Modules/Core/Common/test/itkBridgeSymmetricEigenDecompositionGTest.cxx index fded06baa06..47ab09addb8 100644 --- a/Modules/Core/Common/test/itkSymmetricEigenDecompositionGTest.cxx +++ b/Modules/Core/Common/test/itkBridgeSymmetricEigenDecompositionGTest.cxx @@ -15,7 +15,7 @@ * limitations under the License. * *=========================================================================*/ -#include "itkSymmetricEigenDecomposition.h" +#include "itkBridgeSymmetricEigenDecomposition.h" #include "itkConfigure.h" #ifndef ITK_FUTURE_LEGACY_REMOVE # define ITK_LEGACY_TEST // exercise the deprecated vnl class for equivalence @@ -30,7 +30,7 @@ namespace template T -EigenResidual(const vnl_matrix & A, const itk::SymmetricEigenDecomposition & eig) +EigenResidual(const vnl_matrix & A, const itk::bridge::SymmetricEigenDecomposition & eig) { vnl_matrix D(A.rows(), A.cols(), T{ 0 }); for (unsigned int i = 0; i < A.rows(); ++i) @@ -50,10 +50,10 @@ MakeSymmetric() } // namespace // Scavenged coverage: eigenvalues ascending, A V == V D, V orthonormal. -TEST(SymmetricEigenDecomposition, DecompositionIdentity) +TEST(BridgeSymmetricEigenDecomposition, DecompositionIdentity) { - const vnl_matrix A = MakeSymmetric(); - const itk::SymmetricEigenDecomposition eig(A); + const vnl_matrix A = MakeSymmetric(); + const itk::bridge::SymmetricEigenDecomposition eig(A); for (unsigned int i = 1; i < 3; ++i) { @@ -71,14 +71,14 @@ TEST(SymmetricEigenDecomposition, DecompositionIdentity) } } -// itk::SymmetricEigenDecomposition and the legacy vnl class agree on eigenvalues +// itk::bridge::SymmetricEigenDecomposition and the legacy vnl class agree on eigenvalues // exactly and on eigenvectors up to per-column sign. #ifndef ITK_FUTURE_LEGACY_REMOVE -TEST(SymmetricEigenDecomposition, EquivalenceWithVnl) +TEST(BridgeSymmetricEigenDecomposition, EquivalenceWithVnl) { - const vnl_matrix A = MakeSymmetric(); - const itk::SymmetricEigenDecomposition eigNew(A); - const vnl_symmetric_eigensystem eigVnl(A); + const vnl_matrix A = MakeSymmetric(); + const itk::bridge::SymmetricEigenDecomposition eigNew(A); + const vnl_symmetric_eigensystem eigVnl(A); for (unsigned int i = 0; i < 3; ++i) { @@ -94,10 +94,10 @@ TEST(SymmetricEigenDecomposition, EquivalenceWithVnl) // The deterministic sign convention: each eigenvector column's // largest-magnitude entry is positive. This makes the decomposition // reproducible across solver/SIMD differences. -TEST(SymmetricEigenDecomposition, CanonicalSignConvention) +TEST(BridgeSymmetricEigenDecomposition, CanonicalSignConvention) { - const vnl_matrix A = MakeSymmetric(); - const itk::SymmetricEigenDecomposition eig(A); + const vnl_matrix A = MakeSymmetric(); + const itk::bridge::SymmetricEigenDecomposition eig(A); for (unsigned int j = 0; j < 3; ++j) { @@ -116,11 +116,11 @@ TEST(SymmetricEigenDecomposition, CanonicalSignConvention) // canonicalizeSigns=false keeps the solver's raw signs but stays a valid // decomposition; the default (true) enforces largest-magnitude-positive. -TEST(SymmetricEigenDecomposition, CanonicalizationIsOptOut) +TEST(BridgeSymmetricEigenDecomposition, CanonicalizationIsOptOut) { - const vnl_matrix A = MakeSymmetric(); - const itk::SymmetricEigenDecomposition canon(A); // default true - const itk::SymmetricEigenDecomposition raw(A, false); + const vnl_matrix A = MakeSymmetric(); + const itk::bridge::SymmetricEigenDecomposition canon(A); // default true + const itk::bridge::SymmetricEigenDecomposition raw(A, false); EXPECT_LT(EigenResidual(A, canon), 1e-12); EXPECT_LT(EigenResidual(A, raw), 1e-12); @@ -131,10 +131,10 @@ TEST(SymmetricEigenDecomposition, CanonicalizationIsOptOut) } } -TEST(SymmetricEigenDecomposition, NullvectorAndRecompose) +TEST(BridgeSymmetricEigenDecomposition, NullvectorAndRecompose) { - const vnl_matrix A = MakeSymmetric(); - const itk::SymmetricEigenDecomposition eig(A); + const vnl_matrix A = MakeSymmetric(); + const itk::bridge::SymmetricEigenDecomposition eig(A); // nullvector is the smallest-eigenvalue eigenvector (column 0). EXPECT_NEAR(dot_product(eig.nullvector(), eig.get_eigenvector(0)), 1.0, 1e-12); @@ -143,17 +143,17 @@ TEST(SymmetricEigenDecomposition, NullvectorAndRecompose) EXPECT_LT((eig.recompose() - A).fro_norm(), 1e-12); } -TEST(SymmetricEigenDecomposition, FloatInstantiation) +TEST(BridgeSymmetricEigenDecomposition, FloatInstantiation) { - float data[4] = { 2.0f, 0.5f, 0.5f, 3.0f }; - const vnl_matrix A(data, 2, 2); - const itk::SymmetricEigenDecomposition eig(A); + float data[4] = { 2.0f, 0.5f, 0.5f, 3.0f }; + const vnl_matrix A(data, 2, 2); + const itk::bridge::SymmetricEigenDecomposition eig(A); EXPECT_LT(EigenResidual(A, eig), 1e-5f); } // Non-finite input leaves the Eigen solver in a non-Success state; the wrapper // surfaces that as an exception rather than returning a garbage decomposition. -TEST(SymmetricEigenDecomposition, NonFiniteInputThrows) +TEST(BridgeSymmetricEigenDecomposition, NonFiniteInputThrows) { const double nan = std::numeric_limits::quiet_NaN(); vnl_matrix M(2, 2, 0.0); @@ -162,7 +162,7 @@ TEST(SymmetricEigenDecomposition, NonFiniteInputThrows) M(0, 1) = M(1, 0) = nan; try { - const itk::SymmetricEigenDecomposition eig{ M }; + const itk::bridge::SymmetricEigenDecomposition eig{ M }; FAIL() << "expected an exception for non-finite input"; } catch (const itk::ExceptionObject & e) diff --git a/Modules/Core/Common/test/itkVnlCholeskyEngineGTest.cxx b/Modules/Core/Common/test/itkVnlCholeskyEngineGTest.cxx index 908323d9a43..6b007d4e2ac 100644 --- a/Modules/Core/Common/test/itkVnlCholeskyEngineGTest.cxx +++ b/Modules/Core/Common/test/itkVnlCholeskyEngineGTest.cxx @@ -21,7 +21,7 @@ // core/vnl/algo/tests/test_cholesky.cxx so the coverage runs in ITK CI and // guards any future change of the underlying Cholesky engine. -#include "itkCholeskySolve.h" +#include "itkBridgeCholeskySolve.h" // The deprecated VNL engine under test is unavailable under ITK_FUTURE_LEGACY_REMOVE. #ifndef ITK_FUTURE_LEGACY_REMOVE @@ -182,7 +182,7 @@ TEST(VnlCholeskyEngine, EquivalentToItkCholeskySolve) const vnl_cholesky chol(A, vnl_cholesky::quiet); const vnl_vector xVnl = chol.solve(b); - const vnl_vector xItk = itk::Math::SolveSymmetricPositiveDefinite(A, b); + const vnl_vector xItk = itk::bridge::Math::SolveSymmetricPositiveDefinite(A, b); EXPECT_LT((xItk - xVnl).two_norm() / xVnl.two_norm(), 1e-10); } diff --git a/Modules/Core/TestKernel/include/itkTestingExtractSliceImageFilter.hxx b/Modules/Core/TestKernel/include/itkTestingExtractSliceImageFilter.hxx index dfcd9b3dc31..1af5919046e 100644 --- a/Modules/Core/TestKernel/include/itkTestingExtractSliceImageFilter.hxx +++ b/Modules/Core/TestKernel/include/itkTestingExtractSliceImageFilter.hxx @@ -19,7 +19,7 @@ #define itkTestingExtractSliceImageFilter_hxx #include "itkImageRegionIterator.h" -#include "itkMathDeterminant.h" +#include "itkBridgeMathDeterminant.h" #include "itkObjectFactory.h" #include "itkTotalProgressReporter.h" @@ -201,7 +201,7 @@ ExtractSliceImageFilter::GenerateOutputInformation() break; case TestExtractSliceImageFilterCollapseStrategyEnum::DIRECTIONCOLLAPSETOSUBMATRIX: { - if (Math::Determinant(outputDirection.GetVnlMatrix()) == 0.0) + if (bridge::Math::Determinant(outputDirection.GetVnlMatrix()) == 0.0) { itkExceptionStringMacro("Invalid submatrix extracted for collapsed direction."); } @@ -209,7 +209,7 @@ ExtractSliceImageFilter::GenerateOutputInformation() break; case TestExtractSliceImageFilterCollapseStrategyEnum::DIRECTIONCOLLAPSETOGUESS: { - if (Math::Determinant(outputDirection.GetVnlMatrix()) == 0.0) + if (bridge::Math::Determinant(outputDirection.GetVnlMatrix()) == 0.0) { outputDirection.SetIdentity(); } diff --git a/Modules/Core/Transform/include/itkComposeScaleSkewVersor3DTransform.hxx b/Modules/Core/Transform/include/itkComposeScaleSkewVersor3DTransform.hxx index 31bf560c619..913c53196a5 100644 --- a/Modules/Core/Transform/include/itkComposeScaleSkewVersor3DTransform.hxx +++ b/Modules/Core/Transform/include/itkComposeScaleSkewVersor3DTransform.hxx @@ -19,7 +19,7 @@ #define itkComposeScaleSkewVersor3DTransform_hxx #include "itkMath.h" -#include "itkMathDeterminant.h" +#include "itkBridgeMathDeterminant.h" namespace itk { @@ -279,7 +279,7 @@ ComposeScaleSkewVersor3DTransform::ComputeMatrixParameters M(2, 2) /= m_Scale[2]; m_Skew[1] = ortho0 / m_Scale[0]; m_Skew[2] = ortho1 / m_Scale[1]; - if (Math::Determinant(M.GetVnlMatrix()) < 0) + if (bridge::Math::Determinant(M.GetVnlMatrix()) < 0) { m_Scale[0] *= -1; M(0, 0) *= -1; diff --git a/Modules/Core/Transform/include/itkKernelTransform.hxx b/Modules/Core/Transform/include/itkKernelTransform.hxx index 1e124876fef..e0fbeddf681 100644 --- a/Modules/Core/Transform/include/itkKernelTransform.hxx +++ b/Modules/Core/Transform/include/itkKernelTransform.hxx @@ -18,7 +18,7 @@ #ifndef itkKernelTransform_hxx #define itkKernelTransform_hxx -#include "itkMathSVD.h" +#include "itkBridgeMathSVD.h" namespace itk { @@ -142,7 +142,7 @@ KernelTransform::ComputeWMatrix() { this->ComputeL(); this->ComputeY(); - const auto svd = itk::Math::SVD(this->m_LMatrix, /*canonicalizeSigns=*/false); + const auto svd = itk::bridge::Math::SVD(this->m_LMatrix, /*canonicalizeSigns=*/false); // Absolute 1e-8 singular-value tolerance; guard the degenerate all-zero L. const auto wmax = svd.W[0]; const auto rcond = diff --git a/Modules/Core/Transform/include/itkRigid2DTransform.hxx b/Modules/Core/Transform/include/itkRigid2DTransform.hxx index cd2160c5e44..3e7a5a3d6c0 100644 --- a/Modules/Core/Transform/include/itkRigid2DTransform.hxx +++ b/Modules/Core/Transform/include/itkRigid2DTransform.hxx @@ -18,7 +18,7 @@ #ifndef itkRigid2DTransform_hxx #define itkRigid2DTransform_hxx -#include "itkMathSVD.h" +#include "itkBridgeMathSVD.h" #include "itkPrintHelper.h" namespace itk @@ -90,7 +90,7 @@ void Rigid2DTransform::ComputeMatrixParameters() { // Extract the orthogonal part of the matrix (U V^T is the closest rotation). - const auto svd = itk::Math::SVD(this->GetMatrix()); + const auto svd = itk::bridge::Math::SVD(this->GetMatrix()); vnl_matrix r{ (svd.U * svd.V.transpose()).as_matrix() }; m_Angle = std::acos(r[0][0]); diff --git a/Modules/Core/Transform/include/itkSimilarity3DTransform.hxx b/Modules/Core/Transform/include/itkSimilarity3DTransform.hxx index 7f93a523575..c1ae951c856 100644 --- a/Modules/Core/Transform/include/itkSimilarity3DTransform.hxx +++ b/Modules/Core/Transform/include/itkSimilarity3DTransform.hxx @@ -19,7 +19,7 @@ #define itkSimilarity3DTransform_hxx #include "itkMath.h" -#include "itkMathDeterminant.h" +#include "itkBridgeMathDeterminant.h" #include "itkPrintHelper.h" namespace itk @@ -85,7 +85,7 @@ Similarity3DTransform::SetMatrix(const MatrixType & matrix // multiplied by the scale factor, then its determinant // must be equal to the cube of the scale factor. // - const double det = Math::Determinant(matrix.GetVnlMatrix()); + const double det = bridge::Math::Determinant(matrix.GetVnlMatrix()); if (det == 0.0) { @@ -290,7 +290,7 @@ Similarity3DTransform::ComputeMatrixParameters() { MatrixType matrix = this->GetMatrix(); - m_Scale = itk::Math::cbrt(Math::Determinant(matrix.GetVnlMatrix())); + m_Scale = itk::Math::cbrt(bridge::Math::Determinant(matrix.GetVnlMatrix())); matrix /= m_Scale; diff --git a/Modules/Core/Transform/include/itkTransform.hxx b/Modules/Core/Transform/include/itkTransform.hxx index 8703216d6a9..463a5bda464 100644 --- a/Modules/Core/Transform/include/itkTransform.hxx +++ b/Modules/Core/Transform/include/itkTransform.hxx @@ -19,7 +19,7 @@ #define itkTransform_hxx #include "itkCrossHelper.h" -#include "itkMathSVD.h" +#include "itkBridgeMathSVD.h" #if !defined(ITK_LEGACY_REMOVE) && !defined(ITK_FUTURE_LEGACY_REMOVE) # include "vnl/algo/vnl_svd_fixed.h" // transitional transitive include; dropped on ITK legacy removal #endif @@ -543,11 +543,11 @@ Transform::ComputeInver if constexpr (VOutputDimension == VInputDimension) { // Square: fixed-size pseudo-inverse avoids the dynamic as_matrix() round-trip. - jacobian = Math::SVD(forward_jacobian).PseudoInverse(); + jacobian = bridge::Math::SVD(forward_jacobian).PseudoInverse(); } else { - jacobian.set(Math::SVD(forward_jacobian.as_matrix()).PseudoInverse().data_block()); + jacobian.set(bridge::Math::SVD(forward_jacobian.as_matrix()).PseudoInverse().data_block()); } } diff --git a/Modules/Filtering/DiffusionTensorImage/include/itkDiffusionTensor3DReconstructionImageFilter.h b/Modules/Filtering/DiffusionTensorImage/include/itkDiffusionTensor3DReconstructionImageFilter.h index 4e6966dc72e..694eec327f3 100644 --- a/Modules/Filtering/DiffusionTensorImage/include/itkDiffusionTensor3DReconstructionImageFilter.h +++ b/Modules/Filtering/DiffusionTensorImage/include/itkDiffusionTensor3DReconstructionImageFilter.h @@ -24,7 +24,7 @@ #include "vnl/vnl_matrix.h" #include "vnl/vnl_vector_fixed.h" #include "vnl/vnl_matrix_fixed.h" -#include "itkMathSVD.h" +#include "itkBridgeMathSVD.h" #if !defined(ITK_LEGACY_REMOVE) && !defined(ITK_FUTURE_LEGACY_REMOVE) # include "vnl/algo/vnl_svd.h" // transitional transitive include; dropped on ITK legacy removal #endif diff --git a/Modules/Filtering/DiffusionTensorImage/include/itkDiffusionTensor3DReconstructionImageFilter.hxx b/Modules/Filtering/DiffusionTensorImage/include/itkDiffusionTensor3DReconstructionImageFilter.hxx index ceb52082b0d..dd5a6fdf759 100644 --- a/Modules/Filtering/DiffusionTensorImage/include/itkDiffusionTensor3DReconstructionImageFilter.hxx +++ b/Modules/Filtering/DiffusionTensorImage/include/itkDiffusionTensor3DReconstructionImageFilter.hxx @@ -25,7 +25,7 @@ #include "itkImageMaskSpatialObject.h" #include "vnl/vnl_vector.h" #include "itkTotalProgressReporter.h" -#include "itkMathSVD.h" +#include "itkBridgeMathSVD.h" namespace itk { @@ -435,7 +435,7 @@ DiffusionTensor3DReconstructionImageFilter } // Return determinant of physical Jacobian: - return Math::Determinant(physicalGrad); + return bridge::Math::Determinant(physicalGrad); } template diff --git a/Modules/Filtering/DisplacementField/include/itkDisplacementFieldTransform.hxx b/Modules/Filtering/DisplacementField/include/itkDisplacementFieldTransform.hxx index 8d8496821ba..83b2b32c5a5 100644 --- a/Modules/Filtering/DisplacementField/include/itkDisplacementFieldTransform.hxx +++ b/Modules/Filtering/DisplacementField/include/itkDisplacementFieldTransform.hxx @@ -21,7 +21,7 @@ #include "itkVectorLinearInterpolateImageFunction.h" #include "itkImageToImageFilter.h" -#include "itkMathSVD.h" +#include "itkBridgeMathSVD.h" #include "itkCastImageFilter.h" #include // For min and max. #include "itkPrintHelper.h" @@ -190,7 +190,7 @@ DisplacementFieldTransform::GetInverseJacobian { this->ComputeJacobianWithRespectToPositionInternal(index, jacobian, false); // rcond = 0 keeps every nonzero singular value (no truncation). - jacobian = itk::Math::SVD(jacobian, /*canonicalizeSigns=*/false).PseudoInverse(0); + jacobian = itk::bridge::Math::SVD(jacobian, /*canonicalizeSigns=*/false).PseudoInverse(0); } else { diff --git a/Modules/Filtering/ImageGradient/include/itkVectorGradientMagnitudeImageFilter.h b/Modules/Filtering/ImageGradient/include/itkVectorGradientMagnitudeImageFilter.h index e58dd254c55..86be13ae7ca 100644 --- a/Modules/Filtering/ImageGradient/include/itkVectorGradientMagnitudeImageFilter.h +++ b/Modules/Filtering/ImageGradient/include/itkVectorGradientMagnitudeImageFilter.h @@ -24,7 +24,7 @@ #include "itkVector.h" #include "vnl/vnl_matrix.h" #include "vnl/vnl_vector_fixed.h" -#include "itkSymmetricEigenDecomposition.h" +#include "itkBridgeSymmetricEigenDecomposition.h" #include "itkMath.h" namespace itk @@ -468,7 +468,7 @@ class ITK_TEMPLATE_EXPORT VectorGradientMagnitudeImageFilter : public ImageToIma } // Find the eigenvalues of g - const itk::SymmetricEigenDecomposition E(g); + const itk::bridge::SymmetricEigenDecomposition E(g); // Return the difference in length between the first two principle axes. // Note that other edge strength metrics may be appropriate here instead.. diff --git a/Modules/Filtering/ImageGrid/include/itkBSplineControlPointImageFilter.hxx b/Modules/Filtering/ImageGrid/include/itkBSplineControlPointImageFilter.hxx index 1c13b3a601f..84eb28dd13e 100644 --- a/Modules/Filtering/ImageGrid/include/itkBSplineControlPointImageFilter.hxx +++ b/Modules/Filtering/ImageGrid/include/itkBSplineControlPointImageFilter.hxx @@ -20,7 +20,7 @@ #include "itkMath.h" -#include "itkMathSVD.h" +#include "itkBridgeMathSVD.h" #include "itkImageDuplicator.h" #include "itkImageRegionConstIteratorWithIndex.h" #include "itkImageRegionIterator.h" @@ -135,7 +135,7 @@ BSplineControlPointImageFilter::SetSplineOrder(ArrayT // rcond = 0 keeps every nonzero singular value (no truncation). this->m_RefinedLatticeCoefficients[i] = - (itk::Math::SVD(R, /*canonicalizeSigns=*/false).PseudoInverse(0) * S).extract(2, S.cols()); + (itk::bridge::Math::SVD(R, /*canonicalizeSigns=*/false).PseudoInverse(0) * S).extract(2, S.cols()); } } this->Modified(); diff --git a/Modules/Filtering/ImageGrid/include/itkBSplineScatteredDataPointSetToImageFilter.hxx b/Modules/Filtering/ImageGrid/include/itkBSplineScatteredDataPointSetToImageFilter.hxx index f86097b43fd..6465467c7b9 100644 --- a/Modules/Filtering/ImageGrid/include/itkBSplineScatteredDataPointSetToImageFilter.hxx +++ b/Modules/Filtering/ImageGrid/include/itkBSplineScatteredDataPointSetToImageFilter.hxx @@ -24,7 +24,7 @@ #include "itkCastImageFilter.h" #include "itkNumericTraits.h" #include "itkMath.h" -#include "itkMathSVD.h" +#include "itkBridgeMathSVD.h" #include "itkPrintHelper.h" namespace itk @@ -121,7 +121,7 @@ BSplineScatteredDataPointSetToImageFilter::SetSpli // rcond = 0 keeps every nonzero singular value (no truncation). this->m_RefinedLatticeCoefficients[i] = - (itk::Math::SVD(R, /*canonicalizeSigns=*/false).PseudoInverse(0) * S).extract(2, S.cols()); + (itk::bridge::Math::SVD(R, /*canonicalizeSigns=*/false).PseudoInverse(0) * S).extract(2, S.cols()); } } this->Modified(); diff --git a/Modules/Filtering/ImageStatistics/include/itkImageMomentsCalculator.hxx b/Modules/Filtering/ImageStatistics/include/itkImageMomentsCalculator.hxx index 5b188aa2c49..ebdf987a9bc 100644 --- a/Modules/Filtering/ImageStatistics/include/itkImageMomentsCalculator.hxx +++ b/Modules/Filtering/ImageStatistics/include/itkImageMomentsCalculator.hxx @@ -18,8 +18,8 @@ #ifndef itkImageMomentsCalculator_hxx #define itkImageMomentsCalculator_hxx -#include "itkRealEigenDecomposition.h" -#include "itkSymmetricEigenDecomposition.h" +#include "itkBridgeRealEigenDecomposition.h" +#include "itkBridgeSymmetricEigenDecomposition.h" #include "itkImageRegionConstIteratorWithIndex.h" #include "vnl/vnl_diag_matrix.h" @@ -147,8 +147,8 @@ ImageMomentsCalculator::Compute() } // Compute principal moments and axes - const itk::SymmetricEigenDecomposition eigen{ m_Cm.GetVnlMatrix().as_matrix() }; - vnl_diag_matrix pm{ eigen.D }; + const itk::bridge::SymmetricEigenDecomposition eigen{ m_Cm.GetVnlMatrix().as_matrix() }; + vnl_diag_matrix pm{ eigen.D }; for (unsigned int i = 0; i < ImageDimension; ++i) { m_Pm[i] = pm(i) * m_M0; @@ -157,9 +157,9 @@ ImageMomentsCalculator::Compute() // Add a final reflection if needed for a proper rotation, // by multiplying the last row by the determinant - const itk::RealEigenDecomposition eigenrot{ m_Pa.GetVnlMatrix().as_matrix() }; - const vnl_vector> & eigenval = eigenrot.GetEigenvalues(); - std::complex det(1.0, 0.0); + const itk::bridge::RealEigenDecomposition eigenrot{ m_Pa.GetVnlMatrix().as_matrix() }; + const vnl_vector> & eigenval = eigenrot.GetEigenvalues(); + std::complex det(1.0, 0.0); for (unsigned int i = 0; i < ImageDimension; ++i) { diff --git a/Modules/Filtering/ImageStatistics/include/itkImagePCAShapeModelEstimator.h b/Modules/Filtering/ImageStatistics/include/itkImagePCAShapeModelEstimator.h index 6c862f26242..d196245f8e5 100644 --- a/Modules/Filtering/ImageStatistics/include/itkImagePCAShapeModelEstimator.h +++ b/Modules/Filtering/ImageStatistics/include/itkImagePCAShapeModelEstimator.h @@ -35,7 +35,7 @@ #include "itkImageShapeModelEstimatorBase.h" #include "itkConceptChecking.h" #include "itkImage.h" -#include "itkGeneralizedEigenDecomposition.h" +#include "itkBridgeGeneralizedEigenDecomposition.h" namespace itk { diff --git a/Modules/Filtering/ImageStatistics/include/itkImagePCAShapeModelEstimator.hxx b/Modules/Filtering/ImageStatistics/include/itkImagePCAShapeModelEstimator.hxx index 5691eda1515..d6e8180b6a1 100644 --- a/Modules/Filtering/ImageStatistics/include/itkImagePCAShapeModelEstimator.hxx +++ b/Modules/Filtering/ImageStatistics/include/itkImagePCAShapeModelEstimator.hxx @@ -340,7 +340,7 @@ ImagePCAShapeModelEstimator::EstimatePCAShapeModelPar identityMatrix.set_identity(); - const itk::GeneralizedEigenDecomposition eigenVectors_eigenValues(m_InnerProduct, identityMatrix); + const itk::bridge::GeneralizedEigenDecomposition eigenVectors_eigenValues(m_InnerProduct, identityMatrix); MatrixOfDoubleType eigenVectorsOfInnerProductMatrix = eigenVectors_eigenValues.GetEigenvectors(); diff --git a/Modules/Filtering/LabelMap/include/itkShapeLabelMapFilter.hxx b/Modules/Filtering/LabelMap/include/itkShapeLabelMapFilter.hxx index 1ee8e14bdda..d3c7df6d960 100644 --- a/Modules/Filtering/LabelMap/include/itkShapeLabelMapFilter.hxx +++ b/Modules/Filtering/LabelMap/include/itkShapeLabelMapFilter.hxx @@ -25,8 +25,8 @@ #include "itkConstantBoundaryCondition.h" #include "itkGeometryUtilities.h" #include "itkConnectedComponentAlgorithm.h" -#include "itkRealEigenDecomposition.h" -#include "itkSymmetricEigenDecomposition.h" +#include "itkBridgeRealEigenDecomposition.h" +#include "itkBridgeSymmetricEigenDecomposition.h" #include "itkMath.h" #include "itkLexicographicCompare.h" #include @@ -307,9 +307,9 @@ ShapeLabelMapFilter::ThreadedProcessLabelObject(LabelObject } // Compute principal moments and axes - VectorType principalMoments; - const itk::SymmetricEigenDecomposition eigen{ centralMoments.GetVnlMatrix().as_matrix() }; - vnl_diag_matrix pm = eigen.D; + VectorType principalMoments; + const itk::bridge::SymmetricEigenDecomposition eigen{ centralMoments.GetVnlMatrix().as_matrix() }; + vnl_diag_matrix pm = eigen.D; for (unsigned int i = 0; i < ImageDimension; ++i) { // Clamp to zero: near-zero negative eigenvalues from numerical precision cause FPE in std::pow(edet, ...) @@ -319,9 +319,9 @@ ShapeLabelMapFilter::ThreadedProcessLabelObject(LabelObject // Add a final reflection if needed for a proper rotation, // by multiplying the last row by the determinant - const itk::RealEigenDecomposition eigenrot{ principalAxes.GetVnlMatrix().as_matrix() }; - const vnl_vector> & eigenval = eigenrot.GetEigenvalues(); - std::complex det(1.0, 0.0); + const itk::bridge::RealEigenDecomposition eigenrot{ principalAxes.GetVnlMatrix().as_matrix() }; + const vnl_vector> & eigenval = eigenrot.GetEigenvalues(); + std::complex det(1.0, 0.0); for (unsigned int i = 0; i < ImageDimension; ++i) { diff --git a/Modules/Filtering/LabelMap/include/itkStatisticsLabelMapFilter.hxx b/Modules/Filtering/LabelMap/include/itkStatisticsLabelMapFilter.hxx index 13d78a5ae9c..1088fdcfcfa 100644 --- a/Modules/Filtering/LabelMap/include/itkStatisticsLabelMapFilter.hxx +++ b/Modules/Filtering/LabelMap/include/itkStatisticsLabelMapFilter.hxx @@ -21,8 +21,8 @@ #include "itkMath.h" #include "itkMinimumMaximumImageCalculator.h" #include "itkProgressReporter.h" -#include "itkRealEigenDecomposition.h" -#include "itkSymmetricEigenDecomposition.h" +#include "itkBridgeRealEigenDecomposition.h" +#include "itkBridgeSymmetricEigenDecomposition.h" #include "vnl/vnl_diag_matrix.h" namespace itk @@ -229,8 +229,8 @@ StatisticsLabelMapFilter::ThreadedProcessLabelObject(Labe } // Compute principal moments and axes - const itk::SymmetricEigenDecomposition eigen{ centralMoments.GetVnlMatrix().as_matrix() }; - vnl_diag_matrix pm{ eigen.D }; + const itk::bridge::SymmetricEigenDecomposition eigen{ centralMoments.GetVnlMatrix().as_matrix() }; + vnl_diag_matrix pm{ eigen.D }; for (unsigned int i = 0; i < ImageDimension; ++i) { // principalMoments[i] = 4 * std::sqrt( pm(i,i) ); @@ -240,9 +240,9 @@ StatisticsLabelMapFilter::ThreadedProcessLabelObject(Labe // Add a final reflection if needed for a proper rotation, // by multiplying the last row by the determinant - const itk::RealEigenDecomposition eigenrot{ principalAxes.GetVnlMatrix().as_matrix() }; - const vnl_vector> & eigenval = eigenrot.GetEigenvalues(); - std::complex det(1.0, 0.0); + const itk::bridge::RealEigenDecomposition eigenrot{ principalAxes.GetVnlMatrix().as_matrix() }; + const vnl_vector> & eigenval = eigenrot.GetEigenvalues(); + std::complex det(1.0, 0.0); for (unsigned int i = 0; i < ImageDimension; ++i) { diff --git a/Modules/Filtering/QuadEdgeMeshFiltering/include/itkQuadEdgeMeshDecimationQuadricElementHelper.h b/Modules/Filtering/QuadEdgeMeshFiltering/include/itkQuadEdgeMeshDecimationQuadricElementHelper.h index 33b5ade72c5..ad8bfa4dd33 100644 --- a/Modules/Filtering/QuadEdgeMeshFiltering/include/itkQuadEdgeMeshDecimationQuadricElementHelper.h +++ b/Modules/Filtering/QuadEdgeMeshFiltering/include/itkQuadEdgeMeshDecimationQuadricElementHelper.h @@ -19,7 +19,7 @@ #define itkQuadEdgeMeshDecimationQuadricElementHelper_h #include "itkPoint.h" -#include "itkMathSVD.h" +#include "itkBridgeMathSVD.h" #include "vnl/vnl_vector_fixed.h" #include "vnl/vnl_matrix.h" #include @@ -100,7 +100,7 @@ class QuadEdgeMeshDecimationQuadricElementHelper ComputeError(const PointType & iP) const { // ComputeAMatrixAndBVector(); - const auto svd = itk::Math::SVD(m_A, /*canonicalizeSigns=*/false); + const auto svd = itk::bridge::Math::SVD(m_A, /*canonicalizeSigns=*/false); const CoordType wmax = svd.W[0]; // Fold the absolute and relative singular-value tolerances into one rcond. const CoordType rcond = @@ -149,7 +149,7 @@ class QuadEdgeMeshDecimationQuadricElementHelper { ComputeAMatrixAndBVector(); - const auto svd = itk::Math::SVD(m_A, /*canonicalizeSigns=*/false); + const auto svd = itk::bridge::Math::SVD(m_A, /*canonicalizeSigns=*/false); const CoordType wmax = svd.W[0]; const CoordType rcond = (wmax > CoordType{}) ? std::max(m_SVDAbsoluteThreshold / wmax, m_SVDRelativeThreshold) : m_SVDRelativeThreshold; diff --git a/Modules/IO/IOFDF/src/itkFDFImageIO.cxx b/Modules/IO/IOFDF/src/itkFDFImageIO.cxx index c95758fe0db..662e9c78d50 100644 --- a/Modules/IO/IOFDF/src/itkFDFImageIO.cxx +++ b/Modules/IO/IOFDF/src/itkFDFImageIO.cxx @@ -17,7 +17,7 @@ *=========================================================================*/ #include "itkFDFImageIO.h" #include "itkFDFCommonImageIO.h" -#include "itkMathDeterminant.h" +#include "itkBridgeMathDeterminant.h" #include "itkByteSwapper.h" #include "itkRGBPixel.h" @@ -176,7 +176,7 @@ FDFImageIO::ReadImageInformation() // direction matrix in the file is 3x3. // if direction matrix is degenerate, punt and set // directions to identity - if (itk::Math::Determinant(testDirections) == 0) + if (itk::bridge::Math::Determinant(testDirections) == 0) { for (unsigned int i = 0; i < numDim; i++) { diff --git a/Modules/IO/ImageBase/include/itkImageSeriesWriter.hxx b/Modules/IO/ImageBase/include/itkImageSeriesWriter.hxx index e509ae48de4..bf6a79a2a05 100644 --- a/Modules/IO/ImageBase/include/itkImageSeriesWriter.hxx +++ b/Modules/IO/ImageBase/include/itkImageSeriesWriter.hxx @@ -25,7 +25,7 @@ #include "itkImageAlgorithm.h" #include "itkMetaDataObject.h" #include "itkArray.h" -#include "itkMathDeterminant.h" +#include "itkBridgeMathDeterminant.h" #include namespace itk @@ -214,7 +214,7 @@ ImageSeriesWriter::WriteFiles() // therefore, replacing the orientation with an identity // is as arbitrary as any other choice. // - if (Math::Determinant(direction.GetVnlMatrix()) == 0.0) + if (bridge::Math::Determinant(direction.GetVnlMatrix()) == 0.0) { direction.SetIdentity(); } diff --git a/Modules/IO/MINC/src/itkMINCImageIO.cxx b/Modules/IO/MINC/src/itkMINCImageIO.cxx index 5e3c56ebec9..8443ad671d6 100644 --- a/Modules/IO/MINC/src/itkMINCImageIO.cxx +++ b/Modules/IO/MINC/src/itkMINCImageIO.cxx @@ -22,7 +22,7 @@ #include "vnl/vnl_vector.h" #include "itkMetaDataObject.h" #include "itkArray.h" -#include "itkMathSVD.h" +#include "itkBridgeMathSVD.h" #include "itkPrintHelper.h" #include "itkMakeUniqueForOverwrite.h" @@ -983,7 +983,7 @@ MINCImageIO::WriteImageInformation() origin[i] = this->GetOrigin(i); } - const vnl_matrix inverseDirectionCosines{ itk::Math::SVD(directionCosineMatrix).PseudoInverse() }; + const vnl_matrix inverseDirectionCosines{ itk::bridge::Math::SVD(directionCosineMatrix).PseudoInverse() }; origin *= inverseDirectionCosines; // transform to minc convention diff --git a/Modules/IO/NIFTI/src/itkNiftiImageIO.cxx b/Modules/IO/NIFTI/src/itkNiftiImageIO.cxx index 968c95bbb80..6e16d4cc8ad 100644 --- a/Modules/IO/NIFTI/src/itkNiftiImageIO.cxx +++ b/Modules/IO/NIFTI/src/itkNiftiImageIO.cxx @@ -21,7 +21,7 @@ #include "itkMetaDataObject.h" #include "itkNumberToString.h" #include "itkAnatomicalOrientation.h" -#include "itkMathSVD.h" +#include "itkBridgeMathSVD.h" #include #include "itkNiftiImageIOConfigurePrivate.h" #include "itkMakeUniqueForOverwrite.h" @@ -1597,7 +1597,7 @@ IsAffine(const mat44 & nifti_mat) } } - const double condition = itk::Math::SVD(mat.as_matrix()).WellCondition(); + const double condition = itk::bridge::Math::SVD(mat.as_matrix()).WellCondition(); // Check matrix is invertible by testing condition number of inverse if (!(condition > std::numeric_limits::epsilon())) { @@ -1606,14 +1606,15 @@ IsAffine(const mat44 & nifti_mat) // Calculate the inverse and separate the inverse translation component // and the top 3x3 part of the inverse matrix - const vnl_matrix_fixed inv4x4Matrix = itk::Math::SVD(mat.as_matrix()).PseudoInverse(); + const vnl_matrix_fixed inv4x4Matrix = itk::bridge::Math::SVD(mat.as_matrix()).PseudoInverse(); const vnl_vector_fixed inv4x4Translation(inv4x4Matrix[0][3], inv4x4Matrix[1][3], inv4x4Matrix[2][3]); const vnl_matrix_fixed inv4x4Top3x3 = inv4x4Matrix.extract(3, 3, 0, 0); // Grab just the top 3x3 matrix const vnl_matrix_fixed top3x3Matrix = mat.extract(3, 3, 0, 0); - const vnl_matrix_fixed invTop3x3Matrix = itk::Math::SVD(top3x3Matrix.as_matrix()).PseudoInverse(); - const vnl_vector_fixed inv3x3Translation = -(invTop3x3Matrix * mat.get_column(3).extract(3)); + const vnl_matrix_fixed invTop3x3Matrix = + itk::bridge::Math::SVD(top3x3Matrix.as_matrix()).PseudoInverse(); + const vnl_vector_fixed inv3x3Translation = -(invTop3x3Matrix * mat.get_column(3).extract(3)); // Make sure we adhere to the conditions of a 4x4 invertible affine transform matrix const double diff_matrix_array_one_norm = (inv4x4Top3x3 - invTop3x3Matrix).array_one_norm(); @@ -1809,8 +1810,8 @@ NiftiImageIO::SetImageIOOrientationFromNIfTI(unsigned short dims, double spacing // extract rotation matrix const vnl_matrix_fixed sform_3x3 = sform_as_matrix.extract(3, 3, 0, 0); const vnl_matrix_fixed qform_3x3 = qform_as_matrix.extract(3, 3, 0, 0); - const auto sform_svd = itk::Math::SVD(sform_3x3); - const auto qform_svd = itk::Math::SVD(qform_3x3); + const auto sform_svd = itk::bridge::Math::SVD(sform_3x3); + const auto qform_svd = itk::bridge::Math::SVD(qform_3x3); // extract offset const vnl_vector sform_offset{ sform_as_matrix.get_column(3).extract(3, 0) }; @@ -1848,7 +1849,7 @@ NiftiImageIO::SetImageIOOrientationFromNIfTI(unsigned short dims, double spacing mat[i][j] = double{ m_Holder->ptr->sto_xyz.m[i][j] }; } - const auto svd = itk::Math::SVD(mat); + const auto svd = itk::bridge::Math::SVD(mat); if (svd.W.min_value() > 1e-8) { diff --git a/Modules/Nonunit/Review/include/itkLabelGeometryImageFilter.h b/Modules/Nonunit/Review/include/itkLabelGeometryImageFilter.h index d33ab7377f3..91781d3bf0a 100644 --- a/Modules/Nonunit/Review/include/itkLabelGeometryImageFilter.h +++ b/Modules/Nonunit/Review/include/itkLabelGeometryImageFilter.h @@ -24,8 +24,8 @@ #include "itkSimpleDataObjectDecorator.h" #include #include -#include "itkSymmetricEigenDecomposition.h" -#include "itkMathDeterminant.h" +#include "itkBridgeSymmetricEigenDecomposition.h" +#include "itkBridgeMathDeterminant.h" #include "itkMath.h" namespace itk @@ -500,7 +500,8 @@ class ITK_TEMPLATE_EXPORT private: bool - CalculateOrientedBoundingBoxVertices(itk::SymmetricEigenDecomposition eig, LabelGeometry & m_LabelGeometry); + CalculateOrientedBoundingBoxVertices(itk::bridge::SymmetricEigenDecomposition eig, + LabelGeometry & m_LabelGeometry); bool m_CalculatePixelIndices{}; bool m_CalculateOrientedBoundingBox{}; diff --git a/Modules/Nonunit/Review/include/itkLabelGeometryImageFilter.hxx b/Modules/Nonunit/Review/include/itkLabelGeometryImageFilter.hxx index 32493b819d8..82b153c6b9f 100644 --- a/Modules/Nonunit/Review/include/itkLabelGeometryImageFilter.hxx +++ b/Modules/Nonunit/Review/include/itkLabelGeometryImageFilter.hxx @@ -43,7 +43,7 @@ namespace // template inline vnl_matrix -CalculateRotationMatrix(const itk::SymmetricEigenDecomposition & eig) +CalculateRotationMatrix(const itk::bridge::SymmetricEigenDecomposition & eig) { vnl_matrix rotationMatrix(VDimension, VDimension, 0); for (unsigned int i = 0; i < VDimension; ++i) @@ -62,7 +62,7 @@ CalculateRotationMatrix(const itk::SymmetricEigenDecomposition & eig) float matrixDet = NAN; if constexpr (VDimension == 2 || VDimension == 3) { - matrixDet = static_cast(itk::Math::Determinant(rotationMatrix)); + matrixDet = static_cast(itk::bridge::Math::Determinant(rotationMatrix)); } else { @@ -83,7 +83,7 @@ CalculateRotationMatrix(const itk::SymmetricEigenDecomposition & eig) template inline bool -CalculateOrientedImage(const itk::SymmetricEigenDecomposition & eig, +CalculateOrientedImage(const itk::bridge::SymmetricEigenDecomposition & eig, typename LabelGeometryImageFilter::LabelGeometry & labelGeometry, bool useLabelImage, const TInputImage * inputImage) @@ -360,7 +360,7 @@ LabelGeometryImageFilter::GenerateData() // Compute the eigenvalues/eigenvectors of the covariance matrix. // The result is stored in increasing eigenvalues with // corresponding eigenvectors. - itk::SymmetricEigenDecomposition eig(normalizedSecondOrderCentralMoments); + itk::bridge::SymmetricEigenDecomposition eig(normalizedSecondOrderCentralMoments); // Calculate the eigenvalues/eigenvectors VectorType eigenvalues(ImageDimension, 0); @@ -416,8 +416,8 @@ LabelGeometryImageFilter::GenerateData() template bool LabelGeometryImageFilter::CalculateOrientedBoundingBoxVertices( - itk::SymmetricEigenDecomposition eig, - LabelGeometry & labelGeometry) + itk::bridge::SymmetricEigenDecomposition eig, + LabelGeometry & labelGeometry) { // Calculate the oriented bounding box using the eigenvectors. // For each label, the pixels are rotated to the new coordinate diff --git a/Modules/Numerics/Optimizersv4/include/itkQuasiNewtonOptimizerv4.h b/Modules/Numerics/Optimizersv4/include/itkQuasiNewtonOptimizerv4.h index 987db761366..68d8f466e91 100644 --- a/Modules/Numerics/Optimizersv4/include/itkQuasiNewtonOptimizerv4.h +++ b/Modules/Numerics/Optimizersv4/include/itkQuasiNewtonOptimizerv4.h @@ -22,11 +22,11 @@ #include "itkBooleanStdVector.h" #include "itkGradientDescentOptimizerv4.h" -#include "itkMathSVD.h" +#include "itkBridgeMathSVD.h" #if !defined(ITK_LEGACY_REMOVE) && !defined(ITK_FUTURE_LEGACY_REMOVE) # include "vnl/algo/vnl_matrix_inverse.h" // transitional transitive include; dropped on ITK legacy removal #endif -#include "itkMathDeterminant.h" +#include "itkBridgeMathDeterminant.h" namespace itk { diff --git a/Modules/Numerics/Optimizersv4/include/itkQuasiNewtonOptimizerv4.hxx b/Modules/Numerics/Optimizersv4/include/itkQuasiNewtonOptimizerv4.hxx index 1eb4003ce3d..24423998aa5 100644 --- a/Modules/Numerics/Optimizersv4/include/itkQuasiNewtonOptimizerv4.hxx +++ b/Modules/Numerics/Optimizersv4/include/itkQuasiNewtonOptimizerv4.hxx @@ -386,7 +386,7 @@ QuasiNewtonOptimizerv4Template::ComputeHessianAnd TInternalComputationValueType threshold = NumericTraits::epsilon(); - if (itk::Math::Absolute(Math::Determinant(newHessian)) <= threshold) + if (itk::Math::Absolute(bridge::Math::Determinant(newHessian)) <= threshold) { return false; } @@ -398,7 +398,9 @@ QuasiNewtonOptimizerv4Template::ComputeHessianAnd gradient[p] = this->m_Gradient[offset + p]; } - const vnl_matrix hessianInverse{ itk::Math::SVD(newHessian).PseudoInverse() }; + const vnl_matrix hessianInverse{ + itk::bridge::Math::SVD(newHessian).PseudoInverse() + }; // gradient is already negated const DerivativeType newtonStep{ hessianInverse * gradient }; for (SizeValueType p = 0; p < numLocalPara; ++p) diff --git a/Modules/Numerics/PrincipalComponentsAnalysis/include/itkVectorFieldPCA.hxx b/Modules/Numerics/PrincipalComponentsAnalysis/include/itkVectorFieldPCA.hxx index b1540fd0fc6..5b45a43f35f 100644 --- a/Modules/Numerics/PrincipalComponentsAnalysis/include/itkVectorFieldPCA.hxx +++ b/Modules/Numerics/PrincipalComponentsAnalysis/include/itkVectorFieldPCA.hxx @@ -19,7 +19,7 @@ #ifndef itkVectorFieldPCA_hxx #define itkVectorFieldPCA_hxx -#include "itkSymmetricEigenDecomposition.h" +#include "itkBridgeSymmetricEigenDecomposition.h" #include "vnl/vnl_c_vector.h" #include "itkMath.h" @@ -253,7 +253,7 @@ VectorFieldPCA eigs(K0); + itk::bridge::SymmetricEigenDecomposition eigs(K0); m_PCAEigenValues = eigs.D.diagonal(); diff --git a/Modules/Numerics/Statistics/include/itkGaussianMembershipFunction.hxx b/Modules/Numerics/Statistics/include/itkGaussianMembershipFunction.hxx index ffc2dd10b4a..06337771181 100644 --- a/Modules/Numerics/Statistics/include/itkGaussianMembershipFunction.hxx +++ b/Modules/Numerics/Statistics/include/itkGaussianMembershipFunction.hxx @@ -18,7 +18,7 @@ #ifndef itkGaussianMembershipFunction_hxx #define itkGaussianMembershipFunction_hxx -#include "itkMathDeterminant.h" +#include "itkBridgeMathDeterminant.h" namespace itk::Statistics { @@ -102,11 +102,11 @@ GaussianMembershipFunction::SetCovariance(const CovarianceMa } // the inverse of the covariance matrix is first computed by SVD - const auto inv_cov = itk::Math::SVD(cov.GetVnlMatrix()); + const auto inv_cov = itk::bridge::Math::SVD(cov.GetVnlMatrix()); // Signed determinant of the covariance: a magnitude-only determinant is // always non-negative and cannot detect a non-positive-definite matrix. - const double det = itk::Math::Determinant(cov.GetVnlMatrix()); + const double det = itk::bridge::Math::Determinant(cov.GetVnlMatrix()); if (det <= 0.0) { diff --git a/Modules/Numerics/Statistics/include/itkMahalanobisDistanceMembershipFunction.hxx b/Modules/Numerics/Statistics/include/itkMahalanobisDistanceMembershipFunction.hxx index 86e38d69325..f8f7ef0ffc4 100644 --- a/Modules/Numerics/Statistics/include/itkMahalanobisDistanceMembershipFunction.hxx +++ b/Modules/Numerics/Statistics/include/itkMahalanobisDistanceMembershipFunction.hxx @@ -21,7 +21,7 @@ #include "vnl/vnl_vector.h" #include "vnl/vnl_matrix.h" -#include "itkMathSVD.h" +#include "itkBridgeMathSVD.h" #if !defined(ITK_LEGACY_REMOVE) && !defined(ITK_FUTURE_LEGACY_REMOVE) # include "vnl/algo/vnl_matrix_inverse.h" // transitional transitive include; dropped on ITK legacy removal #endif @@ -95,7 +95,7 @@ MahalanobisDistanceMembershipFunction::SetCovariance(const CovarianceMa m_Covariance = cov; // the inverse of the covariance matrix is first computed by SVD - const auto inv_cov = itk::Math::SVD(m_Covariance.GetVnlMatrix()); + const auto inv_cov = itk::bridge::Math::SVD(m_Covariance.GetVnlMatrix()); // the determinant is then costless this way const double det = inv_cov.DeterminantMagnitude(); diff --git a/Modules/Numerics/Statistics/include/itkMahalanobisDistanceMetric.h b/Modules/Numerics/Statistics/include/itkMahalanobisDistanceMetric.h index ca2e5f0bc0a..72c13f7d074 100644 --- a/Modules/Numerics/Statistics/include/itkMahalanobisDistanceMetric.h +++ b/Modules/Numerics/Statistics/include/itkMahalanobisDistanceMetric.h @@ -22,7 +22,7 @@ #include "vnl/vnl_vector_ref.h" #include "vnl/vnl_transpose.h" #include "vnl/vnl_matrix.h" -#include "itkMathSVD.h" +#include "itkBridgeMathSVD.h" #if !defined(ITK_LEGACY_REMOVE) && !defined(ITK_FUTURE_LEGACY_REMOVE) # include "vnl/algo/vnl_matrix_inverse.h" // transitional transitive include; dropped on ITK legacy removal #endif diff --git a/Modules/Numerics/Statistics/include/itkMahalanobisDistanceMetric.hxx b/Modules/Numerics/Statistics/include/itkMahalanobisDistanceMetric.hxx index 5ef8f61aefd..edd9daa499b 100644 --- a/Modules/Numerics/Statistics/include/itkMahalanobisDistanceMetric.hxx +++ b/Modules/Numerics/Statistics/include/itkMahalanobisDistanceMetric.hxx @@ -127,7 +127,7 @@ MahalanobisDistanceMetric::CalculateInverseCovariance() } else { - m_InverseCovariance = itk::Math::SVD(m_Covariance).PseudoInverse(); + m_InverseCovariance = itk::bridge::Math::SVD(m_Covariance).PseudoInverse(); } } // end inverse calculations } diff --git a/Modules/Registration/Common/include/itkLandmarkBasedTransformInitializer.hxx b/Modules/Registration/Common/include/itkLandmarkBasedTransformInitializer.hxx index b321df4e9c8..77efb2bd926 100644 --- a/Modules/Registration/Common/include/itkLandmarkBasedTransformInitializer.hxx +++ b/Modules/Registration/Common/include/itkLandmarkBasedTransformInitializer.hxx @@ -23,7 +23,7 @@ #include "itkPrintHelper.h" #include -#include "itkQRDecomposition.h" +#include "itkBridgeQRDecomposition.h" namespace itk { @@ -314,7 +314,7 @@ LandmarkBasedTransformInitializer::Intern // [Solve Qa=C] // :: Solving code is from // https://www.itk.org/pipermail/insight-users/2008-December/028207.html - const vnl_matrix transposeAffine = QRDecomposition(Q).Solve(C); + const vnl_matrix transposeAffine = bridge::QRDecomposition(Q).Solve(C); vnl_matrix Affine = transposeAffine.transpose(); const vnl_matrix AffineRotation(Affine.get_n_columns(0, ImageDimension)); diff --git a/Modules/Registration/Common/test/RegistrationITKv3/ImageRegistration9.cxx b/Modules/Registration/Common/test/RegistrationITKv3/ImageRegistration9.cxx index 2c207acc998..db0e84eb36d 100644 --- a/Modules/Registration/Common/test/RegistrationITKv3/ImageRegistration9.cxx +++ b/Modules/Registration/Common/test/RegistrationITKv3/ImageRegistration9.cxx @@ -65,7 +65,7 @@ // that will monitor the evolution of the registration process. // #include "itkCommand.h" -#include "itkMathSVD.h" +#include "itkBridgeMathSVD.h" class CommandIterationUpdate : public itk::Command { public: @@ -105,7 +105,7 @@ class CommandIterationUpdate : public itk::Command p[0][1] = static_cast(optimizer->GetCurrentPosition()[1]); p[1][0] = static_cast(optimizer->GetCurrentPosition()[2]); p[1][1] = static_cast(optimizer->GetCurrentPosition()[3]); - const auto svd = itk::Math::SVD(p); + const auto svd = itk::bridge::Math::SVD(p); vnl_matrix r(2, 2); r = svd.U * svd.V.transpose(); const double angle = std::asin(r[1][0]); @@ -360,7 +360,7 @@ main(int argc, char * argv[]) p[0][1] = static_cast(finalParameters[1]); p[1][0] = static_cast(finalParameters[2]); p[1][1] = static_cast(finalParameters[3]); - const auto svd = itk::Math::SVD(p); + const auto svd = itk::bridge::Math::SVD(p); vnl_matrix r(2, 2); r = svd.U * svd.V.transpose(); const double angle = std::asin(r[1][0]); diff --git a/Modules/Segmentation/LevelSets/include/itkLevelSetFunction.hxx b/Modules/Segmentation/LevelSets/include/itkLevelSetFunction.hxx index eecbe41c0f2..0e60c40bd66 100644 --- a/Modules/Segmentation/LevelSets/include/itkLevelSetFunction.hxx +++ b/Modules/Segmentation/LevelSets/include/itkLevelSetFunction.hxx @@ -18,7 +18,7 @@ #ifndef itkLevelSetFunction_hxx #define itkLevelSetFunction_hxx -#include "itkSymmetricEigenDecomposition.h" +#include "itkBridgeSymmetricEigenDecomposition.h" namespace itk { @@ -95,7 +95,7 @@ LevelSetFunction::ComputeMinimalCurvature(const NeighborhoodType & i } // Eigensystem - const itk::SymmetricEigenDecomposition eig{ Curve.as_matrix() }; + const itk::bridge::SymmetricEigenDecomposition eig{ Curve.as_matrix() }; constexpr ScalarValueType MIN_EIG{ NumericTraits::min() }; ScalarValueType mincurve = itk::Math::Absolute(eig.get_eigenvalue(ImageDimension - 1)); diff --git a/Modules/ThirdParty/VNL/src/vxl/core/vnl/algo/CMakeLists.txt b/Modules/ThirdParty/VNL/src/vxl/core/vnl/algo/CMakeLists.txt index cf350d28aa1..7e5bc016678 100644 --- a/Modules/ThirdParty/VNL/src/vxl/core/vnl/algo/CMakeLists.txt +++ b/Modules/ThirdParty/VNL/src/vxl/core/vnl/algo/CMakeLists.txt @@ -54,7 +54,7 @@ if(NOT ITK_FUTURE_LEGACY_REMOVE) ) endif() -# vnl_matrix_inverse is a thin vnl_svd wrapper deprecated for itk::Math::SVD; +# vnl_matrix_inverse is a thin vnl_svd wrapper deprecated for itk::bridge::Math::SVD; # drop it and its template instantiations under ITK_FUTURE_LEGACY_REMOVE. if(NOT ITK_FUTURE_LEGACY_REMOVE) list(APPEND vnl_algo_sources @@ -64,7 +64,7 @@ endif() # LINPACK-svdc-backed legacy: vnl_svd{,_economy,_fixed} and vnl_solve_qp (its # only client outside the deprecated eigensystem/matrix_inverse wrappers) are -# the consumers of the netlib svdc engine. They are deprecated for itk::Math::SVD; +# the consumers of the netlib svdc engine. They are deprecated for itk::bridge::Math::SVD; # drop them and their template instantiations once the APIs are removed, leaving # no svdc dependency to build. if(NOT ITK_FUTURE_LEGACY_REMOVE) diff --git a/Modules/ThirdParty/VNL/src/vxl/core/vnl/algo/vnl_cholesky.h b/Modules/ThirdParty/VNL/src/vxl/core/vnl/algo/vnl_cholesky.h index b92f5a3f0a6..d248f30fbd1 100644 --- a/Modules/ThirdParty/VNL/src/vxl/core/vnl/algo/vnl_cholesky.h +++ b/Modules/ThirdParty/VNL/src/vxl/core/vnl/algo/vnl_cholesky.h @@ -3,7 +3,7 @@ #define vnl_cholesky_h_ // ITK deprecation shim: the netlib LINPACK engine behind vnl_cholesky was -// retired in favor of a native factor; itk::Math::SolveSymmetricPositiveDefinite +// retired in favor of a native factor; itk::bridge::Math::SolveSymmetricPositiveDefinite // / CholeskyLowerTriangle (Eigen-backed) are the supported replacements. The // guard is active only when itkConfigure.h is reachable (an ITK consumer), so // ITK's own VXL build is unaffected. @@ -11,14 +11,14 @@ # include # if defined(ITK_FUTURE_LEGACY_REMOVE) && !defined(ITK_LEGACY_TEST) # error \ - "vnl/algo/vnl_cholesky.h is deprecated; migrate to itk::Math::SolveSymmetricPositiveDefinite / CholeskyLowerTriangle (itkCholeskySolve.h, Eigen-backed)." + "vnl/algo/vnl_cholesky.h is deprecated; migrate to itk::bridge::Math::SolveSymmetricPositiveDefinite / CholeskyLowerTriangle (itkBridgeCholeskySolve.h, Eigen-backed)." # elif defined(ITK_LEGACY_REMOVE) && !defined(ITK_LEGACY_SILENT) && !defined(ITK_LEGACY_TEST) # if defined(_MSC_VER) # pragma message( \ - "vnl/algo/vnl_cholesky.h is deprecated; migrate to itk::Math::SolveSymmetricPositiveDefinite / CholeskyLowerTriangle (itkCholeskySolve.h, Eigen-backed).") + "vnl/algo/vnl_cholesky.h is deprecated; migrate to itk::bridge::Math::SolveSymmetricPositiveDefinite / CholeskyLowerTriangle (itkBridgeCholeskySolve.h, Eigen-backed).") # else # warning \ - "vnl/algo/vnl_cholesky.h is deprecated; migrate to itk::Math::SolveSymmetricPositiveDefinite / CholeskyLowerTriangle (itkCholeskySolve.h, Eigen-backed)." + "vnl/algo/vnl_cholesky.h is deprecated; migrate to itk::bridge::Math::SolveSymmetricPositiveDefinite / CholeskyLowerTriangle (itkBridgeCholeskySolve.h, Eigen-backed)." # endif # endif #endif diff --git a/Modules/ThirdParty/VNL/src/vxl/core/vnl/algo/vnl_determinant.h b/Modules/ThirdParty/VNL/src/vxl/core/vnl/algo/vnl_determinant.h index fb259534528..91ba30aff69 100644 --- a/Modules/ThirdParty/VNL/src/vxl/core/vnl/algo/vnl_determinant.h +++ b/Modules/ThirdParty/VNL/src/vxl/core/vnl/algo/vnl_determinant.h @@ -5,12 +5,12 @@ #if __has_include() # include # if defined(ITK_FUTURE_LEGACY_REMOVE) && !defined(ITK_LEGACY_TEST) -# error "vnl_determinant was removed; migrate to itk::Math::Determinant (itkMathDeterminant.h, Eigen-backed)." +# error "vnl_determinant was removed; migrate to itk::bridge::Math::Determinant (itkBridgeMathDeterminant.h, Eigen-backed)." # elif defined(ITK_LEGACY_REMOVE) && !defined(ITK_LEGACY_SILENT) && !defined(ITK_LEGACY_TEST) # if defined(_MSC_VER) -# pragma message("vnl_determinant is deprecated; migrate to itk::Math::Determinant.") +# pragma message("vnl_determinant is deprecated; migrate to itk::bridge::Math::Determinant.") # else -# warning "vnl_determinant is deprecated; migrate to itk::Math::Determinant." +# warning "vnl_determinant is deprecated; migrate to itk::bridge::Math::Determinant." # endif # endif #endif diff --git a/Modules/ThirdParty/VNL/src/vxl/core/vnl/algo/vnl_generalized_eigensystem.h b/Modules/ThirdParty/VNL/src/vxl/core/vnl/algo/vnl_generalized_eigensystem.h index 430a251879c..53d7aae9f5a 100644 --- a/Modules/ThirdParty/VNL/src/vxl/core/vnl/algo/vnl_generalized_eigensystem.h +++ b/Modules/ThirdParty/VNL/src/vxl/core/vnl/algo/vnl_generalized_eigensystem.h @@ -3,19 +3,19 @@ #define vnl_generalized_eigensystem_h_ // ITK deprecation shim: the netlib EISPACK engine (rsg) behind -// vnl_generalized_eigensystem is being retired; itk::GeneralizedEigenDecomposition +// vnl_generalized_eigensystem is being retired; itk::bridge::GeneralizedEigenDecomposition // (Eigen-backed) is the supported replacement. The guard is active only when // itkConfigure.h is reachable (an ITK consumer), so ITK's own VXL build is // unaffected. #if __has_include() # include # if defined(ITK_FUTURE_LEGACY_REMOVE) && !defined(ITK_LEGACY_TEST) -# error "vnl/algo/vnl_generalized_eigensystem.h is deprecated; migrate to itk::GeneralizedEigenDecomposition (itkGeneralizedEigenDecomposition.h, Eigen-backed)." +# error "vnl/algo/vnl_generalized_eigensystem.h is deprecated; migrate to itk::bridge::GeneralizedEigenDecomposition (itkBridgeGeneralizedEigenDecomposition.h, Eigen-backed)." # elif defined(ITK_LEGACY_REMOVE) && !defined(ITK_LEGACY_SILENT) && !defined(ITK_LEGACY_TEST) # if defined(_MSC_VER) -# pragma message("vnl/algo/vnl_generalized_eigensystem.h is deprecated; migrate to itk::GeneralizedEigenDecomposition (itkGeneralizedEigenDecomposition.h, Eigen-backed).") +# pragma message("vnl/algo/vnl_generalized_eigensystem.h is deprecated; migrate to itk::bridge::GeneralizedEigenDecomposition (itkBridgeGeneralizedEigenDecomposition.h, Eigen-backed).") # else -# warning "vnl/algo/vnl_generalized_eigensystem.h is deprecated; migrate to itk::GeneralizedEigenDecomposition (itkGeneralizedEigenDecomposition.h, Eigen-backed)." +# warning "vnl/algo/vnl_generalized_eigensystem.h is deprecated; migrate to itk::bridge::GeneralizedEigenDecomposition (itkBridgeGeneralizedEigenDecomposition.h, Eigen-backed)." # endif # endif #endif diff --git a/Modules/ThirdParty/VNL/src/vxl/core/vnl/algo/vnl_ldl_cholesky.h b/Modules/ThirdParty/VNL/src/vxl/core/vnl/algo/vnl_ldl_cholesky.h index eddf994fc08..2d1bfbbc1d9 100644 --- a/Modules/ThirdParty/VNL/src/vxl/core/vnl/algo/vnl_ldl_cholesky.h +++ b/Modules/ThirdParty/VNL/src/vxl/core/vnl/algo/vnl_ldl_cholesky.h @@ -3,7 +3,7 @@ #define vnl_ldl_cholesky_h_ // ITK deprecation shim: the netlib LINPACK engine behind vnl_ldl_cholesky was -// retired in favor of a native factor; itk::Math::SolveSymmetricPositiveDefinite +// retired in favor of a native factor; itk::bridge::Math::SolveSymmetricPositiveDefinite // / CholeskyLowerTriangle (Eigen-backed) are the supported replacements. The // guard is active only when itkConfigure.h is reachable (an ITK consumer), so // ITK's own VXL build is unaffected. @@ -11,14 +11,14 @@ # include # if defined(ITK_FUTURE_LEGACY_REMOVE) && !defined(ITK_LEGACY_TEST) # error \ - "vnl/algo/vnl_ldl_cholesky.h is deprecated; migrate to itk::Math::SolveSymmetricPositiveDefinite / CholeskyLowerTriangle (itkCholeskySolve.h, Eigen-backed)." + "vnl/algo/vnl_ldl_cholesky.h is deprecated; migrate to itk::bridge::Math::SolveSymmetricPositiveDefinite / CholeskyLowerTriangle (itkBridgeCholeskySolve.h, Eigen-backed)." # elif defined(ITK_LEGACY_REMOVE) && !defined(ITK_LEGACY_SILENT) && !defined(ITK_LEGACY_TEST) # if defined(_MSC_VER) # pragma message( \ - "vnl/algo/vnl_ldl_cholesky.h is deprecated; migrate to itk::Math::SolveSymmetricPositiveDefinite / CholeskyLowerTriangle (itkCholeskySolve.h, Eigen-backed).") + "vnl/algo/vnl_ldl_cholesky.h is deprecated; migrate to itk::bridge::Math::SolveSymmetricPositiveDefinite / CholeskyLowerTriangle (itkBridgeCholeskySolve.h, Eigen-backed).") # else # warning \ - "vnl/algo/vnl_ldl_cholesky.h is deprecated; migrate to itk::Math::SolveSymmetricPositiveDefinite / CholeskyLowerTriangle (itkCholeskySolve.h, Eigen-backed)." + "vnl/algo/vnl_ldl_cholesky.h is deprecated; migrate to itk::bridge::Math::SolveSymmetricPositiveDefinite / CholeskyLowerTriangle (itkBridgeCholeskySolve.h, Eigen-backed)." # endif # endif #endif diff --git a/Modules/ThirdParty/VNL/src/vxl/core/vnl/algo/vnl_matrix_inverse.h b/Modules/ThirdParty/VNL/src/vxl/core/vnl/algo/vnl_matrix_inverse.h index 0d30bc1690d..5f874e7cdaa 100644 --- a/Modules/ThirdParty/VNL/src/vxl/core/vnl/algo/vnl_matrix_inverse.h +++ b/Modules/ThirdParty/VNL/src/vxl/core/vnl/algo/vnl_matrix_inverse.h @@ -3,18 +3,18 @@ #define vnl_matrix_inverse_h_ // ITK deprecation shim: vnl_matrix_inverse is a thin vnl_svd wrapper being -// retired; itk::Math::SVD (PseudoInverse/Solve, Eigen-backed) is the supported +// retired; itk::bridge::Math::SVD (PseudoInverse/Solve, Eigen-backed) is the supported // replacement. The guard is active only when itkConfigure.h is reachable (an // ITK consumer), so ITK's own VXL build is unaffected. #if __has_include() # include # if defined(ITK_FUTURE_LEGACY_REMOVE) && !defined(ITK_LEGACY_TEST) -# error "vnl/algo/vnl_matrix_inverse.h is deprecated; migrate to itk::Math::SVD (itkMathSVD.h, Eigen-backed)." +# error "vnl/algo/vnl_matrix_inverse.h is deprecated; migrate to itk::bridge::Math::SVD (itkBridgeMathSVD.h, Eigen-backed)." # elif defined(ITK_LEGACY_REMOVE) && !defined(ITK_LEGACY_SILENT) && !defined(ITK_LEGACY_TEST) # if defined(_MSC_VER) -# pragma message("vnl/algo/vnl_matrix_inverse.h is deprecated; migrate to itk::Math::SVD (itkMathSVD.h, Eigen-backed).") +# pragma message("vnl/algo/vnl_matrix_inverse.h is deprecated; migrate to itk::bridge::Math::SVD (itkBridgeMathSVD.h, Eigen-backed).") # else -# warning "vnl/algo/vnl_matrix_inverse.h is deprecated; migrate to itk::Math::SVD (itkMathSVD.h, Eigen-backed)." +# warning "vnl/algo/vnl_matrix_inverse.h is deprecated; migrate to itk::bridge::Math::SVD (itkBridgeMathSVD.h, Eigen-backed)." # endif # endif #endif diff --git a/Modules/ThirdParty/VNL/src/vxl/core/vnl/algo/vnl_qr.h b/Modules/ThirdParty/VNL/src/vxl/core/vnl/algo/vnl_qr.h index 73761ab1297..7c2e86aee2c 100644 --- a/Modules/ThirdParty/VNL/src/vxl/core/vnl/algo/vnl_qr.h +++ b/Modules/ThirdParty/VNL/src/vxl/core/vnl/algo/vnl_qr.h @@ -3,18 +3,18 @@ #define vnl_qr_h_ // ITK deprecation shim: the netlib LINPACK engine behind vnl_qr was retired in -// favor of a native (BLAS-backed) factor; itk::QRDecomposition (Eigen-backed) +// favor of a native (BLAS-backed) factor; itk::bridge::QRDecomposition (Eigen-backed) // is the supported replacement. The guard is active only when itkConfigure.h is // reachable (an ITK consumer), so ITK's own VXL build is unaffected. #if __has_include() # include # if defined(ITK_FUTURE_LEGACY_REMOVE) && !defined(ITK_LEGACY_TEST) -# error "vnl/algo/vnl_qr.h is deprecated; migrate to itk::QRDecomposition (itkQRDecomposition.h, Eigen-backed)." +# error "vnl/algo/vnl_qr.h is deprecated; migrate to itk::bridge::QRDecomposition (itkBridgeQRDecomposition.h, Eigen-backed)." # elif defined(ITK_LEGACY_REMOVE) && !defined(ITK_LEGACY_SILENT) && !defined(ITK_LEGACY_TEST) # if defined(_MSC_VER) -# pragma message("vnl/algo/vnl_qr.h is deprecated; migrate to itk::QRDecomposition (itkQRDecomposition.h, Eigen-backed).") +# pragma message("vnl/algo/vnl_qr.h is deprecated; migrate to itk::bridge::QRDecomposition (itkBridgeQRDecomposition.h, Eigen-backed).") # else -# warning "vnl/algo/vnl_qr.h is deprecated; migrate to itk::QRDecomposition (itkQRDecomposition.h, Eigen-backed)." +# warning "vnl/algo/vnl_qr.h is deprecated; migrate to itk::bridge::QRDecomposition (itkBridgeQRDecomposition.h, Eigen-backed)." # endif # endif #endif diff --git a/Modules/ThirdParty/VNL/src/vxl/core/vnl/algo/vnl_real_eigensystem.h b/Modules/ThirdParty/VNL/src/vxl/core/vnl/algo/vnl_real_eigensystem.h index 17e9a42c68d..8198a3a8edc 100644 --- a/Modules/ThirdParty/VNL/src/vxl/core/vnl/algo/vnl_real_eigensystem.h +++ b/Modules/ThirdParty/VNL/src/vxl/core/vnl/algo/vnl_real_eigensystem.h @@ -3,18 +3,18 @@ #define vnl_real_eigensystem_h_ // ITK deprecation shim: the netlib EISPACK engine (rg) behind vnl_real_eigensystem -// is being retired; itk::RealEigenDecomposition (Eigen-backed) is the supported +// is being retired; itk::bridge::RealEigenDecomposition (Eigen-backed) is the supported // replacement. The guard is active only when itkConfigure.h is reachable (an ITK // consumer), so ITK's own VXL build is unaffected. #if __has_include() # include # if defined(ITK_FUTURE_LEGACY_REMOVE) && !defined(ITK_LEGACY_TEST) -# error "vnl/algo/vnl_real_eigensystem.h is deprecated; migrate to itk::RealEigenDecomposition (itkRealEigenDecomposition.h, Eigen-backed)." +# error "vnl/algo/vnl_real_eigensystem.h is deprecated; migrate to itk::bridge::RealEigenDecomposition (itkBridgeRealEigenDecomposition.h, Eigen-backed)." # elif defined(ITK_LEGACY_REMOVE) && !defined(ITK_LEGACY_SILENT) && !defined(ITK_LEGACY_TEST) # if defined(_MSC_VER) -# pragma message("vnl/algo/vnl_real_eigensystem.h is deprecated; migrate to itk::RealEigenDecomposition (itkRealEigenDecomposition.h, Eigen-backed).") +# pragma message("vnl/algo/vnl_real_eigensystem.h is deprecated; migrate to itk::bridge::RealEigenDecomposition (itkBridgeRealEigenDecomposition.h, Eigen-backed).") # else -# warning "vnl/algo/vnl_real_eigensystem.h is deprecated; migrate to itk::RealEigenDecomposition (itkRealEigenDecomposition.h, Eigen-backed)." +# warning "vnl/algo/vnl_real_eigensystem.h is deprecated; migrate to itk::bridge::RealEigenDecomposition (itkBridgeRealEigenDecomposition.h, Eigen-backed)." # endif # endif #endif diff --git a/Modules/ThirdParty/VNL/src/vxl/core/vnl/algo/vnl_scatter_3x3.h b/Modules/ThirdParty/VNL/src/vxl/core/vnl/algo/vnl_scatter_3x3.h index 8cb422dbae4..ea0c92d6312 100644 --- a/Modules/ThirdParty/VNL/src/vxl/core/vnl/algo/vnl_scatter_3x3.h +++ b/Modules/ThirdParty/VNL/src/vxl/core/vnl/algo/vnl_scatter_3x3.h @@ -5,18 +5,18 @@ // ITK deprecation shim: vnl_scatter_3x3 is the only non-deprecated client of the // netlib EISPACK symmetric eigensolver; it is deprecated alongside the // vnl_*_eigensystem classes so the dead engine can be retired. Build a 3x3 -// scatter matrix directly and use itk::SymmetricEigenDecomposition for its +// scatter matrix directly and use itk::bridge::SymmetricEigenDecomposition for its // eigensystem. The guard is active only when itkConfigure.h is reachable (an ITK // consumer), so ITK's own VXL build is unaffected. #if __has_include() # include # if defined(ITK_FUTURE_LEGACY_REMOVE) && !defined(ITK_LEGACY_TEST) -# error "vnl/algo/vnl_scatter_3x3.h is deprecated; build a 3x3 scatter matrix directly and use itk::SymmetricEigenDecomposition (itkSymmetricEigenDecomposition.h, Eigen-backed) for its eigensystem." +# error "vnl/algo/vnl_scatter_3x3.h is deprecated; build a 3x3 scatter matrix directly and use itk::bridge::SymmetricEigenDecomposition (itkBridgeSymmetricEigenDecomposition.h, Eigen-backed) for its eigensystem." # elif defined(ITK_LEGACY_REMOVE) && !defined(ITK_LEGACY_SILENT) && !defined(ITK_LEGACY_TEST) # if defined(_MSC_VER) -# pragma message("vnl/algo/vnl_scatter_3x3.h is deprecated; use itk::SymmetricEigenDecomposition (itkSymmetricEigenDecomposition.h) for the eigensystem.") +# pragma message("vnl/algo/vnl_scatter_3x3.h is deprecated; use itk::bridge::SymmetricEigenDecomposition (itkBridgeSymmetricEigenDecomposition.h) for the eigensystem.") # else -# warning "vnl/algo/vnl_scatter_3x3.h is deprecated; use itk::SymmetricEigenDecomposition (itkSymmetricEigenDecomposition.h) for the eigensystem." +# warning "vnl/algo/vnl_scatter_3x3.h is deprecated; use itk::bridge::SymmetricEigenDecomposition (itkBridgeSymmetricEigenDecomposition.h) for the eigensystem." # endif # endif #endif diff --git a/Modules/ThirdParty/VNL/src/vxl/core/vnl/algo/vnl_svd.h b/Modules/ThirdParty/VNL/src/vxl/core/vnl/algo/vnl_svd.h index c3f975523a6..c828eb5db48 100644 --- a/Modules/ThirdParty/VNL/src/vxl/core/vnl/algo/vnl_svd.h +++ b/Modules/ThirdParty/VNL/src/vxl/core/vnl/algo/vnl_svd.h @@ -2,7 +2,7 @@ #ifndef vnl_svd_h_ #define vnl_svd_h_ -// ITK deprecation shim: the Eigen-backed itk::Math::SVD (itkMathSVD.h) is the +// ITK deprecation shim: the Eigen-backed itk::bridge::Math::SVD (itkBridgeMathSVD.h) is the // supported replacement for vnl_svd, offering PseudoInverse()/Solve()/Rank()/ // Recompose() with fixed- and runtime-sized overloads. The guard is active only // when itkConfigure.h is reachable (an ITK consumer), so ITK's own VXL build is @@ -11,14 +11,14 @@ # include # if defined(ITK_FUTURE_LEGACY_REMOVE) && !defined(ITK_LEGACY_TEST) # error \ - "vnl/algo/vnl_svd.h is deprecated; migrate to itk::Math::SVD (itkMathSVD.h, Eigen-backed)." + "vnl/algo/vnl_svd.h is deprecated; migrate to itk::bridge::Math::SVD (itkBridgeMathSVD.h, Eigen-backed)." # elif defined(ITK_LEGACY_REMOVE) && !defined(ITK_LEGACY_SILENT) && !defined(ITK_LEGACY_TEST) # if defined(_MSC_VER) # pragma message( \ - "vnl/algo/vnl_svd.h is deprecated; migrate to itk::Math::SVD (itkMathSVD.h, Eigen-backed).") + "vnl/algo/vnl_svd.h is deprecated; migrate to itk::bridge::Math::SVD (itkBridgeMathSVD.h, Eigen-backed).") # else # warning \ - "vnl/algo/vnl_svd.h is deprecated; migrate to itk::Math::SVD (itkMathSVD.h, Eigen-backed)." + "vnl/algo/vnl_svd.h is deprecated; migrate to itk::bridge::Math::SVD (itkBridgeMathSVD.h, Eigen-backed)." # endif # endif #endif diff --git a/Modules/ThirdParty/VNL/src/vxl/core/vnl/algo/vnl_svd_economy.h b/Modules/ThirdParty/VNL/src/vxl/core/vnl/algo/vnl_svd_economy.h index 019215e37ec..45c45a1b08d 100644 --- a/Modules/ThirdParty/VNL/src/vxl/core/vnl/algo/vnl_svd_economy.h +++ b/Modules/ThirdParty/VNL/src/vxl/core/vnl/algo/vnl_svd_economy.h @@ -2,21 +2,21 @@ #ifndef vnl_svd_economy_h_ #define vnl_svd_economy_h_ -// ITK deprecation shim: the Eigen-backed itk::Math::SVD (itkMathSVD.h) is the +// ITK deprecation shim: the Eigen-backed itk::bridge::Math::SVD (itkBridgeMathSVD.h) is the // supported replacement. The guard is active only when itkConfigure.h is // reachable (an ITK consumer); ITK's own VXL build is unaffected. #if __has_include() # include # if defined(ITK_FUTURE_LEGACY_REMOVE) && !defined(ITK_LEGACY_TEST) # error \ - "vnl/algo/vnl_svd_economy.h is deprecated; migrate to itk::Math::SVD (itkMathSVD.h, Eigen-backed)." + "vnl/algo/vnl_svd_economy.h is deprecated; migrate to itk::bridge::Math::SVD (itkBridgeMathSVD.h, Eigen-backed)." # elif defined(ITK_LEGACY_REMOVE) && !defined(ITK_LEGACY_SILENT) && !defined(ITK_LEGACY_TEST) # if defined(_MSC_VER) # pragma message( \ - "vnl/algo/vnl_svd_economy.h is deprecated; migrate to itk::Math::SVD (itkMathSVD.h, Eigen-backed).") + "vnl/algo/vnl_svd_economy.h is deprecated; migrate to itk::bridge::Math::SVD (itkBridgeMathSVD.h, Eigen-backed).") # else # warning \ - "vnl/algo/vnl_svd_economy.h is deprecated; migrate to itk::Math::SVD (itkMathSVD.h, Eigen-backed)." + "vnl/algo/vnl_svd_economy.h is deprecated; migrate to itk::bridge::Math::SVD (itkBridgeMathSVD.h, Eigen-backed)." # endif # endif #endif diff --git a/Modules/ThirdParty/VNL/src/vxl/core/vnl/algo/vnl_svd_fixed.h b/Modules/ThirdParty/VNL/src/vxl/core/vnl/algo/vnl_svd_fixed.h index 9dcb4d0e30b..8e1a9d83eca 100644 --- a/Modules/ThirdParty/VNL/src/vxl/core/vnl/algo/vnl_svd_fixed.h +++ b/Modules/ThirdParty/VNL/src/vxl/core/vnl/algo/vnl_svd_fixed.h @@ -2,7 +2,7 @@ #ifndef vnl_svd_fixed_h_ #define vnl_svd_fixed_h_ -// ITK deprecation shim: the Eigen-backed itk::Math::SVD (itkMathSVD.h) is the +// ITK deprecation shim: the Eigen-backed itk::bridge::Math::SVD (itkBridgeMathSVD.h) is the // supported replacement (fixed-size square overload). The guard is active only // when itkConfigure.h is reachable (an ITK consumer); ITK's own VXL build is // unaffected. @@ -10,14 +10,14 @@ # include # if defined(ITK_FUTURE_LEGACY_REMOVE) && !defined(ITK_LEGACY_TEST) # error \ - "vnl/algo/vnl_svd_fixed.h is deprecated; migrate to itk::Math::SVD (itkMathSVD.h, Eigen-backed)." + "vnl/algo/vnl_svd_fixed.h is deprecated; migrate to itk::bridge::Math::SVD (itkBridgeMathSVD.h, Eigen-backed)." # elif defined(ITK_LEGACY_REMOVE) && !defined(ITK_LEGACY_SILENT) && !defined(ITK_LEGACY_TEST) # if defined(_MSC_VER) # pragma message( \ - "vnl/algo/vnl_svd_fixed.h is deprecated; migrate to itk::Math::SVD (itkMathSVD.h, Eigen-backed).") + "vnl/algo/vnl_svd_fixed.h is deprecated; migrate to itk::bridge::Math::SVD (itkBridgeMathSVD.h, Eigen-backed).") # else # warning \ - "vnl/algo/vnl_svd_fixed.h is deprecated; migrate to itk::Math::SVD (itkMathSVD.h, Eigen-backed)." + "vnl/algo/vnl_svd_fixed.h is deprecated; migrate to itk::bridge::Math::SVD (itkBridgeMathSVD.h, Eigen-backed)." # endif # endif #endif diff --git a/Modules/ThirdParty/VNL/src/vxl/core/vnl/algo/vnl_symmetric_eigensystem.h b/Modules/ThirdParty/VNL/src/vxl/core/vnl/algo/vnl_symmetric_eigensystem.h index e8408937419..4d8a4c76507 100644 --- a/Modules/ThirdParty/VNL/src/vxl/core/vnl/algo/vnl_symmetric_eigensystem.h +++ b/Modules/ThirdParty/VNL/src/vxl/core/vnl/algo/vnl_symmetric_eigensystem.h @@ -3,19 +3,19 @@ #define vnl_symmetric_eigensystem_h_ // ITK deprecation shim: the netlib EISPACK engine (rs) behind -// vnl_symmetric_eigensystem is being retired; itk::SymmetricEigenDecomposition +// vnl_symmetric_eigensystem is being retired; itk::bridge::SymmetricEigenDecomposition // (Eigen-backed) is the supported replacement. The guard is active only when // itkConfigure.h is reachable (an ITK consumer), so ITK's own VXL build is // unaffected. #if __has_include() # include # if defined(ITK_FUTURE_LEGACY_REMOVE) && !defined(ITK_LEGACY_TEST) -# error "vnl/algo/vnl_symmetric_eigensystem.h is deprecated; migrate to itk::SymmetricEigenDecomposition (itkSymmetricEigenDecomposition.h, Eigen-backed)." +# error "vnl/algo/vnl_symmetric_eigensystem.h is deprecated; migrate to itk::bridge::SymmetricEigenDecomposition (itkBridgeSymmetricEigenDecomposition.h, Eigen-backed)." # elif defined(ITK_LEGACY_REMOVE) && !defined(ITK_LEGACY_SILENT) && !defined(ITK_LEGACY_TEST) # if defined(_MSC_VER) -# pragma message("vnl/algo/vnl_symmetric_eigensystem.h is deprecated; migrate to itk::SymmetricEigenDecomposition (itkSymmetricEigenDecomposition.h, Eigen-backed).") +# pragma message("vnl/algo/vnl_symmetric_eigensystem.h is deprecated; migrate to itk::bridge::SymmetricEigenDecomposition (itkBridgeSymmetricEigenDecomposition.h, Eigen-backed).") # else -# warning "vnl/algo/vnl_symmetric_eigensystem.h is deprecated; migrate to itk::SymmetricEigenDecomposition (itkSymmetricEigenDecomposition.h, Eigen-backed)." +# warning "vnl/algo/vnl_symmetric_eigensystem.h is deprecated; migrate to itk::bridge::SymmetricEigenDecomposition (itkBridgeSymmetricEigenDecomposition.h, Eigen-backed)." # endif # endif #endif diff --git a/Modules/ThirdParty/VNL/src/vxl/core/vnl/vnl_det.h b/Modules/ThirdParty/VNL/src/vxl/core/vnl/vnl_det.h index fd75e646b19..b58b33ee0ed 100644 --- a/Modules/ThirdParty/VNL/src/vxl/core/vnl/vnl_det.h +++ b/Modules/ThirdParty/VNL/src/vxl/core/vnl/vnl_det.h @@ -5,12 +5,12 @@ #if __has_include() # include # if defined(ITK_FUTURE_LEGACY_REMOVE) && !defined(ITK_LEGACY_TEST) -# error "vnl_det was removed; migrate to itk::Math::Determinant (itkMathDeterminant.h, Eigen-backed)." +# error "vnl_det was removed; migrate to itk::bridge::Math::Determinant (itkBridgeMathDeterminant.h, Eigen-backed)." # elif defined(ITK_LEGACY_REMOVE) && !defined(ITK_LEGACY_SILENT) && !defined(ITK_LEGACY_TEST) # if defined(_MSC_VER) -# pragma message("vnl_det is deprecated; migrate to itk::Math::Determinant.") +# pragma message("vnl_det is deprecated; migrate to itk::bridge::Math::Determinant.") # else -# warning "vnl_det is deprecated; migrate to itk::Math::Determinant." +# warning "vnl_det is deprecated; migrate to itk::bridge::Math::Determinant." # endif # endif #endif diff --git a/Modules/Video/Core/include/itkVideoStream.hxx b/Modules/Video/Core/include/itkVideoStream.hxx index aeb60e00906..34768257ab0 100644 --- a/Modules/Video/Core/include/itkVideoStream.hxx +++ b/Modules/Video/Core/include/itkVideoStream.hxx @@ -18,7 +18,7 @@ #ifndef itkVideoStream_hxx #define itkVideoStream_hxx -#include "itkMathDeterminant.h" +#include "itkBridgeMathDeterminant.h" namespace itk @@ -176,7 +176,7 @@ void VideoStream::SetFrameDirection(SizeValueType frameNumber, typename TFrameType::DirectionType direction) { // Determinant is non-zero - if (itk::Math::Absolute(Math::Determinant(direction.GetVnlMatrix())) <= itk::Math::eps) + if (itk::Math::Absolute(bridge::Math::Determinant(direction.GetVnlMatrix())) <= itk::Math::eps) { itkExceptionMacro("Bad direction, determinant is 0. Direction is " << direction); }