#ifndef CLAMPRANGEIMAGEFILTER_H__
#define CLAMPRANGEIMAGEFILTER_H__

#include "ritkRImageFilterWrapper.h"
#include "ClampIntensityImageFilter.h"

using namespace itk;

/**	@class	ClampRangeImageFilter
 *	@author	Jakob Wasza
 *	@brief	range wrapper class for a ClampIntensityImageFilter
 *
 *	@details
 *	This is a wrapper for a ClampIntensityImageFilter. The filter
 *	works only on the range data. The filter will set the mask for
 *	the range image as returned from the ClampIntensityImageFilter
 *	\sa ClampIntensityImageFilter
 */
template <class TRImage>
class ClampRangeImageFilter : public ritk::RImageFilterWrapper<TRImage>
{
public:
	/** @name	Typedefs */
	//@{

	/** @name	Standard typedefs */
	//@{
	typedef ClampRangeImageFilter			Self;
	typedef ritk::RImageFilterWrapper<TRImage>	Superclass;
	typedef itk::SmartPointer<Self>				Pointer;
	typedef itk::SmartPointer<const Self>		ConstPointer;
	//@}

	/**	@name	Input and output typedefs */
	//@{
	typedef typename Superclass::InputImageType					InputImageType;
	typedef typename InputImageType::Pointer					InputImagePointer;
	typedef typename InputImageType::ConstPointer				InputImageConstPointer;
	typedef typename InputImageType::RangeImageType::PixelType	BoundValueType;
	typedef typename Superclass::OutputImageType				OutputImageType;
	typedef typename OutputImageType::Pointer					OutputImagePointer;
	//@}

	//@}

	/// Object creation
	itkNewMacro(Self);

	/// RTTI
	itkTypeMacro(ClampRangeImageFilter, RImageFilterWrapper);

	/// Set the lower bound
	void SetLowerBound(BoundValueType value);
	/// Get the lower bound
	BoundValueType GetLowerBound();
	/// Set the upper bound
	void SetUpperBound(BoundValueType value);
	/// Get the upper bound
	BoundValueType GetUpperBound();



protected:
	/// Constructor
	ClampRangeImageFilter();
	/// Destructor
	~ClampRangeImageFilter();

	/// Filtering routine
	void DoFiltering();

protected:
	/**	@name Typedefs for the filters */
	//@{
	typedef ClampIntensityImageFilter<typename InputImageType::RangeImageType,typename OutputImageType::RangeImageType,typename OutputImageType::FlagImageType>  RangeFilterType;
	typedef typename RangeFilterType::Pointer RangeFilterPointer;
	RangeFilterPointer m_RangeFilter;
	//@}

	/// Lower bound
	BoundValueType m_LowerBound;
	/// Upper bound
	BoundValueType m_UpperBound;

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

#include "ClampRangeImageFilter.txx"


#endif // CLAMPRANGEIMAGEFILTER_H__
