Skip to content

Commit

Permalink
COMP: Future proof vnl_math_XXX function usage.
Browse files Browse the repository at this point in the history
Prefer C++ over aliased names vnl_math_[min|max] -> std::[min|max]
Prefer vnl_math::abs over deprecated alias vnl_math_abs

In all compilers currently supported by VXL, vnl_math_[min|max]
could be replaced with std::[min|max] without loss of
functionality.  This also circumvents part of the backwards
compatibility requirements as vnl_math_ has been recently
replaced with a namespace of vnl_math::.

Since Wed Nov 14 07:42:48 2012:
The vnl_math_* functions use #define aliases to their
vnl_math::* counterparts in the "real" vnl_math:: namespace.

The new syntax should be backwards compatible to
VXL versions as old as 2012.

Prefer to use itk::Math:: over vnl_math:: namespace
  • Loading branch information
hjmjohnson committed Nov 4, 2018
1 parent c162da3 commit 092e781
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
4 changes: 2 additions & 2 deletions include/itkSimoncelliIsotropicWavelet.hxx
Original file line number Diff line number Diff line change
Expand Up @@ -50,12 +50,12 @@ SimoncelliIsotropicWavelet< TFunctionValue, VImageDimension, TInput >
::EvaluateMagnitude(const FunctionValueType & freq_norm_in_hz) const
{
// freq_in_rad_per_sec = freq_norm_in_hz * 2 * pi
// Dev: std::log2 is c++11 only. std::log2(x) = std::log(x)/vnl_math::ln2
// Dev: std::log2 is c++11 only. std::log2(x) = std::log(x)/itk::Math::ln2
if ( freq_norm_in_hz > 0.125 && freq_norm_in_hz <= 0.5 )
{
return static_cast< TFunctionValue >(
std::cos( 0.5 * Math::pi
* std::log(4 * freq_norm_in_hz) / vnl_math::ln2 ) );
* std::log(4 * freq_norm_in_hz) / itk::Math::ln2 ) );
}
return 0;
}
Expand Down
6 changes: 3 additions & 3 deletions include/itkVowIsotropicWavelet.hxx
Original file line number Diff line number Diff line change
Expand Up @@ -53,12 +53,12 @@ VowIsotropicWavelet< TFunctionValue, VImageDimension, TInput >
::EvaluateMagnitude(const FunctionValueType & freq_norm_in_hz) const
{
// freq_in_rad_per_sec = freq_norm_in_hz * 2 * pi
// Dev: std::log2 is c++11 only. std::log2(x) = std::log(x)/vnl_math::ln2
// Dev: std::log2 is c++11 only. std::log2(x) = std::log(x)/itk::Math::ln2
if ( freq_norm_in_hz >= 1 / 8.0 && freq_norm_in_hz < 1 / 4.0 )
{
return static_cast< TFunctionValue >(
sqrt(0.5
+ std::tan(this->m_Kappa * (1.0 + (2.0 / vnl_math::ln2) * std::log(4 * freq_norm_in_hz)))
+ std::tan(this->m_Kappa * (1.0 + (2.0 / itk::Math::ln2) * std::log(4 * freq_norm_in_hz)))
/ (2.0 * std::tan(this->m_Kappa)))
);
}
Expand All @@ -67,7 +67,7 @@ VowIsotropicWavelet< TFunctionValue, VImageDimension, TInput >
{
return static_cast< TFunctionValue >(
sqrt(0.5
- std::tan(this->m_Kappa * (1.0 + (2.0 / vnl_math::ln2) * std::log(2 * freq_norm_in_hz)))
- std::tan(this->m_Kappa * (1.0 + (2.0 / itk::Math::ln2) * std::log(2 * freq_norm_in_hz)))
/ (2.0 * std::tan(this->m_Kappa)))
);
}
Expand Down

0 comments on commit 092e781

Please sign in to comment.