/*======================================================================================

	Program:		RITK Plugins
	Module:			CUDANormalizedConvolutionRImageFilter.h
	Version:		$Revision: 898 $
	Date:			$Date: 2011-04-29 18:51:40 +0200 (Fri, 29 Apr 2011) $

	Copyright (c) 2010-2011
	Pattern Recognition Lab, 
    University Erlangen-Nuremberg, Germany
    All rights reserved.

	This program is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 
	See RITKCopyright.txt for more information.

	http://www5.informatik.uni-erlangen.de/research/software/ritk

========================================================================================*/

#ifndef CUDANORMALIZEDCONVOLUTIONRIMAGEFILTER_H__
#define CUDANORMALIZEDCONVOLUTIONRIMAGEFILTER_H__

#include "ritkRImageFilterWrapper.h"
#include "CUDASeparableNormalizedConvolutionImageFilter.h"

/**	@class	CUDANormalizedConvolutionRImageFilter
 *	@author	Jakob Wasza
 *	@brief	Defect pixel interpolation employing normalized convolution with CUDA
 *	
 *	@details
 *	This class implements defect pixel interpolation (DPI) for range imaging by using the normalized convolution concept.
 *	This class wraps a regular ITK filter that contains the actual processing of the range image. 
 *	@sa	CUDASeparableNormalizedConvolutionImageFilter
 */
template <class TRImage>
class CUDANormalizedConvolutionRImageFilter : public ritk::RImageFilterWrapper<TRImage>
{
public:
	/** @name	Typedefs */
	//@{

	/** @name	Standard typedefs */
	//@{
	typedef CUDANormalizedConvolutionRImageFilter		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 Superclass::OutputImageType		OutputImageType;
	typedef typename OutputImageType::Pointer			OutputImagePointer;
	//@}

	//@}

	/// Object creation
	itkNewMacro(Self);

	/// RTTI
	itkTypeMacro(CUDANormalizedConvolutionRImageFilter, ritk::RImageFilterWrapper);

	/**	@name Range parameters */
	//@{
	/// Set the kernel size of the range gaussian
	void SetRangeKernelSize(int size);
	/// Set the spread in pixels
	void SetRangeSigma(float Sigma);
	//@}

protected:
	/// Constructor
	CUDANormalizedConvolutionRImageFilter();
	/// Destructor
	virtual ~CUDANormalizedConvolutionRImageFilter();

	/// The actual filtering. @sa RImageFilterWrapper::DoFiltering()
	void DoFiltering();

protected:
	/**	@name The actual filter operating on the range data */
	//@{
	typedef CUDASeparableNormalizedConvolutionImageFilter<typename InputImageType::RangeImageType, typename InputImageType::FlagImageType>  RangeFilterType;
	typedef typename RangeFilterType::Pointer RangeFilterPointer;
	RangeFilterPointer m_RangeFilter;
	//@}

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

/// Explicit template instantiation
typedef CUDANormalizedConvolutionRImageFilter<ritk::RImageF2> CUDANormalizedConvolutionRImageFilterF2;


#endif // CUDANORMALIZEDCONVOLUTIONRIMAGEFILTER_H__
