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

	Program:		Range Imaging Toolkit (RITK)
	Module:			ritkTruncatedSignedDistanceFunctionRayCaster.h
	Version:		$Revision: 3136 $
	Date:			$Date: 2012-04-19 14:42:59 +0200 (Do, 19 Apr 2012) $

	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 RITKTRUNCATEDSIGNEDDISTANCERAYCASTER_H__
#define RITKTRUNCATEDSIGNEDDISTANCERAYCASTER_H__

#include "ritkCuda.h"
#include "ritkTruncatedSignedDistanceFunction.h"
#include "ritkRayCasterBase.h"

#include "ritkRImage.h"

#include <itkDataObject.h>

using namespace itk;

namespace ritk
{

/**	@ingroup	Cuda
 *	@class		TruncatedSignedDistanceFunctionRayCaster
 *	@author		Jakob Wasza
 *	@brief		Surface prediction from ray casting a TSDF
 *
 *	@details
 */
template<typename TRImage>
class TruncatedSignedDistanceFunctionRayCaster : public RayCasterBase<TruncatedSignedDistanceFunction, TRImage>
{
public:
	/** @name Typedefs */
	//@{

	/** @name Standard typedefs */
	//@{
	typedef TruncatedSignedDistanceFunctionRayCaster					Self;
    typedef RayCasterBase<TruncatedSignedDistanceFunction, TRImage>		Superclass;
    typedef itk::SmartPointer<Self>										Pointer;
    typedef itk::SmartPointer<const Self>								ConstPointer;
	typedef itk::DataObject::Pointer									DataObjectPointer;
	//@}

	/** @name Input typedefs */
	//@{
	typedef typename Superclass::InputVolumeType	InputTSDFType;
	typedef typename InputTSDFType::Pointer			InputTSDFPointer;
	typedef typename InputTSDFType::ConstPointer	InputTSDFConstPointer;
	typedef typename InputTSDFType::PixelType		InputTSDFPixelType;
	typedef typename InputTSDFType::RegionType		InputTSDFRegionType;
	//@}
	
	/** @name Output image typedefs */
	//@{
	typedef typename Superclass::OutputImageType			OutputRangeImageType;
	typedef typename OutputRangeImageType::Pointer			OutputRangeImagePointer;
	typedef typename OutputRangeImageType::ConstPointer		OutputRangeImageConstPointer;
	//@}

	/** @name Projection matrix typedefs */
	//@{
	typedef typename Superclass::ProjectionMatrixType			ProjectionMatrixType;
	typedef typename Superclass::ProjectionMatrixInverseType	ProjectionMatrixInverseType;
	//@}

	//@}

	/// Object creation
	itkNewMacro(Self);

	/// RTTI
	itkTypeMacro(TruncatedSignedDistanceFunctionRayCaster,RayCasterBase);

	/** @name Dimensions macros */
	//@{
	itkStaticConstMacro(InputImageDimension,  unsigned int, InputTSDFType::ImageDimension);
	itkStaticConstMacro(OutputImageDimension, unsigned int, OutputRangeImageType::ImageDimension);
	//@}

	/**	@name Overloaded to support Cuda containers at the output */
	//{
	virtual void GenerateOutputInformation();
	//@}


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

	/// Creates the itk::ProcessObject's outputs for the normal image
	virtual DataObjectPointer MakeOutput(unsigned int idx);

	/// Data generation
	virtual void GenerateData();
	
private:
	/// purposely not implemented
	TruncatedSignedDistanceFunctionRayCaster(Self&);
	/// purposely not implemented
	void operator=(const Self&);

private:
};

} // ritk


#endif //
