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

	Program:		Range Imaging Toolkit (RITK)
	Module:			ritkRImage2DActorPipeline.h
	Version:		$Revision: 1821 $
	Date:			$Date: 2011-10-02 15:41:17 +0200 (So, 02 Okt 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 RIMAGE2DACTORPIPELINE_H__
#define RIMAGE2DACTORPIPELINE_H__

#include "ritkVTK.h"


#include "ritkRImage.h"
#include "itkImageToVTKImageFilter.h"

#include "ritkVTKImageActorPipeline.h"
#include "ritkLUTData.h"

#include <vtkLookupTable.h>


namespace ritk
{

/**	@ingroup	ritkVTK
 *	@class		RImage2DActorPipeline
 *	@author		Sebastian Bauer
 *	@brief		2D image actor pipeline for range image data
 *
 *	@details
 *	This class provides an actor pipeline for range image data. The actor's associated
 *	VTK image data is thereby created from a RImage object. 
 **/
class RITKVTK_EXPORT RImage2DActorPipeline : public VTKImageActorPipeline
{
public:
	/// Casting
	vtkTypeMacro(RImage2DActorPipeline,VTKImageActorPipeline);

	/// Object creation
	static RImage2DActorPipeline *New();

	/**	@name The input types */
	//@{
	typedef VTKImageActorPipeline::VTKImageDataPointer	VTKImageDataPointer;
	typedef const VTKImageDataPointer					VTKImageDataConstPointer;
	typedef RImageF2									        RImageType;
	typedef RImageType::Pointer							  RImagePointer;
	typedef RImageType::ConstPointer					RImageConstPointer;
	//@}

	/**	@name Visualization modes */
	//@{
	/// The available types
	typedef enum VisualizationMode
	{
		ZBUFFER,
		RGB	
	} VisualizationMode;

	/**	@brief	Set the visualization mode
	 *	@param	Mode	The mode to be used
	 *
	 *	@brief
	 *	This method will set the visualization mode for the range image 2D actor.
	 *	The default visualization mode is RGB. \n
	 *	This method is in compliance with the thread safety concept of the actor pipeline.
	 *	@sa VisualizationMode
	 */
	void SetVisualizationMode(VisualizationMode Mode);

	/**	@brief	Use the built in lookup table
	 *	@param	UseLUT	Enable or disable
	 *
	 *	@details
	 *	Enable or disable LUT visualization. The built in LUT maps the 
	 *	raw intensity values to a color jet. By default, the LUT is disabled. \n
	 *	This method is in compliance with the thread safety concept of the actor pipeline.
	 */
	void UseLUT(bool UseLUT);
	//@}

	/// From VTKImageActorPipeline
	void SetData(VTKImageDataPointer Image, bool DeepCopy=true);

	/**	@brief	Set the data using a range image only
	 *	@param	Image	The RImage that holds the data
	 *
	 *	@details
	 *	This method will set the actual actor data. The VTK image data is thereby 
	 *	created from a RImage using the itkImageToVTKImageFilter class. 
	 *	The intensities (pixel colors) are computed as specified by the 
	 *	SetVisualizationMode() method. \n
	 *	This method is in compliance with the thread safety concept of the actor pipeline.
	 */
	void SetData(const RImageType *Image);

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

protected:
	/// The visualization mode
	VisualizationMode m_VisualizationMode;
	/// LUT usage
	bool m_UseLUT;
	/// The LUT that is used
	vtkSmartPointer<vtkLookupTable> m_LUT;

	/**	@name The ITK to VTK image converter @todo RGB_ISSUE*/
	//@{
	/*
	typedef RImageType::RGBImageType ImageType;	
	typedef itk::ImageToVTKImageFilter<ImageType> ImageToVTKImageFilterType;
	ImageToVTKImageFilterType::Pointer m_ImageToVTKImageFilter;*/
	//@}
};


} // end namespace ritk


#endif // RIMAGE2DACTORPIPELINE_H__