VTK  9.7.1
vtkLabeledImagePointSampler.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
73 #ifndef vtkLabeledImagePointSampler_h
74 #define vtkLabeledImagePointSampler_h
75 
76 #include "vtkContourValues.h" // Manage contour values
77 #include "vtkFiltersMeshingModule.h" // For export macro
78 #include "vtkPolyDataAlgorithm.h"
79 
80 VTK_ABI_NAMESPACE_BEGIN
81 class vtkImageData;
82 
83 class VTKFILTERSMESHING_EXPORT vtkLabeledImagePointSampler : public vtkPolyDataAlgorithm
84 {
85 public:
87 
93  void PrintSelf(ostream& os, vtkIndent indent) override;
95 
97 
111  vtkSetMacro(BackgroundPointMapping, int);
112  vtkGetMacro(BackgroundPointMapping, int);
113  vtkBooleanMacro(BackgroundPointMapping, int);
114  vtkSetMacro(BackgroundPointLabel, int);
115  vtkGetMacro(BackgroundPointLabel, int);
117 
119 
124  {
125  LINEAR = 0,
126  EXPONENTIAL = 1
127  };
132  vtkSetClampMacro(DensityDistribution, int, LINEAR, EXPONENTIAL);
133  vtkGetMacro(DensityDistribution, int);
134  void SetDensityDistributionToLinear() { this->SetDensityDistribution(LINEAR); }
135  void SetDensityDistributionToExponential() { this->SetDensityDistribution(EXPONENTIAL); }
137 
139 
145  vtkSetClampMacro(N, unsigned int, 1, 100);
146  vtkGetMacro(N, unsigned int);
148 
150 
160  vtkSetMacro(Randomize, vtkTypeBool);
161  vtkGetMacro(Randomize, vtkTypeBool);
162  vtkBooleanMacro(Randomize, vtkTypeBool);
164 
166 
175  vtkSetVector2Macro(RandomProbabilityRange, double);
176  vtkGetVectorMacro(RandomProbabilityRange, double, 2);
178 
180 
184  {
185  ALL_POINTS = 0,
186  LABELED_POINTS = 1,
187  BACKGROUND_POINTS = 2
188  };
195  vtkSetClampMacro(OutputType, int, ALL_POINTS, BACKGROUND_POINTS);
196  vtkGetMacro(OutputType, int);
197  void SetOutputTypeToAllPoints() { this->SetOutputType(ALL_POINTS); }
198  void SetOutputTypeToLabeledPoints() { this->SetOutputType(LABELED_POINTS); }
199  void SetOutputTypeToBackgroundPoints() { this->SetOutputType(BACKGROUND_POINTS); }
201 
203 
212  vtkSetMacro(Joggle, vtkTypeBool);
213  vtkGetMacro(Joggle, vtkTypeBool);
214  vtkBooleanMacro(Joggle, vtkTypeBool);
215  vtkSetClampMacro(JoggleRadius, double, 0, 0.5);
216  vtkGetMacro(JoggleRadius, double);
217  vtkSetMacro(JoggleRadiusIsAbsolute, vtkTypeBool);
218  vtkBooleanMacro(JoggleRadiusIsAbsolute, vtkTypeBool);
219  vtkGetMacro(JoggleRadiusIsAbsolute, vtkTypeBool);
220  vtkSetMacro(ConstrainJoggle, vtkTypeBool);
221  vtkBooleanMacro(ConstrainJoggle, vtkTypeBool);
222  vtkGetMacro(ConstrainJoggle, vtkTypeBool);
223  vtkSetClampMacro(JoggleConstraint, double, 0, 1);
224  vtkGetMacro(JoggleConstraint, double);
226 
227  //---------------The following are methods used to set/get and generate
228  //---------------label values.
230 
242  void SetValue(int i, double value) { this->Labels->SetValue(i, value); }
243  void SetLabel(int i, double value) { this->Labels->SetValue(i, value); }
245 
247 
250  double GetValue(int i) { return this->Labels->GetValue(i); }
251  double GetLabel(int i) { return this->Labels->GetValue(i); }
253 
255 
259  double* GetValues() { return this->Labels->GetValues(); }
260  double* GetLabels() { return this->Labels->GetValues(); }
262 
264 
269  void GetValues(double* contourValues) { this->Labels->GetValues(contourValues); }
270  void GetLabels(double* contourValues) { this->Labels->GetValues(contourValues); }
272 
274 
281  void SetNumberOfLabels(int number) { this->Labels->SetNumberOfContours(number); }
282  void SetNumberOfContours(int number) { this->Labels->SetNumberOfContours(number); }
284 
286 
289  vtkIdType GetNumberOfLabels() { return this->Labels->GetNumberOfContours(); }
290  vtkIdType GetNumberOfContours() { return this->Labels->GetNumberOfContours(); }
292 
294 
298  void GenerateLabels(int numLabels, double range[2])
299  {
300  this->Labels->GenerateValues(numLabels, range);
301  }
302  void GenerateValues(int numContours, double range[2])
303  {
304  this->Labels->GenerateValues(numContours, range);
305  }
306  void GenerateLabels(int numLabels, double rangeStart, double rangeEnd)
307  {
308  this->Labels->GenerateValues(numLabels, rangeStart, rangeEnd);
309  }
310  void GenerateValues(int numContours, double rangeStart, double rangeEnd)
311  {
312  this->Labels->GenerateValues(numContours, rangeStart, rangeEnd);
313  }
315  //---------------Done defining label-related methods.
316 
318 
324  vtkSetMacro(GenerateVerts, vtkTypeBool);
325  vtkGetMacro(GenerateVerts, vtkTypeBool);
326  vtkBooleanMacro(GenerateVerts, vtkTypeBool);
328 
332  vtkMTimeType GetMTime() override;
333 
334 protected:
336  ~vtkLabeledImagePointSampler() override = default;
337 
341  unsigned int N;
343 
345  double RandomProbabilityRange[2];
346 
348  double JoggleRadius;
352 
354 
356 
358  int FillInputPortInformation(int port, vtkInformation* info) override;
359 
360 private:
362  void operator=(const vtkLabeledImagePointSampler&) = delete;
363 };
364 
365 VTK_ABI_NAMESPACE_END
366 #endif
void SetOutputTypeToAllPoints()
Used to indicate which generated points to output.
void SetDensityDistributionToExponential()
Used to indicate the type of point density distribution.
Store vtkAlgorithm input/output information.
vtkTypeUInt32 vtkMTimeType
Definition: vtkType.h:318
void SetOutputTypeToBackgroundPoints()
Used to indicate which generated points to output.
virtual int RequestData(vtkInformation *request, vtkInformationVector **inputVector, vtkInformationVector *outputVector)
This is called by the superclass.
vtkSmartPointer< vtkContourValues > Labels
vtkIdType GetNumberOfLabels()
Get the number of labels in the list of label values.
int vtkIdType
Definition: vtkType.h:363
void SetNumberOfContours(int number)
Set the number of labels to place into the list.
static vtkPolyDataAlgorithm * New()
int vtkTypeBool
Definition: vtkABI.h:64
void GenerateLabels(int numLabels, double range[2])
Generate numLabels equally spaced labels between the specified range.
void GenerateValues(int numContours, double range[2])
Generate numLabels equally spaced labels between the specified range.
OutputLabelsSelection
Used to indicate which generated points to output.
void GetValues(double *contourValues)
Fill a supplied list with label values.
void GenerateValues(int numContours, double rangeStart, double rangeEnd)
Generate numLabels equally spaced labels between the specified range.
Superclass for algorithms that produce only polydata as output.
a simple class to control print indentation
Definition: vtkIndent.h:28
void SetValue(int i, double value)
Set a particular label value at label number i.
topologically and geometrically regular array of data
Definition: vtkImageData.h:45
virtual vtkMTimeType GetMTime()
Return this object's modified time.
DensityDistributionType
Used to indicate the type of point density distribution.
double * GetLabels()
Get a pointer to an array of labels.
void SetOutputTypeToLabeledPoints()
Used to indicate which generated points to output.
void SetDensityDistributionToLinear()
Used to indicate the type of point density distribution.
produce sampled points from a segmented image
double * GetValues()
Get a pointer to an array of labels.
void SetLabel(int i, double value)
Set a particular label value at label number i.
void GenerateLabels(int numLabels, double rangeStart, double rangeEnd)
Generate numLabels equally spaced labels between the specified range.
void SetNumberOfLabels(int number)
Set the number of labels to place into the list.
vtkIdType GetNumberOfContours()
Get the number of labels in the list of label values.
int FillInputPortInformation(int port, vtkInformation *info) override
Fill the input port information objects for this algorithm.
Store zero or more vtkInformation instances.
void GetLabels(double *contourValues)
Fill a supplied list with label values.
double GetLabel(int i)
Get the ith label value.
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
double GetValue(int i)
Get the ith label value.