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

	Program:		Range Imaging Toolkit (RITK)
	Module:			ritkTruncatedSignedDistanceFunctionInterfaces.h
	Version:		$Revision: 2965 $
	Date:			$Date: 2012-04-10 18:13:53 +0200 (Di, 10 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 RITKTRUNCATEDSIGNEDDISTANCEFUNCTIONINTERFACES_H__
#define RITKTRUNCATEDSIGNEDDISTANCEFUNCTIONINTERFACES_H__

#include "ritkCuda.h"


/**	@name	Configureation for TSDF integration */
//@{
struct ritkTSDFIntegrationConfig
{
	/**	@name Projection parameters */
	//@{
	/// Projection matrix 3x4 (linearized as [P[0,0], P[0,1], ... , P[3,4]])
	float ProjectionMatrix[12];
	/// The optical center (must have been computed from the given projection matrix)
	float OpticalCenter[3];
	/// The plane normal (must have been computed from the given projction matrix e.g. by computing the ray direction of the center pixel)
	float PlaneNormal[3];
	/// Camera size [sx,sy] in pixels
	int CameraSize[2];
	//@}

	/// The range data array
	cudaArray *RangeData;
	/// The range data channel descriptor
	cudaChannelFormatDesc RangeDataDesc;

	/// The flag data array
	cudaArray *FlagData;
	/// The flag data channel descriptor
	cudaChannelFormatDesc FlagDataDesc;

	/// The TSDF volume
	cudaPitchedPtr TSDF;
	/// The size of the TSDF volume (in voxels)
	unsigned int TSDFVolumeSize[3];
	/// The origin of the TSDF volume (in world coordinates)
	float TSDFVolumeOrigin[3];
	/// The spacing of the TSDF volume (in mm/voxel)
	float TSDFVolumeSpacing[3];

	/// Cutoff value
	float CutoffValue;
	/// Invalid/NULL value
	float InvalidValue;
};
//@}


//----------------------------------------------------------------------------
/**	@brief	TSDF integration
 *	@param	TSDFIntegrationConfig	The config
 *	
 *	@details
 */
CUDA_EXPORT
void
ritkTSDFIntegration(ritkTSDFIntegrationConfig *TSDFIntegrationConfig);



#endif // RITKTRUNCATEDSIGNEDDISTANCEFUNCTIONINTERFACES_H__