<commit_before>/*=========================================================================

  Program:   ORFEO Toolbox
  Language:  C++
  Date:      $Date$
  Version:   $Revision$


  Copyright (c) Centre National d'Etudes Spatiales. All rights reserved.
  See OTBCopyright.txt for details.


     This software is distributed WITHOUT ANY WARRANTY; without even
     the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
     PURPOSE.  See the above copyright notices for more information.

=========================================================================*/
#ifndef __otbMultiplyByScalarImageFilter_h
#define __otbMultiplyByScalarImageFilter_h

#include "itkUnaryFunctorImageFilter.h"

namespace otb
{

/** \class MultiplyByScalarImageFilter
 *
 */

namespace Functor
{

template<class TInput, class TOutput>
class MultiplyByScalar
{
public:
  MultiplyByScalar()
  {
    m_Coef = 1.0;
  }
  virtual ~MultiplyByScalar() {}
  inline TOutput operator ()(const TInput& value)
  {
    TOutput result;

    result = static_cast<TOutput>(m_Coef * value);

    return result;
  }

  void SetCoef(double Coef)
  {
    m_Coef = Coef;
  }
  double GetCoef(void) const
  {
    return (m_Coef);
  }

private:
  double m_Coef;
};
}

template <class TInputImage, class TOutputImage>
class ITK_EXPORT MultiplyByScalarImageFilter :
  public itk::UnaryFunctorImageFilter<
      TInputImage, TOutputImage,
      Functor::MultiplyByScalar<
          ITK_TYPENAME TInputImage::PixelType,
          ITK_TYPENAME TOutputImage::PixelType> >
{
public:
  /** Standard class typedefs. */
  typedef MultiplyByScalarImageFilter Self;
  typedef typename itk::UnaryFunctorImageFilter<
      TInputImage,
      TOutputImage,
      Functor::MultiplyByScalar<
          ITK_TYPENAME TInputImage::PixelType,
          ITK_TYPENAME TOutputImage::PixelType> > Superclass;
  typedef itk::SmartPointer<Self>       Pointer;
  typedef itk::SmartPointer<const Self> ConstPointer;

  /** Method for creation through the object factory. */
  itkNewMacro(Self);

  void SetCoef(double Coef)
  {
    this->GetFunctor().SetCoef(Coef);
    this->Modified();
  }
  double GetCoef(void) const
  {
    return (this->GetFunctor().GetCoef());
  }
protected:
  MultiplyByScalarImageFilter() {}
  virtual ~MultiplyByScalarImageFilter() {}

private:
  MultiplyByScalarImageFilter(const Self &); //purposely not implemented
  void operator =(const Self&); //purposely not implemented

};

} // end namespace otb

#endif
<commit_msg>WARN : correct warning<commit_after>/*=========================================================================

  Program:   ORFEO Toolbox
  Language:  C++
  Date:      $Date$
  Version:   $Revision$


  Copyright (c) Centre National d'Etudes Spatiales. All rights reserved.
  See OTBCopyright.txt for details.


     This software is distributed WITHOUT ANY WARRANTY; without even
     the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
     PURPOSE.  See the above copyright notices for more information.

=========================================================================*/
#ifndef __otbMultiplyByScalarImageFilter_h
#define __otbMultiplyByScalarImageFilter_h

#include "itkUnaryFunctorImageFilter.h"

namespace otb
{

/** \class MultiplyByScalarImageFilter
 *
 */

namespace Functor
{

template<class TInput, class TOutput>
class MultiplyByScalar
{
public:
  MultiplyByScalar()
  {
    m_Coef = 1.0;
  }
  virtual ~MultiplyByScalar() {}
  inline TOutput operator ()(const TInput& value)
  {
    TOutput result;

    result = static_cast<TOutput>(m_Coef * static_cast<double>(value));

    return result;
  }

  void SetCoef(double Coef)
  {
    m_Coef = Coef;
  }
  double GetCoef(void) const
  {
    return (m_Coef);
  }

private:
  double m_Coef;
};
}

template <class TInputImage, class TOutputImage>
class ITK_EXPORT MultiplyByScalarImageFilter :
  public itk::UnaryFunctorImageFilter<
      TInputImage, TOutputImage,
      Functor::MultiplyByScalar<
          ITK_TYPENAME TInputImage::PixelType,
          ITK_TYPENAME TOutputImage::PixelType> >
{
public:
  /** Standard class typedefs. */
  typedef MultiplyByScalarImageFilter Self;
  typedef typename itk::UnaryFunctorImageFilter<
      TInputImage,
      TOutputImage,
      Functor::MultiplyByScalar<
          ITK_TYPENAME TInputImage::PixelType,
          ITK_TYPENAME TOutputImage::PixelType> > Superclass;
  typedef itk::SmartPointer<Self>       Pointer;
  typedef itk::SmartPointer<const Self> ConstPointer;

  /** Method for creation through the object factory. */
  itkNewMacro(Self);

  void SetCoef(double Coef)
  {
    this->GetFunctor().SetCoef(Coef);
    this->Modified();
  }
  double GetCoef(void) const
  {
    return (this->GetFunctor().GetCoef());
  }
protected:
  MultiplyByScalarImageFilter() {}
  virtual ~MultiplyByScalarImageFilter() {}

private:
  MultiplyByScalarImageFilter(const Self &); //purposely not implemented
  void operator =(const Self&); //purposely not implemented

};

} // end namespace otb

#endif

{'fraction_non_alphanumeric': 0.14544369279745326, 'fraction_numerical': 0.0007958615200955034, 'mean_word_length': 4.108739837398374, 'pattern_counts': {'":': 0, '<': 22, '<?xml version=': 0, '>': 28, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4736329', 'n_tokens_mistral': 1598, 'n_tokens_neox': 1487, 'n_words': 366}