Commit 9f521be3 authored by Cédric Traizet's avatar Cédric Traizet

STYLE: run clange format

parent 1b7a4d22
Pipeline #496 passed with stage
in 22 minutes and 36 seconds
......@@ -79,7 +79,7 @@ public:
typedef itk::BinaryThresholdImageFilter<LabelImageType,
LabelImageType> ThresholdFilterType;
template<class TInput, class TOutput>
template <class TInput, class TOutput>
struct EncoderFunctorType
{
StatsFilterType::LabelPopulationMapType* m_CountMap;
......@@ -93,17 +93,17 @@ public:
static constexpr size_t m_NbStatsPerBand{4};
static constexpr size_t m_NbGlobalStats{1};
size_t OutputSize(const std::array<size_t,1> & ) const
size_t OutputSize(const std::array<size_t, 1>&) const
{
return m_NbInputComponents*m_NbStatsPerBand+m_NbGlobalStats;
}
size_t OutputSize() const
{
return m_NbInputComponents*m_NbStatsPerBand+m_NbGlobalStats;
return m_NbInputComponents * m_NbStatsPerBand + m_NbGlobalStats;
}
TOutput operator()(TInput const &pix)
TOutput operator()(TInput const& pix)
{
TOutput outPix(OutputSize());
outPix.Fill(m_OutBvValue);
......@@ -135,11 +135,8 @@ public:
else return false;
}
};
typedef otb::FunctorImageFilter<EncoderFunctorType<
LabelValueType,
FloatVectorImageType::PixelType
>> EncoderFilterType;
typedef otb::FunctorImageFilter<EncoderFunctorType<LabelValueType, FloatVectorImageType::PixelType>> EncoderFilterType;
/** Standard macro */
itkNewMacro(Self);
itkTypeMacro(ZonalStatistics, Application);
......@@ -414,19 +411,18 @@ public:
m_EncoderFilter->SetInput(m_RasterizeFilter->GetOutput());
}
m_EncoderFilter->GetModifiableFunctor().m_CountMap = &m_CountMap;
m_EncoderFilter->GetModifiableFunctor().m_MeanMap = &m_MeanMap;
m_EncoderFilter->GetModifiableFunctor().m_StdMap = &m_StdMap;
m_EncoderFilter->GetModifiableFunctor().m_MinMap = &m_MinMap;
m_EncoderFilter->GetModifiableFunctor().m_MaxMap = &m_MaxMap;
m_EncoderFilter->GetModifiableFunctor().m_NbInputComponents = m_InputImage->GetNumberOfComponentsPerPixel();
m_EncoderFilter->GetModifiableFunctor().m_InNoData = m_IntNoData;
m_EncoderFilter->GetModifiableFunctor().m_OutBvValue = m_OutBvValue;
otbAppLogINFO("Output raster image will have " <<
(m_EncoderFilter->GetFunctor()).OutputSize() << " bands\n");
AddProcess(m_EncoderFilter, "Encode output raster image");
SetParameterOutputImage("out.raster.filename", m_EncoderFilter->GetOutput());
m_EncoderFilter->GetModifiableFunctor().m_CountMap = &m_CountMap;
m_EncoderFilter->GetModifiableFunctor().m_MeanMap = &m_MeanMap;
m_EncoderFilter->GetModifiableFunctor().m_StdMap = &m_StdMap;
m_EncoderFilter->GetModifiableFunctor().m_MinMap = &m_MinMap;
m_EncoderFilter->GetModifiableFunctor().m_MaxMap = &m_MaxMap;
m_EncoderFilter->GetModifiableFunctor().m_NbInputComponents = m_InputImage->GetNumberOfComponentsPerPixel();
m_EncoderFilter->GetModifiableFunctor().m_InNoData = m_IntNoData;
m_EncoderFilter->GetModifiableFunctor().m_OutBvValue = m_OutBvValue;
otbAppLogINFO("Output raster image will have " << (m_EncoderFilter->GetFunctor()).OutputSize() << " bands\n");
AddProcess(m_EncoderFilter, "Encode output raster image");
SetParameterOutputImage("out.raster.filename", m_EncoderFilter->GetOutput());
}
void WriteXMLStatsFile()
......
......@@ -46,25 +46,23 @@ namespace Wrapper
namespace Functor
{
template<class TInput, class TOutput>
template <class TInput, class TOutput>
class LuminanceOperator
{
public:
LuminanceOperator() = default;
size_t OutputSize(const std::array<size_t,1> &) const
size_t OutputSize(const std::array<size_t, 1>&) const
{
return 1;
}
virtual ~LuminanceOperator() = default;
TOutput operator() ( TInput input )
{
TOutput out(1);
out[0] = m_LumCoef[0] * input[m_Rgb[0]] +
m_LumCoef[1] * input[m_Rgb[1]] +
m_LumCoef[2] * input[m_Rgb[2]] ;
return out;
TOutput operator()(TInput input)
{
TOutput out(1);
out[0] = m_LumCoef[0] * input[m_Rgb[0]] + m_LumCoef[1] * input[m_Rgb[1]] + m_LumCoef[2] * input[m_Rgb[2]];
return out;
} // end operator ()
......@@ -86,7 +84,7 @@ private:
std::vector<float> m_LumCoef;
}; // end of functor class LuminanceOperator
} // namespace functor
} // namespace functor
class ContrastEnhancement : public Application
{
......@@ -127,9 +125,7 @@ public:
typedef otb::StreamingStatisticsImageFilter < FloatImageType >
StatsFilterType;
typedef otb::FunctorImageFilter < Functor::LuminanceOperator
<FloatVectorImageType::PixelType, FloatVectorImageType::PixelType> >
LuminanceFunctorType;
typedef otb::FunctorImageFilter<Functor::LuminanceOperator<FloatVectorImageType::PixelType, FloatVectorImageType::PixelType>> LuminanceFunctorType;
typedef itk::StreamingImageFilter < LutType , LutType >
StreamingImageFilterType;
......@@ -705,8 +701,8 @@ private:
lumCoef[i] /= sum;
}
m_LuminanceFunctor = LuminanceFunctorType::New() ;
m_LuminanceFunctor->GetModifiableFunctor().SetRgb( rgb );
m_LuminanceFunctor->GetModifiableFunctor().SetLumCoef( lumCoef );
m_LuminanceFunctor->GetModifiableFunctor().SetRgb(rgb);
m_LuminanceFunctor->GetModifiableFunctor().SetLumCoef(lumCoef);
m_LuminanceFunctor->SetInput( inImage );
m_LuminanceFunctor->UpdateOutputInformation();
}
......
......@@ -92,8 +92,8 @@ public:
{
m_OutputSize = nb;
}
size_t OutputSize(const std::array<size_t,1> & ) const
size_t OutputSize(const std::array<size_t, 1>&) const
{
return m_OutputSize;
}
......@@ -224,9 +224,7 @@ public:
StreamingStatisticsMapFromLabelImageFilterType;
// Inverse mapper for color->label operation
typedef otb::FunctorImageFilter
<Functor::VectorMapping
<RGBPixelType, LabelVectorType> > ColorToLabelFilterType;
typedef otb::FunctorImageFilter<Functor::VectorMapping<RGBPixelType, LabelVectorType>> ColorToLabelFilterType;
// Streaming the input image for color->label operation
typedef RGBImageType::RegionType RegionType;
......
......@@ -43,11 +43,11 @@ public:
typedef std::vector<TOutput> ColorListType;
size_t OutputSize(const std::array<size_t,1> &) const
size_t OutputSize(const std::array<size_t, 1>&) const
{
return 3;
}
void AddColor(const TOutput& color)
{
m_ScoreColors.push_back(color);
......@@ -124,9 +124,7 @@ public:
typedef otb::HooverInstanceFilter<LabelMapType> InstanceFilterType;
typedef otb::LabelMapToAttributeImageFilter
<LabelMapType, FloatVectorImageType> AttributeImageFilterType;
typedef otb::FunctorImageFilter
<Functor::HooverColorMapping
<FloatPixelType, Int16PixelType> > HooverColorFilterType;
typedef otb::FunctorImageFilter<Functor::HooverColorMapping<FloatPixelType, Int16PixelType>> HooverColorFilterType;
private:
void DoInit() override
......
......@@ -27,7 +27,8 @@
namespace otb
{
namespace Functor {
namespace Functor
{
/** \class DotProductFunctor
*
......@@ -35,14 +36,14 @@ namespace Functor {
*
* \ingroup OTBCommon
*/
template<class TInput, class TOutput>
template <class TInput, class TOutput>
class DotProductFunctor
{
public:
typedef TInput InputType;
typedef TOutput OutputType;
typedef TInput InputType;
typedef TOutput OutputType;
DotProductFunctor() = default;
DotProductFunctor() = default;
virtual ~DotProductFunctor() = default;
const InputType& GetVector()
......@@ -55,14 +56,14 @@ public:
m_Vector = m;
}
OutputType operator ()(const InputType& in)
OutputType operator()(const InputType& in)
{
assert(in.Size() == m.Size());
OutputType result = 0;
for(unsigned int i = 0; i < in.Size(); ++i)
{
for (unsigned int i = 0; i < in.Size(); ++i)
{
result += in[i] * m_Vector[i];
}
}
return result;
}
......@@ -79,15 +80,14 @@ private:
* with respect to the specified vector
*
* \sa otb::Functor::DotProductFunctor
*
*
* \ingroup Streamed
* \ingroup Threaded
*
* \ingroup OTBFunctor
*/
template <typename TInputImage, typename TOutputImage>
using DotProductImageFilter = FunctorImageFilter<
Functor::DotProductFunctor<typename TInputImage::PixelType, typename TOutputImage::PixelType> >;
using DotProductImageFilter = FunctorImageFilter<Functor::DotProductFunctor<typename TInputImage::PixelType, typename TOutputImage::PixelType>>;
} // namespace otb
#endif
......@@ -48,13 +48,13 @@ public:
ProjectiveProjectionFunctor() : m_OutputSize(0) {}
virtual ~ProjectiveProjectionFunctor() {}
size_t OutputSize(const std::array<size_t,1> & nbBands) const;
size_t OutputSize(const std::array<size_t, 1>& nbBands) const;
const InputType& GetProjectionDirection();
void SetProjectionDirection(const InputType& p);
OutputType operator ()(const InputType& in);
OutputType operator()(const InputType& in);
private:
unsigned int m_OutputSize;
......@@ -72,9 +72,8 @@ private:
* \ingroup OTBProjection
*/
template <typename TInputImage, typename TOutputImage, typename TPrecision>
using ProjectiveProjectionImageFilter = FunctorImageFilter<
Functor::ProjectiveProjectionFunctor<typename TInputImage::PixelType,
typename TOutputImage::PixelType, TPrecision> >;
using ProjectiveProjectionImageFilter =
FunctorImageFilter<Functor::ProjectiveProjectionFunctor<typename TInputImage::PixelType, typename TOutputImage::PixelType, TPrecision>>;
} // end namespace otb
......
......@@ -36,7 +36,7 @@ namespace Functor {
* \brief Perform fully constrained least squares on a pixel
*
* \sa ISRAUnmixingImageFilter
*
*
* \ingroup OTBUnmixing
*/
template<class TInput, class TOutput, class TPrecision>
......@@ -53,9 +53,9 @@ public:
typedef vnl_matrix<PrecisionType> MatrixType;
ISRAUnmixingFunctor();
virtual ~ISRAUnmixingFunctor() =default;
virtual ~ISRAUnmixingFunctor() = default;
size_t OutputSize(const std::array<size_t,1> & nbBands) const;
size_t OutputSize(const std::array<size_t, 1>& nbBands) const;
void SetEndmembersMatrix(const MatrixType& U);
const MatrixType& GetEndmembersMatrix(void) const;
......@@ -116,9 +116,7 @@ private:
* \ingroup OTBUnmixing
*/
template <typename TInputImage, typename TOutputImage, typename TPrecision>
using ISRAUnmixingImageFilter = FunctorImageFilter<
Functor::ISRAUnmixingFunctor<typename TInputImage::PixelType,
typename TOutputImage::PixelType, TPrecision> >;
using ISRAUnmixingImageFilter = FunctorImageFilter<Functor::ISRAUnmixingFunctor<typename TInputImage::PixelType, typename TOutputImage::PixelType, TPrecision>>;
} // end namespace otb
......
......@@ -56,7 +56,7 @@ public:
NCLSUnmixingFunctor();
virtual ~NCLSUnmixingFunctor() = default;
size_t OutputSize(const std::array<size_t,1> & nbBands) const;
size_t OutputSize(const std::array<size_t, 1>& nbBands) const;
void SetEndmembersMatrix(const MatrixType& U);
const MatrixType& GetEndmembersMatrix(void) const;
......@@ -119,9 +119,7 @@ private:
* \ingroup OTBUnmixing
*/
template <typename TInputImage, typename TOutputImage, typename TPrecision>
using NCLSUnmixingImageFilter = FunctorImageFilter<
Functor::NCLSUnmixingFunctor<typename TInputImage::PixelType,
typename TOutputImage::PixelType, TPrecision> >;
using NCLSUnmixingImageFilter = FunctorImageFilter<Functor::NCLSUnmixingFunctor<typename TInputImage::PixelType, typename TOutputImage::PixelType, TPrecision>>;
} // end namespace otb
......
......@@ -50,14 +50,14 @@ public:
typedef vnl_vector<PrecisionType> VectorType;
typedef vnl_matrix<PrecisionType> MatrixType;
UnConstrainedLeastSquareFunctor() : m_OutputSize(0) {};
UnConstrainedLeastSquareFunctor() : m_OutputSize(0){};
virtual ~UnConstrainedLeastSquareFunctor() = default;
size_t OutputSize(const std::array<size_t,1> & nbBands) const;
size_t OutputSize(const std::array<size_t, 1>& nbBands) const;
void SetMatrix(const MatrixType& m);
OutputType operator ()(const InputType& in) const;
OutputType operator()(const InputType& in) const;
private:
......@@ -92,9 +92,8 @@ private:
* \ingroup OTBUnmixing
*/
template <typename TInputImage, typename TOutputImage, typename TPrecision>
using UnConstrainedLeastSquareImageFilter = FunctorImageFilter<
Functor::UnConstrainedLeastSquareFunctor<typename TInputImage::PixelType,
typename TOutputImage::PixelType, TPrecision> >;
using UnConstrainedLeastSquareImageFilter =
FunctorImageFilter<Functor::UnConstrainedLeastSquareFunctor<typename TInputImage::PixelType, typename TOutputImage::PixelType, TPrecision>>;
} // end namespace otb
......
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