00001 /*========================================================================= 00002 00003 Program: Insight Segmentation & Registration Toolkit 00004 Module: $RCSfile: itkVectorToRGBPixelAccessor.h,v $ 00005 Language: C++ 00006 Date: $Date: 2009-03-03 15:11:49 $ 00007 Version: $Revision: 1.4 $ 00008 00009 Copyright (c) Insight Software Consortium. All rights reserved. 00010 See ITKCopyright.txt or http://www.itk.org/HTML/Copyright.htm for details. 00011 00012 This software is distributed WITHOUT ANY WARRANTY; without even 00013 the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR 00014 PURPOSE. See the above copyright notices for more information. 00015 00016 =========================================================================*/ 00017 #ifndef __itkVectorToRGBPixelAccessor_h 00018 #define __itkVectorToRGBPixelAccessor_h 00019 00020 00021 #include "itkRGBPixel.h" 00022 #include "itkVector.h" 00023 00024 00025 namespace itk 00026 { 00027 namespace Accessor 00028 { 00042 template <class T> 00043 class ITK_EXPORT VectorToRGBPixelAccessor 00044 { 00045 public: 00047 typedef VectorToRGBPixelAccessor Self; 00048 00051 typedef RGBPixel<T> ExternalType; 00052 00055 typedef Vector<T,3> InternalType; 00056 00058 inline void Set( InternalType & output, const ExternalType & input ) const 00059 { 00060 output[0] = input[0]; 00061 output[1] = input[1]; 00062 output[2] = input[2]; 00063 } 00064 00066 inline ExternalType Get( const InternalType & input ) const 00067 { 00068 ExternalType rgb(input.GetDataPointer()); 00069 return rgb; 00070 } 00072 00073 private: 00074 }; 00075 00076 } // end namespace Accessor 00077 } // end namespace itk 00078 00079 #endif 00080