VTK
vtkImageStencilIterator.h
Go to the documentation of this file.
1 /*=========================================================================
2 
3  Program: Visualization Toolkit
4  Module: vtkImageStencilIterator.h
5 
6  Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
7  All rights reserved.
8  See Copyright.txt or http://www.kitware.com/Copyright.htm for details.
9 
10  This software is distributed WITHOUT ANY WARRANTY; without even
11  the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
12  PURPOSE. See the above copyright notice for more information.
13 
14 =========================================================================*/
25 #ifndef __vtkImageStencilIterator_h
26 #define __vtkImageStencilIterator_h
27 
28 #include "vtkSystemIncludes.h"
29 class vtkImageData;
31 class vtkAlgorithm;
32 
33 template<class DType>
35 {
36 public:
40 
42 
46  vtkImageData *image, vtkImageStencilData *stencil, int extent[6],
47  vtkAlgorithm *algorithm=0, int threadId=0);
49 
51 
54  void Initialize(
55  vtkImageData *image, vtkImageStencilData *stencil, int extent[6]);
57 
59 
61  bool IsInStencil()
62  {
63  return this->InStencil;
64  }
66 
69  void NextSpan();
70 
72 
73  bool IsAtEnd()
74  {
75  return (this->Pointer == this->EndPointer);
76  }
78 
80 
81  DType *BeginSpan()
82  {
83  return this->Pointer;
84  }
86 
88 
89  DType *EndSpan()
90  {
91  return this->SpanEndPointer;
92  }
94 
95 protected:
96 
98  void SetSpanState(int idX);
99 
103  void ReportProgress();
104 
105  // Pointers
106  DType *Pointer; // current iterator position within data
107  DType *SpanEndPointer; // end of current span
108  DType *RowEndPointer; // end of current row
109  DType *SliceEndPointer; // end of current slice
110  DType *EndPointer; // end of data
111 
112  // Increments
113  vtkIdType PixelIncrement; // to next pixel
114  vtkIdType RowIncrement; // to same position in next row
115  vtkIdType SliceIncrement; // to same position in next slice
116  vtkIdType RowEndIncrement; // from end of row to start of next row
117  vtkIdType SliceEndIncrement; // from end of slice to start of next slice
118 
119  // Stencil-related items
121  bool InStencil;
124  int SpanMinX;
125  int SpanMaxX;
126  int SpanMinY;
127  int SpanMaxY;
128  int SpanMinZ;
129  int SpanMaxZ;
135 
136  // Progress-related items
140 };
141 
142 #ifdef VTK_NO_EXPLICIT_TEMPLATE_INSTANTIATION
143 #include "vtkImageStencilIterator.txx"
144 #endif
145 
146 #endif