/**============================================================================
 *
 * \file   rescale_intensity_filter.hpp
 * \brief  Declarations for the RescaleIntensityFilter class.
 *
 * \author Leblanc Christophe.
 * \date   19/11/2012
 * \email cleblancad@gmail.com
 *
 * Code inspired from:
 * 'Getting Started with ITK + VTK'
 * L. Ibanez, W. Schroeder, Insight Software Consortium.
 *
 *===========================================================================*/

#ifndef TOMOPROCESS_FILTER_RESCALE_INTENSITY_FILTER_HPP
#define TOMOPROCESS_FILTER_RESCALE_INTENSITY_FILTER_HPP

#include "filter.hpp"
#include "itkRescaleIntensityImageFilter.h"

TOMOPROCESS_OPEN_GLOBAL_NAMESPACE
TOMOPROCESS_OPEN_FILTER_NAMESPACE

/** \class RescaleIntensityFilter
  * \brief Rescales the intensity of an image.
  */
template<class ImageT>
class RescaleIntensityFilter
  : public Filter<
      itk::RescaleIntensityImageFilter<
        typename ImageT::InputImageType,
	typename ImageT::OutputImageType>,
      ImageT>
{
public:
  /// \brief This class.
  typedef RescaleIntensityFilter Self;
  
  /// \brief Parent class.
  typedef Filter<
    itk::RescaleIntensityImageFilter<
      typename ImageT::InputImageType,
      typename ImageT::OutputImageType>,
    ImageT> SuperClass;
    
  /// \brief Image type.
  typedef ImageT ImageType;
  
  /// \brief Pixel type.
  typedef typename ImageType::OutputImageType::PixelType PixelType;
  
  /// \brief Sets the parameters.
  /// \param[in] outMinimum minimum pixel value of the output image.
  /// \param[in] outMaximum maximum pixel value of the output image.
  virtual void SetParameters(PixelType outMinimum, PixelType outMaximum)
  {
    this->m_Filter->SetOutputMinimum(outMinimum);
    this->m_Filter->SetOutputMaximum(outMaximum);
    
    // Sets the filter to be run in place.
    this->m_Filter->InPlaceOn();
  }
};


TOMOPROCESS_CLOSE_FILTER_NAMESPACE
TOMOPROCESS_CLOSE_GLOBAL_NAMESPACE

#endif // TOMOPROCESS_FILTER_RESCALE_INTENSITY_FILTER_HPP