ITK  4.3.0
Insight Segmentation and Registration Toolkit
itkLineIterator.h
Go to the documentation of this file.
1 /*=========================================================================
2  *
3  * Copyright Insight Software Consortium
4  *
5  * Licensed under the Apache License, Version 2.0 (the "License");
6  * you may not use this file except in compliance with the License.
7  * You may obtain a copy of the License at
8  *
9  * http://www.apache.org/licenses/LICENSE-2.0.txt
10  *
11  * Unless required by applicable law or agreed to in writing, software
12  * distributed under the License is distributed on an "AS IS" BASIS,
13  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14  * See the License for the specific language governing permissions and
15  * limitations under the License.
16  *
17  *=========================================================================*/
18 #ifndef __itkLineIterator_h
19 #define __itkLineIterator_h
20 
21 #include "itkLineConstIterator.h"
22 
23 namespace itk
24 {
55 template< class TImage >
56 class ITK_EXPORT LineIterator:public LineConstIterator< TImage >
57 {
58 public:
59 
61  typedef LineIterator Self;
62 
67  itkStaticConstMacro(ImageIteratorDimension, unsigned int,
68  TImage::ImageDimension);
69 
72 
74  typedef typename Superclass::IndexType IndexType;
76  typedef typename Superclass::SizeType SizeType;
78  typedef typename Superclass::ImageType ImageType;
82  typedef typename Superclass::PixelType PixelType;
84 
86  itkTypeMacro(LineIterator, LineConstIterator);
87 
89  void Set(const PixelType & value)
90  {
91  // Normally, this would just be the following:
92  // m_Image->SetPixel(m_CurrentImageIndex,value);
93  // However, we don't want a warning about m_Image being a ConstPointer
94  // in the Superclass.
95  const_cast< ImageType * >( this->m_Image.GetPointer() )->
96  SetPixel(this->m_CurrentImageIndex, value);
97  }
99 
103  const PixelType & Value(void)
104  {
105  return ( this->m_Image->GetPixel(this->m_CurrentImageIndex) );
106  }
107 
110  Self & operator=(const Self & it);
111 
113  LineIterator(ImageType *imagePtr, const IndexType & firstIndex,
114  const IndexType & lastIndex);
115 
117  virtual ~LineIterator() {}
118 };
119 } // end namespace itk
120 
121 #ifndef ITK_MANUAL_INSTANTIATION
122 #include "itkLineIterator.hxx"
123 #endif
124 
125 #endif
126