VTK  9.4.20251007
vtkPackLabels.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
51
52#ifndef vtkPackLabels_h
53#define vtkPackLabels_h
54
55#include "vtkDataArray.h" // For returning list of labels
56#include "vtkDataSetAlgorithm.h"
57#include "vtkFiltersCoreModule.h" // For export macro
58#include "vtkIdTypeArray.h" // For returning count of labels
59#include "vtkSmartPointer.h" // For returning list of labels
60
61VTK_ABI_NAMESPACE_BEGIN
62struct vtkLabelMap;
63
64class VTKFILTERSCORE_EXPORT vtkPackLabels : public vtkDataSetAlgorithm
65{
66public:
68
72 static vtkPackLabels* New();
74 void PrintSelf(ostream& os, vtkIndent indent) override;
76
78
86 vtkDataArray* GetLabels() { return this->LabelsArray; }
88 {
89 return (this->LabelsArray ? this->LabelsArray->GetNumberOfTuples() : 0);
90 }
91
92
106
115
117
126 vtkGetMacro(SortBy, int);
130
132
147 vtkSetMacro(OutputScalarType, int);
148 vtkGetMacro(OutputScalarType, int);
155
157
164 vtkSetMacro(BackgroundValue, unsigned long);
165 vtkGetMacro(BackgroundValue, unsigned long);
167
169
175 vtkSetMacro(PassPointData, bool);
176 vtkGetMacro(PassPointData, bool);
177 vtkBooleanMacro(PassPointData, bool);
178 vtkSetMacro(PassCellData, bool);
179 vtkGetMacro(PassCellData, bool);
180 vtkBooleanMacro(PassCellData, bool);
181 vtkSetMacro(PassFieldData, bool);
182 vtkGetMacro(PassFieldData, bool);
183 vtkBooleanMacro(PassFieldData, bool);
185
186protected:
188 ~vtkPackLabels() override = default;
189
194 unsigned long BackgroundValue;
198
200
201private:
202 vtkPackLabels(const vtkPackLabels&) = delete;
203 void operator=(const vtkPackLabels&) = delete;
204};
205
206VTK_ABI_NAMESPACE_END
207#endif
dynamic, self-adjusting array of vtkIdType
a simple class to control print indentation
Definition vtkIndent.h:29
Store zero or more vtkInformation instances.
Store vtkAlgorithm input/output information.
void PrintSelf(ostream &os, vtkIndent indent) override
Standard methods for instantiation, obtaining type information, and printing an object.
void SetOutputScalarTypeToUnsignedChar()
Specify the data type of the output image.
void SetOutputScalarTypeToUnsignedShort()
Specify the data type of the output image.
~vtkPackLabels() override=default
void SortByLabelValue()
Indicate whether to sort the output labels by their input scalars label value (SortByLabelValue),...
void SetOutputScalarTypeToDefault()
Specify the data type of the output image.
vtkIdType GetNumberOfLabels()
Return the number of and list of labels found in the input label map.
unsigned long BackgroundValue
virtual void SetOutputScalarType(int)
Specify the data type of the output image.
vtkSmartPointer< vtkIdTypeArray > LabelsCount
void SetOutputScalarTypeToUnsignedInt()
Specify the data type of the output image.
vtkIdTypeArray * GetLabelsCount()
Return the frequency of occurrence (i.e., the count) of each label returned in the LabelsArray.
SortBy
Flags to control how sorting of the labels is performed.
void SortByLabelCount()
Indicate whether to sort the output labels by their input scalars label value (SortByLabelValue),...
vtkDataArray * GetLabels()
Return the number of and list of labels found in the input label map.
static vtkPackLabels * New()
Standard methods for instantiation, obtaining type information, and printing an object.
DefaultScalarType
Specify the data type of the output image.
int RequestData(vtkInformation *, vtkInformationVector **, vtkInformationVector *) override
This is called within ProcessRequest when a request asks the algorithm to do its work.
vtkSmartPointer< vtkDataArray > LabelsArray
virtual void SetSortBy(int)
Indicate whether to sort the output labels by their input scalars label value (SortByLabelValue),...
void SetOutputScalarTypeToUnsignedLong()
Specify the data type of the output image.
Hold a reference to a vtkObjectBase instance.
#define vtkDataArray
int vtkIdType
Definition vtkType.h:315
#define VTK_UNSIGNED_INT
Definition vtkType.h:39
#define VTK_UNSIGNED_CHAR
Definition vtkType.h:35
#define VTK_UNSIGNED_SHORT
Definition vtkType.h:37
#define VTK_UNSIGNED_LONG
Definition vtkType.h:41