VTK
|
00001 /*========================================================================= 00002 00003 Program: Visualization Toolkit 00004 Module: vtkImageStencilIterator.h 00005 00006 Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen 00007 All rights reserved. 00008 See Copyright.txt or http://www.kitware.com/Copyright.htm for details. 00009 00010 This software is distributed WITHOUT ANY WARRANTY; without even 00011 the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR 00012 PURPOSE. See the above copyright notice for more information. 00013 00014 =========================================================================*/ 00025 #ifndef __vtkImageStencilIterator_h 00026 #define __vtkImageStencilIterator_h 00027 00028 #include "vtkSystemIncludes.h" 00029 #include "vtkImagingCoreModule.h" 00030 class vtkImageData; 00031 class vtkImageStencilData; 00032 class vtkAlgorithm; 00033 00034 template<class DType> 00035 class VTKIMAGINGCORE_EXPORT vtkImageStencilIterator 00036 { 00037 public: 00040 vtkImageStencilIterator(); 00041 00043 00046 vtkImageStencilIterator( 00047 vtkImageData *image, vtkImageStencilData *stencil, int extent[6], 00048 vtkAlgorithm *algorithm=0, int threadId=0); 00050 00052 00055 void Initialize( 00056 vtkImageData *image, vtkImageStencilData *stencil, int extent[6]); 00058 00060 00062 bool IsInStencil() 00063 { 00064 return this->InStencil; 00065 } 00067 00070 void NextSpan(); 00071 00073 00074 bool IsAtEnd() 00075 { 00076 return (this->Pointer == this->EndPointer); 00077 } 00079 00081 00082 DType *BeginSpan() 00083 { 00084 return this->Pointer; 00085 } 00087 00089 00090 DType *EndSpan() 00091 { 00092 return this->SpanEndPointer; 00093 } 00095 00096 protected: 00097 00099 void SetSpanState(int idX); 00100 00104 void ReportProgress(); 00105 00106 // Pointers 00107 DType *Pointer; // current iterator position within data 00108 DType *SpanEndPointer; // end of current span 00109 DType *RowEndPointer; // end of current row 00110 DType *SliceEndPointer; // end of current slice 00111 DType *EndPointer; // end of data 00112 00113 // Increments 00114 vtkIdType PixelIncrement; // to next pixel 00115 vtkIdType RowIncrement; // to same position in next row 00116 vtkIdType SliceIncrement; // to same position in next slice 00117 vtkIdType RowEndIncrement; // from end of row to start of next row 00118 vtkIdType SliceEndIncrement; // from end of slice to start of next slice 00119 00120 // Stencil-related items 00121 bool HasStencil; 00122 bool InStencil; 00123 int SpanSliceEndIncrement; 00124 int SpanSliceIncrement; 00125 int SpanMinX; 00126 int SpanMaxX; 00127 int SpanMinY; 00128 int SpanMaxY; 00129 int SpanMinZ; 00130 int SpanMaxZ; 00131 int SpanIndexX; 00132 int SpanIndexY; 00133 int SpanIndexZ; 00134 int *SpanCountPointer; 00135 int **SpanListPointer; 00136 00137 // Progress-related items 00138 vtkAlgorithm *Algorithm; 00139 vtkIdType Count; 00140 vtkIdType Target; 00141 }; 00142 00143 #ifdef VTK_NO_EXPLICIT_TEMPLATE_INSTANTIATION 00144 #include "vtkImageStencilIterator.txx" 00145 #endif 00146 00147 #endif 00148 // VTK-HeaderTest-Exclude: vtkImageStencilIterator.h