ITK  6.0.0
Insight Toolkit
itkNeighborhoodIterator.h
Go to the documentation of this file.
1/*=========================================================================
2 *
3 * Copyright NumFOCUS
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 * https://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 itkNeighborhoodIterator_h
19#define itkNeighborhoodIterator_h
20
21#include <vector>
22#include <cstring>
23#include <iostream>
25
26namespace itk
27{
211template <typename TImage, typename TBoundaryCondition = ZeroFluxNeumannBoundaryCondition<TImage>>
212class ITK_TEMPLATE_EXPORT NeighborhoodIterator : public ConstNeighborhoodIterator<TImage, TBoundaryCondition>
213{
214public:
218
220 using typename Superclass::InternalPixelType;
221 using typename Superclass::PixelType;
222 using typename Superclass::SizeType;
223 using typename Superclass::ImageType;
224 using typename Superclass::RegionType;
225 using typename Superclass::IndexType;
226 using typename Superclass::OffsetType;
228 using typename Superclass::NeighborhoodType;
229 using typename Superclass::Iterator;
230 using typename Superclass::ConstIterator;
231 using typename Superclass::ImageBoundaryConditionPointerType;
232
235 : Superclass()
236 {}
237
240 : Superclass(n)
241 {}
242
244 Self &
245 operator=(const Self & orig)
246 {
247 Superclass::operator=(orig);
248 return *this;
249 }
254 NeighborhoodIterator(const SizeType & radius, ImageType * ptr, const RegionType & region)
255 : Superclass(radius, ptr, region)
256 {}
257
259 InternalPixelType *
261 {
262 return (this->operator[]((this->Size()) >> 1));
263 }
264
266 void
268 {
269 this->m_NeighborhoodAccessorFunctor.Set(this->operator[]((this->Size()) >> 1), p);
270 }
271
275 void
277
280 void
281 SetPixel(const unsigned int i, const PixelType & v, bool & status);
282
284 void
285 SetPixel(const unsigned int i, const PixelType & v);
286
287 // { *(this->operator[](i)) = v; }
288
290 void
291 SetPixel(const OffsetType o, const PixelType & v)
292 {
293 this->SetPixel(this->GetNeighborhoodIndex(o), v);
294 }
295 // { *(this->operator[](o)) = v; }
301 void
302 SetNext(const unsigned int axis, const unsigned int i, const PixelType & v)
303 {
304 this->SetPixel(this->GetCenterNeighborhoodIndex() + (i * this->GetStride(axis)), v);
305 }
306
310 void
311 SetNext(const unsigned int axis, const PixelType & v)
312 {
313 this->SetPixel(this->GetCenterNeighborhoodIndex() + this->GetStride(axis), v);
314 }
315
319 void
320 SetPrevious(const unsigned int axis, const unsigned int i, const PixelType & v)
321 {
322 this->SetPixel(this->GetCenterNeighborhoodIndex() - (i * this->GetStride(axis)), v);
323 }
324
328 void
329 SetPrevious(const unsigned int axis, const PixelType & v)
330 {
331 this->SetPixel(this->GetCenterNeighborhoodIndex() - this->GetStride(axis), v);
332 }
333};
334} // namespace itk
337#ifndef ITK_MANUAL_INSTANTIATION
338# include "itkNeighborhoodIterator.hxx"
339#endif
340
341#endif
Pixel-wise addition of two images.
Const version of NeighborhoodIterator, defining iteration of a local N-dimensional neighborhood of pi...
Defines iteration of a local N-dimensional neighborhood of pixels across an itk::Image.
void SetNext(const unsigned int axis, const unsigned int i, const PixelType &v)
void SetNeighborhood(const NeighborhoodType &)
void SetPixel(const unsigned int i, const PixelType &v)
NeighborhoodIterator(const NeighborhoodIterator &n)
void SetCenterPixel(const PixelType &p)
void SetNext(const unsigned int axis, const PixelType &v)
void SetPrevious(const unsigned int axis, const PixelType &v)
void SetPrevious(const unsigned int axis, const unsigned int i, const PixelType &v)
InternalPixelType * GetCenterPointer()
void SetPixel(const unsigned int i, const PixelType &v, bool &status)
NeighborhoodIterator(const SizeType &radius, ImageType *ptr, const RegionType &region)
Self & operator=(const Self &orig)
void SetPixel(const OffsetType o, const PixelType &v)
A light-weight container object for storing an N-dimensional neighborhood of values.
typename AllocatorType::iterator Iterator
typename AllocatorType::const_iterator ConstIterator
The "itk" namespace contains all Insight Segmentation and Registration Toolkit (ITK) classes....