itkShapedNeighborhoodIterator.h
Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017 #ifndef __itkShapedNeighborhoodIterator_h
00018 #define __itkShapedNeighborhoodIterator_h
00019
00020 #include <vector>
00021 #include <list>
00022 #include "itkConstShapedNeighborhoodIterator.h"
00023
00024 namespace itk {
00025
00142 template<class TImage, class TBoundaryCondition
00143 = ZeroFluxNeumannBoundaryCondition<TImage> >
00144 class ITK_EXPORT ShapedNeighborhoodIterator
00145 : public ConstShapedNeighborhoodIterator<TImage, TBoundaryCondition>
00146 {
00147 public:
00149 typedef typename TImage::InternalPixelType InternalPixelType;
00150 typedef typename TImage::PixelType PixelType;
00151
00153 itkStaticConstMacro(Dimension, unsigned int, TImage::ImageDimension);
00154
00156 typedef ShapedNeighborhoodIterator Self;
00157 typedef ConstShapedNeighborhoodIterator<TImage, TBoundaryCondition>
00158 Superclass;
00159
00161 typedef typename Superclass::OffsetType OffsetType;
00162 typedef typename OffsetType::OffsetValueType OffsetValueType;
00163 typedef typename Superclass::RadiusType RadiusType;
00164 typedef typename Superclass::SizeType SizeType;
00165 typedef typename Superclass::SizeValueType SizeValueType;
00166 typedef typename Superclass::ConstIterator ConstIterator;
00167 typedef typename Superclass::IndexListType IndexListType;
00168 typedef typename Superclass::BoundaryConditionType BoundaryConditionType;
00169 typedef typename Superclass::ImageBoundaryConditionPointerType
00170 ImageBoundaryConditionPointerType;
00171 typedef typename Superclass::NeighborhoodType NeighborhoodType;
00172 typedef typename Superclass::IndexType IndexType;
00173 typedef typename Superclass::ImageType ImageType;
00174 typedef typename Superclass::RegionType RegionType;
00175 typedef typename Superclass::IndexValueType IndexValueType;
00176
00178 struct Iterator : public ConstIterator
00179 {
00180 Iterator() {}
00181 Iterator(Self *s) : ConstIterator(s) {}
00183
00184 ~Iterator() {}
00185 const Iterator &operator=(const Iterator &o)
00186 {
00187 ConstIterator::operator=(o);
00188 return *this;
00189 }
00190
00191
00192 void Set(const PixelType &v) const
00193 { ConstIterator::ProtectedSet(v); }
00194
00195 };
00196
00198 ShapedNeighborhoodIterator()
00199 {
00200 m_BeginIterator = Iterator(this);
00201 m_EndIterator = Iterator(this);
00202 m_EndIterator.GoToEnd();
00203 }
00205
00207 virtual ~ShapedNeighborhoodIterator() {}
00208
00211 ShapedNeighborhoodIterator(const SizeType &radius,
00212 const ImageType * ptr,
00213 const RegionType ®ion
00214 ) : Superclass(radius, const_cast<ImageType*>(ptr),
00215 region)
00216 {
00217 m_BeginIterator = Iterator(this);
00218 m_EndIterator = Iterator(this);
00219 m_EndIterator.GoToEnd();
00220 }
00222
00223
00224
00225 Superclass::SetPixel;
00226 Superclass::SetCenterPixel;
00227
00229 Self &operator=(const Self& orig)
00230 {
00231 Superclass::operator=(orig);
00232
00233
00234 m_BeginIterator.GoToBegin();
00235 m_EndIterator.GoToEnd();
00236 return *this;
00237 }
00238
00240 virtual void PrintSelf(std::ostream &, Indent) const;
00241
00244 Iterator &Begin() { return m_BeginIterator; }
00245 Iterator &End() { return m_EndIterator; }
00247
00250 const ConstIterator &End() const
00251 { return this->m_ConstEndIterator; }
00252
00253 void ClearActiveList()
00254 {
00255 Superclass::ClearActiveList();
00256 m_EndIterator.GoToEnd();
00257 m_BeginIterator.GoToBegin();
00258 }
00259
00260 protected:
00261
00263 ShapedNeighborhoodIterator( const ShapedNeighborhoodIterator & o);
00264
00265
00266
00267 void ActivateIndex(const unsigned int n)
00268 {
00269 Superclass::ActivateIndex(n);
00270 m_EndIterator.GoToEnd();
00271 m_BeginIterator.GoToBegin();
00272 }
00273
00274 void DeactivateIndex(const unsigned int n)
00275 {
00276 Superclass::DeactivateIndex(n);
00277 m_EndIterator.GoToEnd();
00278 m_BeginIterator.GoToBegin();
00279 }
00280 Iterator m_EndIterator;
00281 Iterator m_BeginIterator;
00282 };
00283
00284 }
00285
00286
00287 #ifndef ITK_MANUAL_INSTANTIATION
00288 #include "itkShapedNeighborhoodIterator.txx"
00289 #endif
00290
00291 #endif
00292