forked from InsightSoftwareConsortium/ITK
-
Notifications
You must be signed in to change notification settings - Fork 0
/
itkConstNeighborhoodIterator.txx
704 lines (610 loc) · 19.9 KB
/
itkConstNeighborhoodIterator.txx
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
/*=========================================================================
Program: Insight Segmentation & Registration Toolkit
Module: itkConstNeighborhoodIterator.txx
Language: C++
Date: $Date$
Version: $Revision$
Copyright (c) Insight Software Consortium. All rights reserved.
See ITKCopyright.txt or http://www.itk.org/HTML/Copyright.htm for details.
This software is distributed WITHOUT ANY WARRANTY; without even
the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
PURPOSE. See the above copyright notices for more information.
=========================================================================*/
#ifndef __itkConstNeighborhoodIterator_txx
#define __itkConstNeighborhoodIterator_txx
#include "itkConstNeighborhoodIterator.h"
namespace itk {
template<class TImage, class TBoundaryCondition>
bool
ConstNeighborhoodIterator<TImage, TBoundaryCondition>
::InBounds() const
{
if (m_IsInBoundsValid)
{
return m_IsInBounds;
}
bool ans = true;
for (unsigned int i=0; i<Dimension; i++)
{
if (m_Loop[i] < m_InnerBoundsLow[i] || m_Loop[i] >= m_InnerBoundsHigh[i])
{
m_InBounds[i] = ans = false;
}
else
{
m_InBounds[i] = true;
}
}
m_IsInBounds = ans;
m_IsInBoundsValid = true;
return ans;
}
template<class TImage, class TBoundaryCondition>
typename ConstNeighborhoodIterator<TImage, TBoundaryCondition>::PixelType
ConstNeighborhoodIterator<TImage, TBoundaryCondition>
::GetPixel(const unsigned n, bool& IsInBounds) const
{
// If the region the iterator is walking (padded by the neighborhood size)
// never bumps up against the bounds of the buffered region, then don't
// bother checking any boundary conditions
if (!m_NeedToUseBoundaryCondition)
{
IsInBounds = true;
return (m_NeighborhoodAccessorFunctor.Get(this->operator[](n)));
}
register unsigned int i;
OffsetValueType OverlapLow, OverlapHigh;
OffsetType temp, offset;
bool flag;
// Is this whole neighborhood in bounds?
if (this->InBounds())
{
IsInBounds = true;
return (m_NeighborhoodAccessorFunctor.Get(this->operator[](n)));
}
else
{
temp = this->ComputeInternalIndex(n);
flag = true;
// Is this pixel in bounds?
for (i=0; i<Dimension; ++i)
{
if (m_InBounds[i])
{
offset[i] = 0; // this dimension in bounds
}
else // part of this dimension spills out of bounds
{
// Calculate overlap for this dimension
OverlapLow = m_InnerBoundsLow[i] - m_Loop[i];
OverlapHigh =
static_cast<OffsetValueType>(this->GetSize(i) -
( (m_Loop[i]+2) - m_InnerBoundsHigh[i] ));
//
if (temp[i] < OverlapLow)
{
flag = false;
offset[i] = OverlapLow - temp[i];
}
else if ( OverlapHigh < temp[i] )
{
flag = false;
offset[i] = OverlapHigh - temp[i];
}
else offset[i] = 0;
}
}
if (flag)
{
IsInBounds = true;
return ( m_NeighborhoodAccessorFunctor.Get(this->operator[](n)) );
}
else
{
IsInBounds = false;
return( m_NeighborhoodAccessorFunctor.BoundaryCondition(
temp, offset, this, this->m_BoundaryCondition) );
}
}
}
template<class TImage, class TBoundaryCondition>
typename ConstNeighborhoodIterator<TImage, TBoundaryCondition>::OffsetType
ConstNeighborhoodIterator<TImage, TBoundaryCondition>
::ComputeInternalIndex(unsigned int n) const
{
OffsetType ans;
long D = (long)Dimension;
unsigned long r;
r = (unsigned long)n;
for (long i = D-1; i >= 0; --i)
{
ans[i] = static_cast<OffsetValueType>(r / this->GetStride(i));
r = r % this->GetStride(i);
}
return ans;
}
template <class TImage, class TBoundaryCondition>
typename ConstNeighborhoodIterator<TImage, TBoundaryCondition>::RegionType
ConstNeighborhoodIterator<TImage, TBoundaryCondition>
::GetBoundingBoxAsImageRegion() const
{
RegionType ans;
typename IndexType::IndexValueType zero = 0;
ans.SetIndex(this->GetIndex(zero));
ans.SetSize(this->GetSize());
return ans;
}
template<class TImage, class TBoundaryCondition>
ConstNeighborhoodIterator<TImage, TBoundaryCondition>
::ConstNeighborhoodIterator()
{
IndexType zeroIndex; zeroIndex.Fill(0);
SizeType zeroSize; zeroSize.Fill(0);
m_Bound.Fill(0);
m_Begin = 0;
m_BeginIndex.Fill(0);
// m_ConstImage
m_End = 0;
m_EndIndex.Fill(0);
m_Loop.Fill(0);
m_Region.SetIndex(zeroIndex);
m_Region.SetSize(zeroSize);
m_WrapOffset.Fill(0);
for (unsigned int i=0; i < Dimension; i++)
{ m_InBounds[i] = false; }
this->ResetBoundaryCondition();
m_IsInBounds = false;
m_IsInBoundsValid = false;
}
template<class TImage, class TBoundaryCondition>
ConstNeighborhoodIterator<TImage, TBoundaryCondition>
::ConstNeighborhoodIterator(const Self& orig)
: Neighborhood<InternalPixelType *, Dimension>(orig)
{
m_Bound = orig.m_Bound;
m_Begin = orig.m_Begin;
m_BeginIndex = orig.m_BeginIndex;
m_ConstImage = orig.m_ConstImage;
m_End = orig.m_End;
m_EndIndex = orig.m_EndIndex;
m_Loop = orig.m_Loop;
m_Region = orig.m_Region;
m_WrapOffset = orig.m_WrapOffset;
m_InternalBoundaryCondition = orig.m_InternalBoundaryCondition;
m_NeedToUseBoundaryCondition = orig.m_NeedToUseBoundaryCondition;
for (unsigned int i = 0; i < Dimension; ++i)
{
m_InBounds[i] = orig.m_InBounds[i];
}
m_IsInBoundsValid = orig.m_IsInBoundsValid;
m_IsInBounds = orig.m_IsInBounds;
m_InnerBoundsLow = orig.m_InnerBoundsLow;
m_InnerBoundsHigh = orig.m_InnerBoundsHigh;
// Check to see if the default boundary
// conditions have been overridden.
if ( orig.m_BoundaryCondition ==
static_cast<ImageBoundaryConditionConstPointerType>(
&orig.m_InternalBoundaryCondition ))
{
this->ResetBoundaryCondition();
}
else
{ m_BoundaryCondition = orig.m_BoundaryCondition; }
m_NeighborhoodAccessorFunctor = orig.m_NeighborhoodAccessorFunctor;
}
template<class TImage, class TBoundaryCondition>
void
ConstNeighborhoodIterator<TImage, TBoundaryCondition>
::SetEndIndex()
{
if (m_Region.GetNumberOfPixels() > 0)
{
m_EndIndex = m_Region.GetIndex();
m_EndIndex[Dimension-1] = m_Region.GetIndex()[Dimension-1] +
static_cast<long>(m_Region.GetSize()[Dimension-1]);
}
else
{
// Region has no pixels, so set the end index to be the begin index
m_EndIndex = m_Region.GetIndex();
}
}
template<class TImage, class TBoundaryCondition>
typename ConstNeighborhoodIterator<TImage, TBoundaryCondition>::NeighborhoodType
ConstNeighborhoodIterator<TImage, TBoundaryCondition>
::GetNeighborhood() const
{
register unsigned int i;
OffsetType OverlapLow, OverlapHigh, temp, offset;
bool flag;
const ConstIterator _end = this->End();
NeighborhoodType ans;
typename NeighborhoodType::Iterator ans_it;
ConstIterator this_it;
ans.SetRadius( this->GetRadius() );
if (m_NeedToUseBoundaryCondition == false)
{
for (ans_it = ans.Begin(), this_it = this->Begin();
this_it < _end; ans_it++, this_it++)
{ *ans_it = m_NeighborhoodAccessorFunctor.Get(*this_it); }
}
else if (InBounds())
{
for (ans_it = ans.Begin(), this_it = this->Begin();
this_it < _end; ans_it++, this_it++)
{ *ans_it = m_NeighborhoodAccessorFunctor.Get(*this_it); }
}
else
{
// Calculate overlap & initialize index
for (i=0; i<Dimension; i++)
{
OverlapLow[i] = m_InnerBoundsLow[i] - m_Loop[i];
OverlapHigh[i]=
static_cast<OffsetValueType>(this->GetSize(i)) - ( (m_Loop[i]+2)
- m_InnerBoundsHigh[i] );
temp[i] = 0;
}
// Iterate through neighborhood
for (ans_it = ans.Begin(), this_it = this->Begin();
this_it < _end; ans_it++, this_it++)
{
flag = true;
// Is this pixel in bounds?
for (i=0; i<Dimension; ++i)
{
if (m_InBounds[i]) offset[i] = 0; // this dimension in bounds
else // part of this dimension spills out of bounds
{
if (temp[i] < OverlapLow[i])
{
flag = false;
offset[i] = OverlapLow[i] - temp[i];
}
else if ( OverlapHigh[i] < temp[i] )
{
flag = false;
offset[i] = OverlapHigh[i] - temp[i];
}
else offset[i] = 0;
}
}
if (flag) *ans_it = m_NeighborhoodAccessorFunctor.Get(*this_it);
else *ans_it = m_NeighborhoodAccessorFunctor.BoundaryCondition(
temp, offset, this, this->m_BoundaryCondition);
m_BoundaryCondition->operator()(temp, offset, this);
for (i=0; i<Dimension; ++i) // Update index
{
temp[i]++;
if ( temp[i] == static_cast<OffsetValueType>(this->GetSize(i)) )
temp[i]= 0;
else break;
}
}
}
return ans;
}
template<class TImage, class TBoundaryCondition>
void
ConstNeighborhoodIterator<TImage, TBoundaryCondition>
::GoToBegin()
{
this->SetLocation( m_BeginIndex );
}
template<class TImage, class TBoundaryCondition>
void
ConstNeighborhoodIterator<TImage, TBoundaryCondition>
::GoToEnd()
{
this->SetLocation( m_EndIndex );
}
template<class TImage, class TBoundaryCondition>
void ConstNeighborhoodIterator<TImage, TBoundaryCondition>
::Initialize(const SizeType &radius, const ImageType *ptr,
const RegionType ®ion)
{
m_ConstImage = ptr;
m_Region = region;
const IndexType regionIndex = region.GetIndex();
this->SetRadius(radius);
this->SetBeginIndex(region.GetIndex());
this->SetLocation(region.GetIndex());
this->SetBound(region.GetSize());
this->SetEndIndex();
m_Begin = ptr->GetBufferPointer() + ptr->ComputeOffset(regionIndex);
m_End = ptr->GetBufferPointer() + ptr->ComputeOffset( m_EndIndex );
// now determine whether boundary conditions are going to be needed
const IndexType bStart = ptr->GetBufferedRegion().GetIndex();
const SizeType bSize = ptr->GetBufferedRegion().GetSize();
const IndexType rStart = region.GetIndex();
const SizeType rSize = region.GetSize();
long overlapLow, overlapHigh;
m_NeedToUseBoundaryCondition = false;
for (unsigned long i = 0; i < Dimension; ++i)
{
overlapLow = static_cast<long>((rStart[i] - radius[i]) - bStart[i]);
overlapHigh= static_cast<long>((bStart[i] + bSize[i]) -
(rStart[i] + rSize[i] + radius[i]));
if (overlapLow < 0) // out of bounds condition, define a region of
{
m_NeedToUseBoundaryCondition = true;
break;
}
if (overlapHigh < 0)
{
m_NeedToUseBoundaryCondition = true;
break;
}
}
m_IsInBoundsValid = false;
m_IsInBounds = false;
}
template<class TImage, class TBoundaryCondition>
ConstNeighborhoodIterator<TImage, TBoundaryCondition> &
ConstNeighborhoodIterator<TImage, TBoundaryCondition>
::operator=(const Self& orig)
{
Superclass::operator=(orig);
m_Bound = orig.m_Bound;
m_Begin = orig.m_Begin;
m_ConstImage = orig.m_ConstImage;
m_End = orig.m_End;
m_EndIndex = orig.m_EndIndex;
m_Loop = orig.m_Loop;
m_Region = orig.m_Region;
m_BeginIndex = orig.m_BeginIndex;
m_WrapOffset = orig.m_WrapOffset;
m_InternalBoundaryCondition = orig.m_InternalBoundaryCondition;
m_NeedToUseBoundaryCondition = orig.m_NeedToUseBoundaryCondition;
m_InnerBoundsLow = orig.m_InnerBoundsLow;
m_InnerBoundsHigh = orig.m_InnerBoundsHigh;
for (unsigned int i = 0; i < Dimension; ++i)
{
m_InBounds[i] = orig.m_InBounds[i];
}
m_IsInBoundsValid = orig.m_IsInBoundsValid;
m_IsInBounds = orig.m_IsInBounds;
// Check to see if the default boundary conditions
// have been overridden.
if (orig.m_BoundaryCondition ==
static_cast<ImageBoundaryConditionConstPointerType>(
&orig.m_InternalBoundaryCondition ) )
{
this->ResetBoundaryCondition();
}
else m_BoundaryCondition = orig.m_BoundaryCondition;
m_NeighborhoodAccessorFunctor = orig.m_NeighborhoodAccessorFunctor;
return *this;
}
template<class TImage, class TBoundaryCondition>
ConstNeighborhoodIterator<TImage, TBoundaryCondition> &
ConstNeighborhoodIterator<TImage, TBoundaryCondition>
::operator++()
{
unsigned int i;
Iterator it;
const Iterator _end = Superclass::End();
// Repositioning neighborhood, previous bounds check on neighborhood
// location is invalid.
m_IsInBoundsValid = false;
// Increment pointers.
for (it = Superclass::Begin(); it < _end; ++it)
{
(*it)++;
}
// Check loop bounds, wrap & add pointer offsets if needed.
for (i=0; i<Dimension; ++i)
{
m_Loop[i]++;
if ( m_Loop[i] == m_Bound[i] )
{
m_Loop[i] = m_BeginIndex[i];
for (it = Superclass::Begin(); it < _end; ++it)
{
(*it) += m_WrapOffset[i];
}
}
else break;
}
return *this;
}
template<class TImage, class TBoundaryCondition>
ConstNeighborhoodIterator<TImage, TBoundaryCondition> &
ConstNeighborhoodIterator<TImage, TBoundaryCondition>
::operator--()
{
unsigned int i;
Iterator it;
const Iterator _end = Superclass::End();
// Repositioning neighborhood, previous bounds check on neighborhood
// location is invalid.
m_IsInBoundsValid = false;
// Decrement pointers.
for (it = Superclass::Begin(); it < _end; ++it)
{
(*it)--;
}
// Check loop bounds, wrap & add pointer offsets if needed.
for (i=0; i<Dimension; ++i)
{
if (m_Loop[i] == m_BeginIndex[i])
{
m_Loop[i]= m_Bound[i] - 1;
for (it = Superclass::Begin(); it < _end; ++it)
{
(*it) -= m_WrapOffset[i];
}
}
else
{
m_Loop[i]--;
break;
}
}
return *this;
}
template<class TImage, class TBoundaryCondition>
void
ConstNeighborhoodIterator<TImage, TBoundaryCondition>
::PrintSelf(std::ostream &os, Indent indent) const
{
unsigned int i;
os << indent;
os << "ConstNeighborhoodIterator {this= " << this;
os << ", m_Region = { Start = {";
for (i=0; i < Dimension; ++i) os << m_Region.GetIndex()[i] << " ";
os << "}, Size = { ";
for (i=0; i < Dimension; ++i) os << m_Region.GetSize()[i] << " ";
os << "} }";
os << ", m_BeginIndex = { ";
for (i=0; i < Dimension; ++i) os << m_BeginIndex[i] << " ";
os << "} , m_EndIndex = { ";
for (i=0; i < Dimension; ++i) os << m_EndIndex[i] << " ";
os << "} , m_Loop = { ";
for (i=0; i < Dimension; ++i) os << m_Loop[i] << " ";
os << "}, m_Bound = { ";
for (i=0; i < Dimension; ++i) os << m_Bound[i] << " ";
os << "}, m_IsInBounds = {" << m_IsInBounds;
os << "}, m_IsInBoundsValid = {" << m_IsInBoundsValid;
os << "}, m_WrapOffset = { ";
for (i=0; i < Dimension; ++i) os << m_WrapOffset[i] << " ";
os << ", m_Begin = " << m_Begin;
os << ", m_End = " << m_End;
os << "}" << std::endl;
os << indent << ", m_InnerBoundsLow = { ";
for (i = 0; i<Dimension; i++) os << m_InnerBoundsLow[i] << " ";
os << "}, m_InnerBoundsHigh = { ";
for (i = 0; i<Dimension; i++) os << m_InnerBoundsHigh[i] << " ";
os << "} }" << std::endl;
Superclass::PrintSelf(os, indent.GetNextIndent());
}
template<class TImage, class TBoundaryCondition>
void ConstNeighborhoodIterator<TImage, TBoundaryCondition>
::SetBound(const SizeType& size)
{
SizeType radius = this->GetRadius();
const OffsetValueType *offset = m_ConstImage->GetOffsetTable();
const IndexType imageBRStart = m_ConstImage->GetBufferedRegion().GetIndex();
SizeType imageBRSize = m_ConstImage->GetBufferedRegion().GetSize();
// Set the bounds and the wrapping offsets. Inner bounds are the loop
// indicies where the iterator will begin to overlap the edge of the image
// buffered region.
for (unsigned int i=0; i<Dimension; ++i)
{
m_Bound[i] = m_BeginIndex[i] + static_cast<IndexValueType>(size[i]);
m_InnerBoundsHigh[i]= static_cast<IndexValueType>(imageBRStart[i]
+ ( imageBRSize[i]) - static_cast<SizeValueType>(radius[i]) );
m_InnerBoundsLow[i] = static_cast<IndexValueType>(imageBRStart[i]
+ radius[i]);
m_WrapOffset[i] = (static_cast<OffsetValueType>(imageBRSize[i])
- ( m_Bound[i] - m_BeginIndex[i] )) * offset[i];
}
m_WrapOffset[Dimension-1] = 0; // last offset is zero because there are no
// higher dimensions
}
template<class TImage, class TBoundaryCondition>
void ConstNeighborhoodIterator<TImage, TBoundaryCondition>
::SetPixelPointers(const IndexType &pos)
{
const Iterator _end = Superclass::End();
InternalPixelType * Iit;
ImageType *ptr = const_cast<ImageType *>(m_ConstImage.GetPointer());
const SizeType size = this->GetSize();
const OffsetValueType *OffsetTable = m_ConstImage->GetOffsetTable();
const SizeType radius = this->GetRadius();
unsigned int i;
Iterator Nit;
SizeType loop;
for (i=0; i<Dimension; ++i) loop[i]=0;
// Find first "upper-left-corner" pixel address of neighborhood
Iit = ptr->GetBufferPointer() + ptr->ComputeOffset(pos);
for (i = 0; i<Dimension; ++i)
{
Iit -= radius[i] * OffsetTable[i];
}
// Compute the rest of the pixel addresses
for (Nit = Superclass::Begin(); Nit != _end; ++Nit)
{
*Nit = Iit;
++Iit;
for (i = 0; i <Dimension; ++i)
{
loop[i]++;
if ( loop[i] == size[i] )
{
if (i==Dimension-1) break;
Iit += OffsetTable[i+1] - OffsetTable[i] * static_cast<long>(size[i]);
loop[i]= 0;
}
else break;
}
}
}
template<class TImage, class TBoundaryCondition>
ConstNeighborhoodIterator<TImage, TBoundaryCondition> &
ConstNeighborhoodIterator<TImage, TBoundaryCondition>
::operator+=(const OffsetType & idx)
{
unsigned int i;
Iterator it;
const Iterator _end = this->End();
OffsetValueType accumulator = 0;
const OffsetValueType* stride = this->GetImagePointer()->GetOffsetTable();
// Repositioning neighborhood, previous bounds check on neighborhood
// location is invalid.
m_IsInBoundsValid = false;
// Offset from the increment in the lowest dimension
accumulator += idx[0];
// Offsets from the stride lengths in each dimension.
//
// Because the image offset table is based on its buffer size and not its
// requested region size, we don't have to worry about adding in the wrapping
// offsets.
for (i = 1; i< Dimension; ++i)
{
accumulator += idx[i] * stride[i];
}
// Increment pointers.
for (it = this->Begin(); it < _end; ++it)
{
(*it) += accumulator;
}
// Update loop counter values
m_Loop += idx;
return *this;
}
template<class TImage, class TBoundaryCondition>
ConstNeighborhoodIterator<TImage, TBoundaryCondition> &
ConstNeighborhoodIterator<TImage, TBoundaryCondition>
::operator-=(const OffsetType & idx)
{
unsigned int i;
Iterator it;
const Iterator _end = this->End();
OffsetValueType accumulator = 0;
const OffsetValueType* stride = this->GetImagePointer()->GetOffsetTable();
// Repositioning neighborhood, previous bounds check on neighborhood
// location is invalid.
m_IsInBoundsValid = false;
// Offset from the increment in the lowest dimension
accumulator += idx[0];
// Offsets from the stride lengths in each dimension.
//
// Because the image offset table is based on its buffer size and not its
// requested region size, we don't have to worry about adding in the wrapping
// offsets.
for (i = 1; i< Dimension; ++i)
{
accumulator += idx[i] * stride[i];
}
// Increment pointers.
for (it = this->Begin(); it < _end; ++it)
{
(*it) -= accumulator;
}
// Update loop counter values
m_Loop -= idx;
return *this;
}
} // namespace itk
#endif