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

itkNthElementPixelAccessor.h

Go to the documentation of this file.
00001 /*========================================================================= 00002 00003 Program: Insight Segmentation & Registration Toolkit 00004 Module: $RCSfile: itkNthElementPixelAccessor.h,v $ 00005 Language: C++ 00006 Date: $Date: 2003/09/10 14:29:18 $ 00007 Version: $Revision: 1.10 $ 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 __itkNthElementPixelAccessor_h 00018 #define __itkNthElementPixelAccessor_h 00019 00020 #include "itkMacro.h" 00021 00022 namespace itk 00023 { 00024 00047 template < class T, class TContainer > 00048 class ITK_EXPORT NthElementPixelAccessor 00049 { 00050 public: 00052 typedef NthElementPixelAccessor Self; 00053 00055 typedef T ExternalType; 00056 00059 typedef TContainer InternalType; 00060 00062 inline void Set( InternalType & output, const ExternalType & input ) const 00063 { output[m_ElementNumber] = input; } 00064 00066 inline ExternalType Get( const InternalType & input ) const 00067 { return static_cast<ExternalType>( input[m_ElementNumber] ); } 00068 00070 unsigned int GetElementNumber(void) const 00071 { return m_ElementNumber; } 00072 00074 void SetElementNumber( unsigned int nth ) 00075 { m_ElementNumber = nth; } 00076 00079 bool operator!=(const Self& accessor) const 00080 { 00081 return (m_ElementNumber != accessor.m_ElementNumber); 00082 } 00083 00085 NthElementPixelAccessor & operator=( const NthElementPixelAccessor & accessor ) 00086 { 00087 m_ElementNumber = accessor.m_ElementNumber; 00088 return *this; 00089 } 00090 00092 NthElementPixelAccessor() 00093 { 00094 m_ElementNumber = 0; 00095 } 00096 00097 private: 00098 // Identifier of the N-th element to be accessed 00099 unsigned int m_ElementNumber; 00100 00101 }; 00102 00103 00104 } // end namespace itk 00105 00106 #endif 00107

Generated at Sun Apr 1 02:40:00 2007 for ITK by doxygen 1.3.8 written by Dimitri van Heesch, © 1997-2000