/usr/include/vtk-6.3/vtkImageStencilData.h is in libvtk6-dev 6.3.0+dfsg1-5.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
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 | /*=========================================================================
Program: Visualization Toolkit
Module: vtkImageStencilData.h
Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
All rights reserved.
See Copyright.txt or http://www.kitware.com/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 notice for more information.
=========================================================================*/
// .NAME vtkImageStencilData - efficient description of an image stencil
// .SECTION Description
// vtkImageStencilData describes an image stencil in a manner which is
// efficient both in terms of speed and storage space. The stencil extents
// are stored for each x-row across the image (multiple extents per row if
// necessary) and can be retrieved via the GetNextExtent() method.
// .SECTION see also
// vtkImageStencilSource vtkImageStencil
#ifndef vtkImageStencilData_h
#define vtkImageStencilData_h
#include "vtkImagingCoreModule.h" // For export macro
#include "vtkDataObject.h"
class VTKIMAGINGCORE_EXPORT vtkImageStencilData : public vtkDataObject
{
public:
static vtkImageStencilData *New();
vtkTypeMacro(vtkImageStencilData, vtkDataObject);
void PrintSelf(ostream& os, vtkIndent indent);
void Initialize();
void DeepCopy(vtkDataObject *o);
void ShallowCopy(vtkDataObject *f);
void InternalImageStencilDataCopy(vtkImageStencilData *s);
// Description:
// Get the data type as an integer (this will return VTK_DATA_OBJECT
// for now, maybe a proper type constant will be reserved later).
int GetDataObjectType() { return VTK_DATA_OBJECT; }
// Description:
// The extent type is 3D, just like vtkImageData.
int GetExtentType() { return VTK_3D_EXTENT; };
// Description:
// Given the total output x extent [xMin,xMax] and the current y, z indices,
// return each sub-extent [r1,r2] that lies within within the unclipped
// region in sequence. A value of '0' is returned if no more sub-extents
// are available. The variable 'iter' must be initialized to zero before
// the first call, unless you want the complementary sub-extents in which
// case you must initialize 'iter' to -1. The variable 'iter' is used
// internally to keep track of which sub-extent should be returned next.
int GetNextExtent(int &r1, int &r2, int xMin, int xMax,
int yIdx, int zIdx, int &iter);
// Description:
// Checks if an image index is inside the stencil.
// Even though GetNextExtent and the vtkImageStencilIterator are faster
// if every voxel in the volume has to be checked, IsInside provides an
// efficient alternative for if just a single voxel has to be checked.
int IsInside(int xIdx, int yIdx, int zIdx);
// Description:
// This method is used by vtkImageStencilDataSource to add an x
// sub extent [r1,r2] for the x row (yIdx,zIdx). The specified sub
// extent must not intersect any other sub extents along the same x row.
// As well, r1 and r2 must both be within the total x extent
// [Extent[0],Extent[1]].
void InsertNextExtent(int r1, int r2, int yIdx, int zIdx);
// Description:
// Similar to InsertNextExtent, except that the extent (r1,r2) at yIdx,
// zIdx is merged with other extents, (if any) on that row. So a
// unique extent may not necessarily be added. For instance, if an extent
// [5,11] already exists adding an extent, [7,9] will not affect the
// stencil. Likewise adding [10, 13] will replace the existing extent
// with [5,13].
void InsertAndMergeExtent(int r1, int r2, int yIdx, int zIdx);
// Description:
// Remove the extent from (r1,r2) at yIdx, zIdx
void RemoveExtent(int r1, int r2, int yIdx, int zIdx);
// Description:
// Set the desired spacing for the stencil.
// This must be called before the stencil is Updated, ideally
// in the ExecuteInformation method of the imaging filter that
// is using the stencil.
vtkSetVector3Macro(Spacing, double);
vtkGetVector3Macro(Spacing, double);
// Description:
// Set the desired origin for the stencil.
// This must be called before the stencil is Updated, ideally
// in the ExecuteInformation method of the imaging filter that
// is using the stencil.
vtkSetVector3Macro(Origin, double);
vtkGetVector3Macro(Origin, double);
// Description:
// Set the extent of the data. This is should be called only
// by vtkImageStencilSource, as it is part of the basic pipeline
// functionality.
void SetExtent(int extent[6]);
void SetExtent(int x1, int x2, int y1, int y2, int z1, int z2);
vtkGetVector6Macro(Extent, int);
// Description:
// Allocate space for the sub-extents. This is called by
// vtkImageStencilSource.
void AllocateExtents();
// Description:
// Fill the sub-extents.
void Fill();
// Description:
// Override these to handle origin, spacing, scalar type, and scalar
// number of components. See vtkDataObject for details.
virtual void CopyInformationFromPipeline(vtkInformation* meta_data);
virtual void CopyInformationToPipeline(vtkInformation* meta_data);
//BTX
// Description:
// Retrieve an instance of this class from an information object.
static vtkImageStencilData* GetData(vtkInformation* info);
static vtkImageStencilData* GetData(vtkInformationVector* v, int i=0);
//ETX
// Description:
// Add merges the stencil supplied as argument into Self.
virtual void Add ( vtkImageStencilData * );
// Description:
// Subtract removes the portion of the stencil, supplied as argument,
// that lies within Self from Self.
virtual void Subtract( vtkImageStencilData * );
// Description:
// Replaces the portion of the stencil, supplied as argument,
// that lies within Self from Self.
virtual void Replace( vtkImageStencilData * );
// Description:
// Clip the stencil with the supplied extents. In other words, discard data
// outside the specified extents. Return 1 if something changed.
virtual int Clip( int extent[6] );
protected:
vtkImageStencilData();
~vtkImageStencilData();
// Description:
// Get important info from pipeline.
void CopyOriginAndSpacingFromPipeline(vtkInformation* meta_data);
// Description:
// Merges portions of the stencil that are within Self's extents into
// itself.
virtual void InternalAdd( vtkImageStencilData * );
void CollapseAdditionalIntersections(int r2, int idx, int *clist,
int &clistlen);
// Description:
// The Spacing and Origin of the data.
double Spacing[3];
double Origin[3];
int Extent[6];
// Description:
// The actual 'data' is stored here.
int NumberOfExtentEntries;
int *ExtentListLengths;
int **ExtentLists;
private:
vtkImageStencilData(const vtkImageStencilData&); // Not implemented.
void operator=(const vtkImageStencilData&); // Not implemented.
friend class vtkImageStencilIteratorFriendship;
};
//BTX
// Description:
// This is a helper class for stencil creation. It is a raster with
// infinite resolution in the X direction (approximately, since it uses
// double precision). Lines that represent polygon edges can be drawn
// into this raster, and then filled given a tolerance.
class VTKIMAGINGCORE_EXPORT vtkImageStencilRaster
{
public:
// Description:
// Create a raster with the specified whole y extent.
vtkImageStencilRaster(const int wholeExtent[2]);
// Description:
// Destructor.
~vtkImageStencilRaster();
// Description:
// Reset the raster to its original state, but keep the same whole
// extent. Pre-allocate the specified 1D allocateExtent, which must be
// within the whole extent.
void PrepareForNewData(const int allocateExtent[2] = 0);
// Description:
// Insert a line into the raster, given the two end points.
void InsertLine(const double p1[2], const double p2[2]);
VTK_LEGACY(void InsertLine(const double[2], const double[2], bool, bool));
// Description:
// Fill the specified extent of a vtkImageStencilData with the raster,
// after permuting the raster according to xj and yj.
void FillStencilData(vtkImageStencilData *data, const int extent[6],
int xj = 0, int yj = 1);
// Description:
// The tolerance for float-to-int conversions.
void SetTolerance(double tol) { this->Tolerance = tol; }
double GetTolerance() { return this->Tolerance; }
protected:
// Description:
// Ensure that the raster is initialized for the specified range
// of y values, which must be within the Extent.
void PrepareExtent(int ymin, int ymax);
// Description:
// Insert an x point into the raster. If the y value is larger than
// the y extent, the extent will grow automatically. The parameter i
// indicates which of the two internal rasters is to be used.
void InsertPoint(int y, double x, int i);
int Extent[2];
int UsedExtent[2];
double **Raster;
double Tolerance;
private:
vtkImageStencilRaster(const vtkImageStencilRaster&); // Not implemented.
void operator=(const vtkImageStencilRaster&); // Not implemented.
};
//ETX
#endif
|