ITK  4.0.0
Insight Segmentation and Registration Toolkit
itkDefaultPixelAccessorFunctor.h
Go to the documentation of this file.
00001 /*=========================================================================
00002  *
00003  *  Copyright Insight Software Consortium
00004  *
00005  *  Licensed under the Apache License, Version 2.0 (the "License");
00006  *  you may not use this file except in compliance with the License.
00007  *  You may obtain a copy of the License at
00008  *
00009  *         http://www.apache.org/licenses/LICENSE-2.0.txt
00010  *
00011  *  Unless required by applicable law or agreed to in writing, software
00012  *  distributed under the License is distributed on an "AS IS" BASIS,
00013  *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
00014  *  See the License for the specific language governing permissions and
00015  *  limitations under the License.
00016  *
00017  *=========================================================================*/
00018 #ifndef __itkDefaultPixelAccessorFunctor_h
00019 #define __itkDefaultPixelAccessorFunctor_h
00020 
00021 #include "itkMacro.h"
00022 
00023 namespace itk
00024 {
00046 template< class TImageType >
00047 class ITK_EXPORT DefaultPixelAccessorFunctor
00048 {
00049 public:
00050   typedef TImageType                            ImageType;
00051   typedef typename ImageType::InternalPixelType InternalPixelType;
00052   typedef typename ImageType::PixelType         ExternalPixelType;
00053   typedef typename ImageType::AccessorType      PixelAccessorType;
00054   typedef unsigned int                          VectorLengthType;
00055 
00056   static void SetVectorLength(ImageType *, VectorLengthType)
00057   {}
00058 
00059   static VectorLengthType GetVectorLength(const ImageType *)
00060   {
00061     return 1;
00062   }
00063 
00068   inline void SetPixelAccessor(PixelAccessorType & accessor)
00069   {
00070     m_PixelAccessor = accessor;
00071   }
00072 
00076   inline void SetBegin( const InternalPixelType *itkNotUsed(begin) ) {}
00077 
00079   inline void Set(InternalPixelType & output, const ExternalPixelType & input) const
00080   {
00081     m_PixelAccessor.Set(output, input);
00082   }
00083 
00085   inline ExternalPixelType Get(InternalPixelType & input) const
00086   {
00087     return m_PixelAccessor.Get(input);
00088   }
00089 
00091   inline const ExternalPixelType Get(const InternalPixelType & input) const
00092   {
00093     return m_PixelAccessor.Get(input);
00094   }
00095 
00096 private:
00097   PixelAccessorType m_PixelAccessor; // The pixel accessor
00098 };
00099 }
00100 
00101 #endif
00102