VTK: Filters/Core/vtkSurfaceNets2D.h Source File

| VTK 9.3.1

vtkSurfaceNets2D.h
Go to the documentation of this file.
1 // SPDX-FileCopyrightText: Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
2 // SPDX-License-Identifier: BSD-3-Clause
114 #ifndef vtkSurfaceNets2D_h
115 #define vtkSurfaceNets2D_h
116
117 #include "vtkConstrainedSmoothingFilter.h" // Perform mesh smoothing
118 #include "vtkContourValues.h" // Needed for direct access to ContourValues
119 #include "vtkFiltersCoreModule.h" // For export macro
120 #include "vtkPolyData.h" // To support data caching
121 #include "vtkPolyDataAlgorithm.h"
122
123 VTK_ABI_NAMESPACE_BEGIN
124
125 class vtkImageData;
126
127 class VTKFILTERSCORE_EXPORT vtkSurfaceNets2D : public vtkPolyDataAlgorithm
128 {
129 public:
131
134 static vtkSurfaceNets2D* New();
135 vtkTypeMacro(vtkSurfaceNets2D, vtkPolyDataAlgorithm);
136 void PrintSelf(ostream& os, vtkIndent indent) override;
138
143 vtkMTimeType GetMTime() override;
144
146
156 void SetValue(int i, double value) { this->Labels->SetValue(i, value); }
157 void SetLabel(int i, double value) { this->Labels->SetValue(i, value); }
159
161
164 double GetValue(int i) { return this->Labels->GetValue(i); }
165 double GetLabel(int i) { return this->Labels->GetValue(i); }
167
169
173 double* GetValues() { return this->Labels->GetValues(); }
174 double* GetLabels() { return this->Labels->GetValues(); }
176
178
183 void GetValues(double* contourValues) { this->Labels->GetValues(contourValues); }
184 void GetLabels(double* contourValues) { this->Labels->GetValues(contourValues); }
186
188
195 void SetNumberOfLabels(int number) { this->Labels->SetNumberOfContours(number); }
196 void SetNumberOfContours(int number) { this->Labels->SetNumberOfContours(number); }
198
200
203 vtkIdType GetNumberOfLabels() { return this->Labels->GetNumberOfContours(); }
204 vtkIdType GetNumberOfContours() { return this->Labels->GetNumberOfContours(); }
206
208
212 void GenerateLabels(int numLabels, double range[2])
213 {
214 this->Labels->GenerateValues(numLabels, range);
215 }
216 void GenerateValues(int numContours, double range[2])
217 {
218 this->Labels->GenerateValues(numContours, range);
219 }
220 void GenerateLabels(int numLabels, double rangeStart, double rangeEnd)
221 {
222 this->Labels->GenerateValues(numLabels, rangeStart, rangeEnd);
223 }
224 void GenerateValues(int numContours, double rangeStart, double rangeEnd)
225 {
226 this->Labels->GenerateValues(numContours, rangeStart, rangeEnd);
227 }
229
231
239 vtkSetMacro(ComputeScalars, bool);
240 vtkGetMacro(ComputeScalars, bool);
241 vtkBooleanMacro(ComputeScalars, bool);
243
245
255 vtkSetMacro(BackgroundLabel, double);
256 vtkGetMacro(BackgroundLabel, double);
258
260
264 vtkSetMacro(ArrayComponent, int);
265 vtkGetMacro(ArrayComponent, int);
267
269
274 vtkSetMacro(Smoothing, bool);
275 vtkGetMacro(Smoothing, bool);
276 vtkBooleanMacro(Smoothing, bool);
278
280
287 vtkGetSmartPointerMacro(Smoother, vtkConstrainedSmoothingFilter);
289
291
301 vtkSetMacro(DataCaching, bool);
302 vtkGetMacro(DataCaching, bool);
303 vtkBooleanMacro(DataCaching, bool);
305
306 protected:
307 vtkSurfaceNets2D();
308 ~vtkSurfaceNets2D() override = default;
309
310 int RequestData(vtkInformation*, vtkInformationVector**, vtkInformationVector*) override;
311 int FillInputPortInformation(int port, vtkInformation* info) override;
312
313 vtkSmartPointer<vtkContourValues> Labels;
314 bool ComputeScalars;
315 double BackgroundLabel;
316 int ArrayComponent;
317
318 bool Smoothing;
319 vtkSmartPointer<vtkConstrainedSmoothingFilter> Smoother;
320
321 // Support data caching of the extracted surface nets. This is used to
322 // avoid repeated surface extraction when only smoothing filter
323 // parameters are modified.
324 bool DataCaching;
325 vtkSmartPointer<vtkPolyData> GeometryCache;
326 vtkSmartPointer<vtkCellArray> StencilsCache;
327 vtkTimeStamp SmoothingTime;
328 bool IsCacheEmpty();
329 void CacheData(vtkPolyData* pd, vtkCellArray* ca);
330
331 private:
332 vtkSurfaceNets2D(const vtkSurfaceNets2D&) = delete;
333 void operator=(const vtkSurfaceNets2D&) = delete;
334 };
335
336 VTK_ABI_NAMESPACE_END
337 #endif
vtkCellArray
object to represent cell connectivity
Definition: vtkCellArray.h:185
vtkConstrainedSmoothingFilter
adjust point positions using constrained smoothing
Definition: vtkConstrainedSmoothingFilter.h:65
vtkImageData
topologically and geometrically regular array of data
Definition: vtkImageData.h:52
vtkIndent
a simple class to control print indentation
Definition: vtkIndent.h:38
vtkInformationVector
Store zero or more vtkInformation instances.
Definition: vtkInformationVector.h:40
vtkInformation
Store vtkAlgorithm input/output information.
Definition: vtkInformation.h:72
vtkPolyDataAlgorithm
Superclass for algorithms that produce only polydata as output.
Definition: vtkPolyDataAlgorithm.h:43
vtkPolyData
concrete dataset represents vertices, lines, polygons, and triangle strips
Definition: vtkPolyData.h:89
vtkSmartPointer< vtkContourValues >
vtkSurfaceNets2D
generate smoothed constours from segmented 2D image data (i.e., "label maps")
Definition: vtkSurfaceNets2D.h:128
vtkSurfaceNets2D::GetValues
double * GetValues()
Get a pointer to an array of labels.
Definition: vtkSurfaceNets2D.h:173
vtkSurfaceNets2D::PrintSelf
void PrintSelf(ostream &os, vtkIndent indent) override
Standard methods for instantiation, printing, and type information.
vtkSurfaceNets2D::New
static vtkSurfaceNets2D * New()
Standard methods for instantiation, printing, and type information.
vtkSurfaceNets2D::ComputeScalars
bool ComputeScalars
Definition: vtkSurfaceNets2D.h:314
vtkSurfaceNets2D::GenerateLabels
void GenerateLabels(int numLabels, double rangeStart, double rangeEnd)
Generate numLabels equally spaced labels between the specified range.
Definition: vtkSurfaceNets2D.h:220
vtkSurfaceNets2D::SetNumberOfLabels
void SetNumberOfLabels(int number)
Set the number of labels to place into the list.
Definition: vtkSurfaceNets2D.h:195
vtkSurfaceNets2D::GetMTime
vtkMTimeType GetMTime() override
The modified time is also a function of the label values and the smoothing filter.
vtkSurfaceNets2D::Smoother
vtkSmartPointer< vtkConstrainedSmoothingFilter > Smoother
Definition: vtkSurfaceNets2D.h:319
vtkSurfaceNets2D::Smoothing
bool Smoothing
Definition: vtkSurfaceNets2D.h:318
vtkSurfaceNets2D::Labels
vtkSmartPointer< vtkContourValues > Labels
Definition: vtkSurfaceNets2D.h:313
vtkSurfaceNets2D::GeometryCache
vtkSmartPointer< vtkPolyData > GeometryCache
Definition: vtkSurfaceNets2D.h:325
vtkSurfaceNets2D::GetLabels
double * GetLabels()
Get a pointer to an array of labels.
Definition: vtkSurfaceNets2D.h:174
vtkSurfaceNets2D::GetValues
void GetValues(double *contourValues)
Fill a supplied list with label values.
Definition: vtkSurfaceNets2D.h:183
vtkSurfaceNets2D::IsCacheEmpty
bool IsCacheEmpty()
vtkSurfaceNets2D::SmoothingTime
vtkTimeStamp SmoothingTime
Definition: vtkSurfaceNets2D.h:327
vtkSurfaceNets2D::GenerateValues
void GenerateValues(int numContours, double range[2])
Generate numLabels equally spaced labels between the specified range.
Definition: vtkSurfaceNets2D.h:216
vtkSurfaceNets2D::SetLabel
void SetLabel(int i, double value)
Set a particular label value at label number i.
Definition: vtkSurfaceNets2D.h:157
vtkSurfaceNets2D::vtkGetSmartPointerMacro
vtkGetSmartPointerMacro(Smoother, vtkConstrainedSmoothingFilter)
Get the instance of vtkConstrainedSmoothingFilter used to smooth the extracted surface net.
vtkSurfaceNets2D::~vtkSurfaceNets2D
~vtkSurfaceNets2D() override=default
vtkSurfaceNets2D::GetLabel
double GetLabel(int i)
Get the ith label value.
Definition: vtkSurfaceNets2D.h:165
vtkSurfaceNets2D::GetValue
double GetValue(int i)
Get the ith label value.
Definition: vtkSurfaceNets2D.h:164
vtkSurfaceNets2D::GenerateLabels
void GenerateLabels(int numLabels, double range[2])
Generate numLabels equally spaced labels between the specified range.
Definition: vtkSurfaceNets2D.h:212
vtkSurfaceNets2D::SetNumberOfContours
void SetNumberOfContours(int number)
Set the number of labels to place into the list.
Definition: vtkSurfaceNets2D.h:196
vtkSurfaceNets2D::GetLabels
void GetLabels(double *contourValues)
Fill a supplied list with label values.
Definition: vtkSurfaceNets2D.h:184
vtkSurfaceNets2D::CacheData
void CacheData(vtkPolyData *pd, vtkCellArray *ca)
vtkSurfaceNets2D::GenerateValues
void GenerateValues(int numContours, double rangeStart, double rangeEnd)
Generate numLabels equally spaced labels between the specified range.
Definition: vtkSurfaceNets2D.h:224
vtkSurfaceNets2D::FillInputPortInformation
int FillInputPortInformation(int port, vtkInformation *info) override
Fill the input port information objects for this algorithm.
vtkSurfaceNets2D::DataCaching
bool DataCaching
Definition: vtkSurfaceNets2D.h:324
vtkSurfaceNets2D::GetNumberOfLabels
vtkIdType GetNumberOfLabels()
Get the number of labels in the list of label values.
Definition: vtkSurfaceNets2D.h:203
vtkSurfaceNets2D::RequestData
int RequestData(vtkInformation *, vtkInformationVector **, vtkInformationVector *) override
This is called by the superclass.
vtkSurfaceNets2D::GetNumberOfContours
vtkIdType GetNumberOfContours()
Get the number of labels in the list of label values.
Definition: vtkSurfaceNets2D.h:204
vtkSurfaceNets2D::ArrayComponent
int ArrayComponent
Definition: vtkSurfaceNets2D.h:316
vtkSurfaceNets2D::vtkSurfaceNets2D
vtkSurfaceNets2D()
vtkSurfaceNets2D::StencilsCache
vtkSmartPointer< vtkCellArray > StencilsCache
Definition: vtkSurfaceNets2D.h:326
vtkSurfaceNets2D::SetValue
void SetValue(int i, double value)
Set a particular label value at label number i.
Definition: vtkSurfaceNets2D.h:156
vtkSurfaceNets2D::BackgroundLabel
double BackgroundLabel
Definition: vtkSurfaceNets2D.h:315
vtkTimeStamp
record modification and/or execution time
Definition: vtkTimeStamp.h:34
vtkX3D::info
@ info
Definition: vtkX3D.h:376
vtkX3D::value
@ value
Definition: vtkX3D.h:220
vtkX3D::port
@ port
Definition: vtkX3D.h:447
vtkX3D::range
@ range
Definition: vtkX3D.h:238
vtkConstrainedSmoothingFilter.h
vtkContourValues.h
vtkPolyDataAlgorithm.h
vtkPolyData.h
vtkIdType
int vtkIdType
Definition: vtkType.h:315
vtkMTimeType
vtkTypeUInt32 vtkMTimeType
Definition: vtkType.h:270