Main Page   Groups   Namespace List   Class Hierarchy   Alphabetical List   Compound List   File List   Namespace Members   Compound Members   File Members   Concepts

itkDefaultVectorPixelAccessorFunctor.h

Go to the documentation of this file.
00001 /*=========================================================================
00002 
00003   Program:   Insight Segmentation & Registration Toolkit
00004   Module:    $RCSfile: itkDefaultVectorPixelAccessorFunctor.h,v $
00005   Language:  C++
00006   Date:      $Date: 2008-10-07 09:09:39 $
00007   Version:   $Revision: 1.3 $
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 __itkDefaultVectorPixelAccessorFunctor_h
00018 #define __itkDefaultVectorPixelAccessorFunctor_h
00019 
00020 namespace itk
00021 {
00041 template <class TImageType >
00042 class ITK_EXPORT DefaultVectorPixelAccessorFunctor
00043 {
00044 public:
00045 
00046   typedef TImageType                                   ImageType;
00047   typedef typename ImageType::InternalPixelType        InternalPixelType;
00048   typedef typename ImageType::PixelType                ExternalPixelType;
00049   typedef typename ImageType::AccessorType             PixelAccessorType;
00050   typedef unsigned int                                 VectorLengthType;
00051   
00052   static void SetVectorLength( ImageType *image, VectorLengthType length )
00053     { 
00054     image->SetVectorLength( length );
00055     }
00056 
00057   static VectorLengthType GetVectorLength( const ImageType * image )
00058     {
00059     return image->GetVectorLength();
00060     } 
00061   
00066   inline void SetPixelAccessor( PixelAccessorType& accessor ) 
00067     {
00068     m_PixelAccessor = accessor;
00069     }
00070 
00072   inline void SetBegin( const InternalPixelType * begin ) 
00073     { this->m_Begin = const_cast< InternalPixelType * >( begin ); }
00074 
00076   inline void Set( InternalPixelType & output, const ExternalPixelType &input ) const
00077     {
00078     m_PixelAccessor.Set( output, input, (&output)-m_Begin );
00079     }
00080 
00082   inline ExternalPixelType Get( const InternalPixelType &input ) const
00083     {
00084     return m_PixelAccessor.Get( input, &input  - m_Begin );
00085     }
00086 
00087 private:
00088   PixelAccessorType     m_PixelAccessor; // The pixel accessor
00089   InternalPixelType *   m_Begin;         // Begin of the buffer
00090 };
00091 
00092 }
00093 
00094 #endif
00095 

Generated at Tue Sep 15 02:45:36 2009 for ITK by doxygen 1.5.8 written by Dimitri van Heesch, © 1997-2000