Commit 344a0b3b authored by Antoine Regimbeau's avatar Antoine Regimbeau

REFAC: take into account merge request comments

parent cdc5ed0c
......@@ -264,7 +264,7 @@ private:
{
// fft ttransform
bool shift = IsParameterEnabled( "mode.fft.shift");
typedef otb::Image< std::complex<OutputPixelType> > OutputImageType;
typedef otb::Image< std::complex<OutputPixelType> > ComplexOutputImageType;
if (dir == 0 )
{
......
/*=========================================================================
/*
* Copyright (C) 2005-2017 Centre National d'Etudes Spatiales (CNES)
*
* Copyright Insight Software Consortium
* This file is part of Orfeo Toolbox
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
* https://www.orfeo-toolbox.org/
*
* http://www.apache.org/licenses/LICENSE-2.0.txt
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* http://www.apache.org/licenses/LICENSE-2.0
*
*=========================================================================*/
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#ifndef otbDefaultConvertPixelTraits_h
#define otbDefaultConvertPixelTraits_h
#include "itkDefaultConvertPixelTraits.h"
// #include "itkOffset.h"
// #include "itkVector.h"
// #include "itkMatrix.h"
// #include "itkVariableLengthVector.h"
// #include "itkVariableSizeMatrix.h"
namespace otb
{
......@@ -46,139 +43,6 @@ public:
}
};
// We might not need this specialization if the compileur allow
// us to declare to function with same signature in some case :
// see "SetNthComponent"
/*
#define OTB_DEFAULTCONVERTTRAITS_NATIVE_SPECIAL(type) \
template< > \
class DefaultConvertPixelTraits < type > \
: public itk::DefaultConvertPixelTraits < type > \
{ \
public: \
typedef itk::DefaultConvertPixelTraits < type > SuperClass; \
using typename SuperClass::ComponentType; \
};
*/
// OTB_DEFAULTCONVERTTRAITS_NATIVE_SPECIAL(float)
// OTB_DEFAULTCONVERTTRAITS_NATIVE_SPECIAL(double)
// Warning long double is not in itk < 4.11
// OTB_DEFAULTCONVERTTRAITS_NATIVE_SPECIAL(long double)
// OTB_DEFAULTCONVERTTRAITS_NATIVE_SPECIAL(int)
// OTB_DEFAULTCONVERTTRAITS_NATIVE_SPECIAL(char)
// OTB_DEFAULTCONVERTTRAITS_NATIVE_SPECIAL(short)
// OTB_DEFAULTCONVERTTRAITS_NATIVE_SPECIAL(unsigned int)
// OTB_DEFAULTCONVERTTRAITS_NATIVE_SPECIAL(signed char)
// OTB_DEFAULTCONVERTTRAITS_NATIVE_SPECIAL(unsigned char)
// OTB_DEFAULTCONVERTTRAITS_NATIVE_SPECIAL(unsigned short)
// OTB_DEFAULTCONVERTTRAITS_NATIVE_SPECIAL(long)
// OTB_DEFAULTCONVERTTRAITS_NATIVE_SPECIAL(unsigned long)
// OTB_DEFAULTCONVERTTRAITS_NATIVE_SPECIAL(long long)
// OTB_DEFAULTCONVERTTRAITS_NATIVE_SPECIAL(unsigned long long)
// OTB_DEFAULTCONVERTTRAITS_NATIVE_SPECIAL(bool)
// #undef OTB_DEFAULTCONVERTTRAITS_NATIVE_SPECIAL
//
// Default traits for the Offset<> pixel type
//
// template<unsigned int VDimension>
// class DefaultConvertPixelTraits < itk::Offset< VDimension > > :
// public itk::DefaultConvertPixelTraits< itk::Offset< VDimension > >
// {
// public:
// typedef itk::DefaultConvertPixelTraits < itk::Offset< VDimension > > SuperClass;
// using typename SuperClass::ComponentType;
// using SuperClass::SetNthComponent;
// static void SetNthComponent(int , TargetType & pixel, const TargetType& v)
// {
// pixel = v;
// }
// };
//
// Default traits for the pixel types deriving from FixedArray<>
//
/*
define OTB_DEFAULTCONVERTTRAITS_FIXEDARRAY_TYPE(type) \
template < typename TComponentType , unsigned VDimension > \
class DefaultConvertPixelTraits < type < TComponentType , VDimension > > \
: public itk::DefaultConvertPixelTraits < type < TComponentType , VDimension > > \
{ \
public: \
typedef itk::DefaultConvertPixelTraits < type < TComponentType , VDimension > > SuperClass;\
typedef typename SuperClass::TargetType TargetType; \
static void SetNthComponent(int , TargetType & pixel, const TargetType & v) \
{ \
pixel = v; \
} \
} \
*/
// OTB_DEFAULTCONVERTTRAITS_FIXEDARRAY_TYPE(itk::FixedArray);
// OTB_DEFAULTCONVERTTRAITS_FIXEDARRAY_TYPE(itk::Vector);
// OTB_DEFAULTCONVERTTRAITS_FIXEDARRAY_TYPE(itk::CovariantVector);
// OTB_DEFAULTCONVERTTRAITS_FIXEDARRAY_TYPE(itk::Point);
// #undef OTB_DEFAULTCONVERTTRAITS_FIXEDARRAY_TYPE
//
// Default traits for pixel types deriving from VariableLengthVector<>
//
// template < typename T >
// class DefaultConvertPixelTraits < itk::VariableLengthVector < T > >
// : public itk::DefaultConvertPixelTraits < itk::VariableLengthVector< T > >
// {
// public:
// typedef itk::DefaultConvertPixelTraits< itk::VariableLengthVector < T > > SuperClass;
// using typename SuperClass::TargetType;
// using typename SuperClass::ComponentType;
// };
//
// Default traits for the pixel types deriving from Matrix<>
//
// template<typename VComponent, unsigned VRows, unsigned VCols >
// class DefaultConvertPixelTraits < itk::Matrix< VComponent, VRows, VCols > >
// : public itk::DefaultConvertPixelTraits < itk::Matrix< VComponent, VRows, VCols > >
// {
// public:
// typedef itk::DefaultConvertPixelTraits < itk::Matrix< VComponent, VRows, VCols > > SuperClass;
// using typename SuperClass::TargetType;
// using typename SuperClass::ComponentType;
// using SuperClass::SetNthComponent;
// static void SetNthComponent(int , TargetType & pixel, const TargetType& v)
// {
// pixel = v;
// }
// };
//
// Default traits for pixel types deriving from VariableSizeMatrix<>
//
// template < typename T >
// class DefaultConvertPixelTraits< itk::VariableSizeMatrix< T > >
// : public itk::DefaultConvertPixelTraits< itk::VariableSizeMatrix< T > >
// {
// public:
// typedef itk::DefaultConvertPixelTraits< itk::VariableSizeMatrix < T > > SuperClass;
// using typename SuperClass::TargetType;
// using typename SuperClass::ComponentType;
// };
//
// Default traits for pixel types deriving from std::complex<>
//
template < typename T >
class DefaultConvertPixelTraits < ::std::complex < T > >
: public itk::DefaultConvertPixelTraits < ::std::complex < T > >
......
......@@ -79,33 +79,23 @@ public:
typedef typename itk::NumericTraits< OutputInternalPixelType >::ValueType OutputPixelValueType;
/** The values greater than or equal to the value are set to OutsideValue. */
/** The values greater than or equal to the value are set to \p thresh. */
void ClampAbove(const OutputPixelValueType &thresh);
/** The values less than or equal to the value are set to OutsideValue. */
/** The values less than or equal to the value are set to \p thresh. */
void ClampBelow(const OutputPixelValueType &thresh);
/** The values outside the range are set to OutsideValue. */
/** The values outside the range are set to \p lower or \p upper. */
void ClampOutside(const OutputPixelValueType &lower, const OutputPixelValueType &upper);
/** Set/Get methods to set the lower threshold */
void SetLower(OutputPixelValueType val)
{
m_Lower = val;
m_DLower = static_cast<double>(val);
this->GetFunctor().SetLowest( m_Lower );
this->Modified();
}
void SetLower(OutputPixelValueType val);
itkGetConstMacro(Lower, OutputPixelValueType);
/** Set/Get methods to set the upper threshold */
void SetUpper(OutputPixelValueType val)
{
m_Upper = val;
m_DUpper = static_cast<double>(val);
this->GetFunctor().SetHighest( m_Upper );
this->Modified();
}
void SetUpper(OutputPixelValueType val);
itkGetConstMacro(Upper, OutputPixelValueType);
......@@ -126,9 +116,6 @@ private:
ClampImageFilter(const Self&) = delete ;
void operator=(const Self&) = delete ;
double m_DLower;
double m_DUpper;
OutputPixelValueType m_Lower;
OutputPixelValueType m_Upper;
};
......
......@@ -41,11 +41,30 @@ ClampImageFilter<TInputImage, TOutputImage>
{
m_Lower = std::numeric_limits < OutputPixelValueType >::lowest();
m_Upper = std::numeric_limits < OutputPixelValueType >::max();
}
m_DLower = static_cast<double>(m_Lower);
m_DUpper = static_cast<double>(m_Upper);
template <class TInputImage, class TOutputImage>
void
ClampImageFilter<TInputImage, TOutputImage>
::SetLower(OutputPixelValueType val)
{
if ( m_Lower != val )
{
m_Lower = val;
this->GetFunctor().SetLowest( m_Lower );
this->Modified();
}
}
template <class TInputImage, class TOutputImage>
void
ClampImageFilter<TInputImage, TOutputImage>
::SetUpper(OutputPixelValueType val)
{
m_Upper = val;
this->GetFunctor().SetHighest( m_Upper );
this->Modified();
}
/**
*
......@@ -78,7 +97,6 @@ ClampImageFilter<TInputImage, TOutputImage>
{
m_Lower = std::numeric_limits < OutputPixelValueType >::lowest();
m_Upper = thresh;
m_DUpper = static_cast<double>(m_Upper);
this->GetFunctor().SetLowest( m_Lower );
this->GetFunctor().SetHighest( m_Upper );
this->Modified();
......@@ -97,7 +115,6 @@ ClampImageFilter<TInputImage, TOutputImage>
{
m_Upper = std::numeric_limits < OutputPixelValueType >::max();
m_Lower = thresh;
m_DLower = m_Lower;
this->GetFunctor().SetLowest( m_Lower );
this->GetFunctor().SetHighest( m_Upper );
this->Modified();
......@@ -123,8 +140,6 @@ ClampImageFilter<TInputImage, TOutputImage>
{
m_Lower = lower;
m_Upper = upper;
m_DLower = m_Lower;
m_DUpper = m_Upper;
this->GetFunctor().SetLowest( m_Lower );
this->GetFunctor().SetHighest( m_Upper );
this->Modified();
......
......@@ -64,13 +64,14 @@ public:
}
else
m_Scal = m_CompIn;
if ( m_cOutInternalPix )
m_CompOut = ( m_Scal + 1 ) / 2 ;
else if ( m_sOutPix || m_cOutPix )
m_CompOut = 1;
else
m_CompOut = m_Scal ;
if ( m_sOutPix || m_cOutPix )
m_CompOut = 1;
return m_CompOut ;
}
......@@ -164,7 +165,7 @@ protected:
}
void Clamp( std::vector < double > & vPixel ) const
{
{
for ( double & comp : vPixel )
{
if ( comp >= m_HighestBD )
......@@ -172,7 +173,7 @@ protected:
else if ( comp <= m_LowestBD )
comp = m_LowestBD;
}
}
}
template <class PixelType ,
std::enable_if_t < std::is_arithmetic < PixelType > ::value , int > = 0 >
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment