VTK  9.3.1
vtkImageConnectivityFilter.h
Go to the documentation of this file.
1 // SPDX-FileCopyrightText: Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
2 // SPDX-FileCopyrightText: Copyright (c) 2014 David Gobbi
3 // SPDX-License-Identifier: BSD-3-Clause
54 #ifndef vtkImageConnectivityFilter_h
55 #define vtkImageConnectivityFilter_h
56 
57 #include "vtkImageAlgorithm.h"
58 #include "vtkImagingMorphologicalModule.h" // For export macro
59 
60 VTK_ABI_NAMESPACE_BEGIN
61 class vtkIdTypeArray;
62 class vtkIntArray;
63 class vtkDataSet;
64 class vtkImageData;
66 
67 class VTKIMAGINGMORPHOLOGICAL_EXPORT vtkImageConnectivityFilter : public vtkImageAlgorithm
68 {
69 public:
72  void PrintSelf(ostream& os, vtkIndent indent) override;
73 
78  {
79  SeedScalar = 0,
80  ConstantValue = 1,
81  SizeRank = 2
82  };
83 
88  {
89  SeededRegions = 0,
90  AllRegions = 1,
91  LargestRegion = 2
92  };
93 
95 
101  void SetSeedConnection(vtkAlgorithmOutput* port);
102  vtkAlgorithmOutput* GetSeedConnection();
103  void SetSeedData(vtkDataSet* data);
105 
107 
113  void SetStencilConnection(vtkAlgorithmOutput* port);
114  vtkAlgorithmOutput* GetStencilConnection();
115  void SetStencilData(vtkImageStencilData* data);
117 
119 
127  void SetLabelScalarTypeToUnsignedChar() { this->SetLabelScalarType(VTK_UNSIGNED_CHAR); }
128  void SetLabelScalarTypeToShort() { this->SetLabelScalarType(VTK_SHORT); }
129  void SetLabelScalarTypeToUnsignedShort() { this->SetLabelScalarType(VTK_UNSIGNED_SHORT); }
130  void SetLabelScalarTypeToInt() { this->SetLabelScalarType(VTK_INT); }
131  const char* GetLabelScalarTypeAsString();
132  vtkSetMacro(LabelScalarType, int);
133  vtkGetMacro(LabelScalarType, int);
135 
137 
149  void SetLabelModeToSeedScalar() { this->SetLabelMode(SeedScalar); }
150  void SetLabelModeToConstantValue() { this->SetLabelMode(ConstantValue); }
151  void SetLabelModeToSizeRank() { this->SetLabelMode(SizeRank); }
152  const char* GetLabelModeAsString();
153  vtkSetMacro(LabelMode, int);
154  vtkGetMacro(LabelMode, int);
156 
158 
165  void SetExtractionModeToSeededRegions() { this->SetExtractionMode(SeededRegions); }
166  void SetExtractionModeToAllRegions() { this->SetExtractionMode(AllRegions); }
167  void SetExtractionModeToLargestRegion() { this->SetExtractionMode(LargestRegion); }
168  const char* GetExtractionModeAsString();
169  vtkSetMacro(ExtractionMode, int);
170  vtkGetMacro(ExtractionMode, int);
172 
174 
178  vtkSetMacro(LabelConstantValue, int);
179  vtkGetMacro(LabelConstantValue, int);
181 
185  vtkIdType GetNumberOfExtractedRegions();
186 
190  vtkIdTypeArray* GetExtractedRegionLabels() { return this->ExtractedRegionLabels; }
191 
192  // Description:
193  // Get the size of each extracted region, as a voxel count.
194  vtkIdTypeArray* GetExtractedRegionSizes() { return this->ExtractedRegionSizes; }
195 
200  vtkIdTypeArray* GetExtractedRegionSeedIds() { return this->ExtractedRegionSeedIds; }
201 
207  vtkIntArray* GetExtractedRegionExtents() { return this->ExtractedRegionExtents; }
208 
210 
213  vtkSetMacro(GenerateRegionExtents, vtkTypeBool);
214  vtkBooleanMacro(GenerateRegionExtents, vtkTypeBool);
215  vtkGetMacro(GenerateRegionExtents, vtkTypeBool);
217 
219 
224  vtkSetVector2Macro(SizeRange, vtkIdType);
225  vtkGetVector2Macro(SizeRange, vtkIdType);
227 
229 
236  vtkSetVector2Macro(ScalarRange, double);
237  vtkGetVector2Macro(ScalarRange, double);
239 
241 
244  vtkSetMacro(ActiveComponent, int);
245  vtkGetMacro(ActiveComponent, int);
247 
248 protected:
250  ~vtkImageConnectivityFilter() override;
251 
254 
255  double ScalarRange[2];
256  vtkIdType SizeRange[2];
261 
266 
267  void ComputeInputUpdateExtent(int inExt[6], int outExt[6]);
268 
269  int FillInputPortInformation(int port, vtkInformation* info) override;
273 
274 private:
276  void operator=(const vtkImageConnectivityFilter&) = delete;
277 };
278 
279 VTK_ABI_NAMESPACE_END
280 #endif
vtkIdTypeArray * GetExtractedRegionSeedIds()
Get the PointId of the seed for each region.
Store vtkAlgorithm input/output information.
#define VTK_UNSIGNED_SHORT
Definition: vtkType.h:37
abstract class to specify dataset behavior
Definition: vtkDataSet.h:52
void SetExtractionModeToSeededRegions()
Set which regions to output from this filter.
dynamic, self-adjusting array of vtkIdType
int vtkIdType
Definition: vtkType.h:315
vtkIntArray * GetExtractedRegionExtents()
Get the extent (a 6-tuples) for each output region.
virtual int RequestUpdateExtent(vtkInformation *, vtkInformationVector **, vtkInformationVector *)
Subclasses can reimplement this method to translate the update extent requests from each output port ...
Proxy object to connect input/output ports.
int vtkTypeBool
Definition: vtkABI.h:64
dynamic, self-adjusting array of int
Definition: vtkIntArray.h:34
vtkIdTypeArray * GetExtractedRegionLabels()
Get the label used for each extracted region.
LabelModeEnum
Enum constants for SetLabelMode().
void SetLabelModeToSizeRank()
Set the mode for applying labels to the output.
void SetLabelModeToSeedScalar()
Set the mode for applying labels to the output.
void SetExtractionModeToLargestRegion()
Set which regions to output from this filter.
a simple class to control print indentation
Definition: vtkIndent.h:28
ExtractionModeEnum
Enum constants for SetExtractionMode().
efficient description of an image stencil
topologically and geometrically regular array of data
Definition: vtkImageData.h:42
virtual int RequestInformation(vtkInformation *request, vtkInformationVector **inputVector, vtkInformationVector *outputVector)
Subclasses can reimplement this method to collect information from their inputs and set information f...
void SetLabelScalarTypeToUnsignedShort()
Set the scalar type for the output label image.
#define VTK_SHORT
Definition: vtkType.h:36
void SetLabelScalarTypeToShort()
Set the scalar type for the output label image.
void SetLabelScalarTypeToInt()
Set the scalar type for the output label image.
void SetLabelScalarTypeToUnsignedChar()
Set the scalar type for the output label image.
void SetLabelModeToConstantValue()
Set the mode for applying labels to the output.
#define VTK_UNSIGNED_CHAR
Definition: vtkType.h:35
Label an image by connectivity.
int FillInputPortInformation(int port, vtkInformation *info) override
These method should be reimplemented by subclasses that have more than a single input or single outpu...
Generic algorithm superclass for image algs.
Store zero or more vtkInformation instances.
static vtkAlgorithm * New()
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
void SetExtractionModeToAllRegions()
Set which regions to output from this filter.
virtual int RequestData(vtkInformation *request, vtkInformationVector **inputVector, vtkInformationVector *outputVector)
This is called in response to a REQUEST_DATA request from the executive.
#define VTK_INT
Definition: vtkType.h:38