ITK  4.1.0
Insight Segmentation and Registration Toolkit
itkLineIterator.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 __itkLineIterator_h
00019 #define __itkLineIterator_h
00020 
00021 #include "itkLineConstIterator.h"
00022 
00023 namespace itk
00024 {
00055 template< class TImage >
00056 class ITK_EXPORT LineIterator:public LineConstIterator< TImage >
00057 {
00058 public:
00059 
00061   typedef LineIterator Self;
00062 
00067   itkStaticConstMacro(ImageIteratorDimension, unsigned int,
00068                       TImage::ImageDimension);
00069 
00071   typedef LineConstIterator< TImage > Superclass;
00072 
00074   typedef typename Superclass::IndexType             IndexType;
00075   typedef typename Superclass::OffsetType            OffsetType;
00076   typedef typename Superclass::SizeType              SizeType;
00077   typedef typename Superclass::RegionType            RegionType;
00078   typedef typename Superclass::ImageType             ImageType;
00079   typedef typename Superclass::PixelContainer        PixelContainer;
00080   typedef typename Superclass::PixelContainerPointer PixelContainerPointer;
00081   typedef typename Superclass::InternalPixelType     InternalPixelType;
00082   typedef typename Superclass::PixelType             PixelType;
00083   typedef typename Superclass::AccessorType          AccessorType;
00084 
00086   itkTypeMacro(LineIterator, LineConstIterator);
00087 
00089   void Set(const PixelType & value)
00090   {
00091     // Normally, this would just be the following:
00092     //   m_Image->SetPixel(m_CurrentImageIndex,value);
00093     // However, we don't want a warning about m_Image being a ConstPointer
00094     // in the Superclass.
00095     const_cast< ImageType * >( this->m_Image.GetPointer() )->
00096     SetPixel(this->m_CurrentImageIndex, value);
00097   }
00099 
00103   const PixelType & Value(void)
00104   {
00105     return ( this->m_Image->GetPixel(this->m_CurrentImageIndex) );
00106   }
00107 
00110   Self & operator=(const Self & it);
00111 
00113   LineIterator(ImageType *imagePtr, const IndexType & firstIndex,
00114                const IndexType & lastIndex);
00115 
00117   virtual ~LineIterator() {}
00118 };
00119 } // end namespace itk
00120 
00121 // Define instantiation macro for this template.
00122 #define ITK_TEMPLATE_LineIterator(_, EXPORT, TypeX, TypeY)     \
00123   namespace itk                                                \
00124   {                                                            \
00125   _( 1 ( class EXPORT LineIterator< ITK_TEMPLATE_1 TypeX > ) ) \
00126   namespace Templates                                          \
00127   {                                                            \
00128   typedef LineIterator< ITK_TEMPLATE_1 TypeX >                 \
00129   LineIterator##TypeY;                                       \
00130   }                                                            \
00131   }
00132 
00133 #if ITK_TEMPLATE_EXPLICIT
00134 #include "Templates/itkLineIterator+-.h"
00135 #endif
00136 
00137 #if ITK_TEMPLATE_TXX
00138 #include "itkLineIterator.hxx"
00139 #endif
00140 
00141 #endif
00142