VTK
vtkBandedPolyDataContourFilter.h
Go to the documentation of this file.
1 /*=========================================================================
2 
3  Program: Visualization Toolkit
4  Module: vtkBandedPolyDataContourFilter.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 =========================================================================*/
47 #ifndef vtkBandedPolyDataContourFilter_h
48 #define vtkBandedPolyDataContourFilter_h
49 
50 #include "vtkFiltersModelingModule.h" // For export macro
51 #include "vtkPolyDataAlgorithm.h"
52 
53 #include "vtkContourValues.h" // Needed for inline methods
54 
55 class vtkPoints;
56 class vtkCellArray;
57 class vtkPointData;
58 class vtkDataArray;
59 class vtkFloatArray;
60 class vtkDoubleArray;
61 
62 #define VTK_SCALAR_MODE_INDEX 0
63 #define VTK_SCALAR_MODE_VALUE 1
64 
65 class VTKFILTERSMODELING_EXPORT vtkBandedPolyDataContourFilter : public vtkPolyDataAlgorithm
66 {
67 public:
69  void PrintSelf(ostream& os, vtkIndent indent) override;
70 
75 
77 
83  void SetValue(int i, double value);
84  double GetValue(int i);
85  double *GetValues();
86  void GetValues(double *contourValues);
87  void SetNumberOfContours(int number);
88  int GetNumberOfContours();
89  void GenerateValues(int numContours, double range[2]);
90  void GenerateValues(int numContours, double rangeStart, double rangeEnd);
92 
94 
100  vtkSetMacro(Clipping,vtkTypeBool);
101  vtkGetMacro(Clipping,vtkTypeBool);
102  vtkBooleanMacro(Clipping,vtkTypeBool);
104 
106 
112  vtkSetClampMacro(ScalarMode,int,VTK_SCALAR_MODE_INDEX,VTK_SCALAR_MODE_VALUE);
113  vtkGetMacro(ScalarMode,int);
115  {this->SetScalarMode(VTK_SCALAR_MODE_INDEX);}
117  {this->SetScalarMode(VTK_SCALAR_MODE_VALUE);}
119 
121 
127  vtkSetMacro(GenerateContourEdges,vtkTypeBool);
128  vtkGetMacro(GenerateContourEdges,vtkTypeBool);
129  vtkBooleanMacro(GenerateContourEdges,vtkTypeBool);
131 
133 
139  vtkSetMacro(ClipTolerance,double);
140  vtkGetMacro(ClipTolerance,double);
142 
144 
148  vtkSetMacro(Component,int);
149  vtkGetMacro(Component,int);
151 
156  vtkPolyData *GetContourEdgesOutput();
157 
162  vtkMTimeType GetMTime() override;
163 
164 protected:
166  ~vtkBandedPolyDataContourFilter() override;
167 
169 
170  int ComputeScalarIndex(double);
171  int IsContourValue(double val);
172  int ClipEdge(int v1, int v2, vtkPoints *pts, vtkDataArray *inScalars,
173  vtkDoubleArray *outScalars,
174  vtkPointData *inPD, vtkPointData *outPD, vtkIdType edgePts[]);
175  int InsertCell(vtkCellArray *cells, int npts, vtkIdType *pts,
176  int cellId, double s, vtkFloatArray *newS);
177  int InsertLine(vtkCellArray *cells, vtkIdType pt1, vtkIdType pt2,
178  int cellId, double s, vtkFloatArray *newS);
179  int ComputeClippedIndex(double s);
180  int InsertNextScalar(vtkFloatArray* scalars, int cellId, int idx);
181  // data members
183 
187 
188  // sorted and cleaned contour values
189  double *ClipValues;
191  int ClipIndex[2]; //indices outside of this range (inclusive) are clipped
192  double ClipTolerance; //specify numerical accuracy during clipping
193  double InternalClipTolerance; //used to clean up numerical problems
194 
195  //the second output
197 
198 private:
200  void operator=(const vtkBandedPolyDataContourFilter&) = delete;
201 };
202 
208  {this->ContourValues->SetValue(i,value);}
209 
214  {return this->ContourValues->GetValue(i);}
215 
221  {return this->ContourValues->GetValues();}
222 
228 inline void vtkBandedPolyDataContourFilter::GetValues(double *contourValues)
229  {this->ContourValues->GetValues(contourValues);}
230 
237  {this->ContourValues->SetNumberOfContours(number);}
238 
243  {return this->ContourValues->GetNumberOfContours();}
244 
250  double range[2])
251  {this->ContourValues->GenerateValues(numContours, range);}
252 
258  double rangeStart,
259  double rangeEnd)
260  {this->ContourValues->GenerateValues(numContours, rangeStart, rangeEnd);}
261 
262 
263 #endif
vtkPoints
represent and manipulate 3D points
Definition: vtkPoints.h:39
vtkBandedPolyDataContourFilter::GetValues
double * GetValues()
Get a pointer to an array of contour values.
Definition: vtkBandedPolyDataContourFilter.h:220
vtkContourValues::GetValues
double * GetValues()
Return a pointer to a list of contour values.
vtkContourValues::GetNumberOfContours
int GetNumberOfContours()
Return the number of contours in the.
vtkBandedPolyDataContourFilter::GenerateValues
void GenerateValues(int numContours, double range[2])
Generate numContours equally spaced contour values between specified range.
Definition: vtkBandedPolyDataContourFilter.h:249
vtkPointData
represent and manipulate point attribute data
Definition: vtkPointData.h:37
vtkX3D::value
Definition: vtkX3D.h:220
vtkIdType
int vtkIdType
Definition: vtkType.h:347
vtkBandedPolyDataContourFilter::SetScalarModeToIndex
void SetScalarModeToIndex()
Definition: vtkBandedPolyDataContourFilter.h:114
VTK_SCALAR_MODE_INDEX
#define VTK_SCALAR_MODE_INDEX
Definition: vtkBandedPolyDataContourFilter.h:62
vtkFloatArray
dynamic, self-adjusting array of float
Definition: vtkFloatArray.h:41
vtkInformationVector
Store zero or more vtkInformation instances.
Definition: vtkInformationVector.h:41
vtkX3D::range
Definition: vtkX3D.h:238
vtkBandedPolyDataContourFilter::NumberOfClipValues
int NumberOfClipValues
Definition: vtkBandedPolyDataContourFilter.h:190
vtkDataArray
abstract superclass for arrays of numeric data
Definition: vtkDataArray.h:54
vtkBandedPolyDataContourFilter::ScalarMode
int ScalarMode
Definition: vtkBandedPolyDataContourFilter.h:185
vtkPolyDataAlgorithm::PrintSelf
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
vtkBandedPolyDataContourFilter::GenerateContourEdges
vtkTypeBool GenerateContourEdges
Definition: vtkBandedPolyDataContourFilter.h:196
vtkBandedPolyDataContourFilter::GetNumberOfContours
int GetNumberOfContours()
Get the number of contours in the list of contour values.
Definition: vtkBandedPolyDataContourFilter.h:242
vtkBandedPolyDataContourFilter::ClipValues
double * ClipValues
Definition: vtkBandedPolyDataContourFilter.h:189
vtkPolyDataAlgorithm.h
vtkBandedPolyDataContourFilter::SetScalarModeToValue
void SetScalarModeToValue()
Definition: vtkBandedPolyDataContourFilter.h:116
vtkPolyDataAlgorithm::RequestData
virtual int RequestData(vtkInformation *request, vtkInformationVector **inputVector, vtkInformationVector *outputVector)
This is called by the superclass.
vtkObject::GetMTime
virtual vtkMTimeType GetMTime()
Return this object's modified time.
vtkBandedPolyDataContourFilter::GetValue
double GetValue(int i)
Get the ith contour value.
Definition: vtkBandedPolyDataContourFilter.h:213
vtkContourValues
helper object to manage setting and generating contour values
Definition: vtkContourValues.h:35
vtkIndent
a simple class to control print indentation
Definition: vtkIndent.h:39
vtkCellArray
object to represent cell connectivity
Definition: vtkCellArray.h:50
vtkBandedPolyDataContourFilter::SetNumberOfContours
void SetNumberOfContours(int number)
Set the number of contours to place into the list.
Definition: vtkBandedPolyDataContourFilter.h:236
vtkContourValues::GenerateValues
void GenerateValues(int numContours, double range[2])
Generate numContours equally spaced contour values between specified range.
vtkContourValues::GetValue
double GetValue(int i)
Get the ith contour value.
vtkContourValues::SetValue
void SetValue(int i, double value)
Set the ith contour value.
vtkBandedPolyDataContourFilter::ClipTolerance
double ClipTolerance
Definition: vtkBandedPolyDataContourFilter.h:192
vtkContourValues.h
vtkBandedPolyDataContourFilter::ContourValues
vtkContourValues * ContourValues
Definition: vtkBandedPolyDataContourFilter.h:182
vtkInformation
Store vtkAlgorithm input/output information.
Definition: vtkInformation.h:86
vtkBandedPolyDataContourFilter::InternalClipTolerance
double InternalClipTolerance
Definition: vtkBandedPolyDataContourFilter.h:193
vtkPolyData
concrete dataset represents vertices, lines, polygons, and triangle strips
Definition: vtkPolyData.h:85
vtkBandedPolyDataContourFilter::SetValue
void SetValue(int i, double value)
Methods to set / get contour values.
Definition: vtkBandedPolyDataContourFilter.h:207
vtkDoubleArray
dynamic, self-adjusting array of double
Definition: vtkDoubleArray.h:41
vtkBandedPolyDataContourFilter::Component
int Component
Definition: vtkBandedPolyDataContourFilter.h:186
vtkBandedPolyDataContourFilter
generate filled contours for vtkPolyData
Definition: vtkBandedPolyDataContourFilter.h:65
vtkContourValues::SetNumberOfContours
void SetNumberOfContours(const int number)
Set the number of contours to place into the list.
vtkTypeBool
int vtkTypeBool
Definition: vtkABI.h:69
vtkPolyDataAlgorithm::New
static vtkPolyDataAlgorithm * New()
VTK_SCALAR_MODE_VALUE
#define VTK_SCALAR_MODE_VALUE
Definition: vtkBandedPolyDataContourFilter.h:63
vtkMTimeType
vtkTypeUInt32 vtkMTimeType
Definition: vtkType.h:302
vtkBandedPolyDataContourFilter::Clipping
vtkTypeBool Clipping
Definition: vtkBandedPolyDataContourFilter.h:184
vtkPolyDataAlgorithm
Superclass for algorithms that produce only polydata as output.
Definition: vtkPolyDataAlgorithm.h:44