VTK
vtkImageConnectivityFilter.h
Go to the documentation of this file.
1/*=========================================================================
2
3 Program: Visualization Toolkit
4 Module: vtkImageConnectivityFilter.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=========================================================================*/
15/*=========================================================================
16 Copyright (c) 2014 David Gobbi
17 All rights reserved.
18
19 Redistribution and use in source and binary forms, with or without
20 modification, are permitted provided that the following conditions
21 are met:
22
23 * Redistributions of source code must retain the above copyright
24 notice, this list of conditions and the following disclaimer.
25
26 * Redistributions in binary form must reproduce the above copyright
27 notice, this list of conditions and the following disclaimer in the
28 documentation and/or other materials provided with the distribution.
29
30 * Neither the name of David Gobbi nor the names of any contributors
31 may be used to endorse or promote products derived from this software
32 without specific prior written permission.
33
34 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
35 "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
36 LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
37 A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
38 HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
39 SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
40 LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
41 DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
42 THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
43 (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
44 OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
45=========================================================================*/
96#ifndef vtkImageConnectivityFilter_h
97#define vtkImageConnectivityFilter_h
98
99#include "vtkImagingMorphologicalModule.h" // For export macro
100#include "vtkImageAlgorithm.h"
101
102class vtkIdTypeArray;
103class vtkIntArray;
104class vtkDataSet;
105class vtkImageData;
107
108class VTKIMAGINGMORPHOLOGICAL_EXPORT vtkImageConnectivityFilter :
109 public vtkImageAlgorithm
110{
111public:
114 void PrintSelf(ostream& os, vtkIndent indent);
115
120 SeedScalar = 0,
121 ConstantValue = 1,
122 SizeRank = 2
123 };
124
129 SeededRegions = 0,
130 AllRegions = 1,
131 LargestRegion = 2
132 };
133
135
145
147
157
159
168 this->SetLabelScalarType(VTK_UNSIGNED_CHAR); }
170 this->SetLabelScalarType(VTK_SHORT); }
172 this->SetLabelScalarType(VTK_UNSIGNED_SHORT); }
174 this->SetLabelScalarType(VTK_INT); }
176 vtkSetMacro(LabelScalarType, int);
177 vtkGetMacro(LabelScalarType, int);
179
181
193 void SetLabelModeToSeedScalar() { this->SetLabelMode(SeedScalar); }
194 void SetLabelModeToConstantValue() { this->SetLabelMode(ConstantValue); }
195 void SetLabelModeToSizeRank() { this->SetLabelMode(SizeRank); }
196 const char *GetLabelModeAsString();
197 vtkSetMacro(LabelMode, int);
198 vtkGetMacro(LabelMode, int);
200
202
210 this->SetExtractionMode(SeededRegions); }
212 this->SetExtractionMode(AllRegions); }
214 this->SetExtractionMode(LargestRegion); }
216 vtkSetMacro(ExtractionMode, int);
217 vtkGetMacro(ExtractionMode, int);
219
221
225 vtkSetMacro(LabelConstantValue, int);
226 vtkGetMacro(LabelConstantValue, int);
228
233
238 return this->ExtractedRegionLabels; }
239
240 // Desciption:
241 // Get the size of each extracted region, as a voxel count.
243 return this->ExtractedRegionSizes; }
244
250 return this->ExtractedRegionSeedIds; }
251
258 return this->ExtractedRegionExtents; }
259
261
264 vtkSetMacro(GenerateRegionExtents, int);
265 vtkBooleanMacro(GenerateRegionExtents, int);
266 vtkGetMacro(GenerateRegionExtents, int);
268
270
275 vtkSetVector2Macro(SizeRange, vtkIdType);
276 vtkGetVector2Macro(SizeRange, vtkIdType);
278
280
287 vtkSetVector2Macro(ScalarRange, double);
288 vtkGetVector2Macro(ScalarRange, double);
290
292
295 vtkSetMacro(ActiveComponent, int);
296 vtkGetMacro(ActiveComponent, int);
298
299protected:
302
305
306 double ScalarRange[2];
307 vtkIdType SizeRange[2];
312
317
318 void ComputeInputUpdateExtent(int inExt[6], int outExt[6]);
319
325 virtual int RequestData(
327
328private:
329 vtkImageConnectivityFilter(const vtkImageConnectivityFilter&) VTK_DELETE_FUNCTION;
330 void operator=(const vtkImageConnectivityFilter&) VTK_DELETE_FUNCTION;
331};
332
333#endif
Proxy object to connect input/output ports.
abstract class to specify dataset behavior
Definition: vtkDataSet.h:63
dynamic, self-adjusting array of vtkIdType
Generic algorithm superclass for image algs.
Label an image by connectivity.
const char * GetExtractionModeAsString()
const char * GetLabelScalarTypeAsString()
vtkAlgorithmOutput * GetStencilConnection()
vtkAlgorithmOutput * GetSeedConnection()
vtkIdType GetNumberOfExtractedRegions()
Get the number of extracted regions.
void PrintSelf(ostream &os, vtkIndent indent)
Methods invoked by print to print information about the object including superclasses.
virtual int FillInputPortInformation(int port, vtkInformation *info)
Fill the input port information objects for this algorithm.
void SetStencilData(vtkImageStencilData *data)
vtkIdTypeArray * GetExtractedRegionSeedIds()
Get the PointId of the seed for each region.
void SetSeedData(vtkDataSet *data)
const char * GetLabelModeAsString()
virtual int RequestInformation(vtkInformation *, vtkInformationVector **, vtkInformationVector *)
Subclasses can reimplement this method to collect information from their inputs and set information f...
virtual int RequestUpdateExtent(vtkInformation *, vtkInformationVector **, vtkInformationVector *)
Subclasses can reimplement this method to translate the update extent requests from each output port ...
static vtkImageConnectivityFilter * New()
ExtractionModeEnum
Enum constants for SetExtractionMode().
void SetSeedConnection(vtkAlgorithmOutput *port)
The input for seed locations (input port 1).
void SetLabelScalarTypeToUnsignedChar()
Set the scalar type for the output label image.
LabelModeEnum
Enum constants for SetLabelMode().
vtkIdTypeArray * GetExtractedRegionLabels()
Get the label used for each extracted region.
vtkIntArray * GetExtractedRegionExtents()
Get the extent (a 6-tuples) for each output region.
virtual int RequestData(vtkInformation *, vtkInformationVector **, vtkInformationVector *)
This is called in response to a REQUEST_DATA request from the executive.
void ComputeInputUpdateExtent(int inExt[6], int outExt[6])
void SetExtractionModeToSeededRegions()
Set which regions to output from this filter.
void SetLabelModeToSeedScalar()
Set the mode for applying labels to the output.
void SetStencilConnection(vtkAlgorithmOutput *port)
The input for a stencil (input port 2).
topologically and geometrically regular array of data
Definition: vtkImageData.h:46
efficient description of an image stencil
a simple class to control print indentation
Definition: vtkIndent.h:40
Store zero or more vtkInformation instances.
Store vtkAlgorithm input/output information.
dynamic, self-adjusting array of int
Definition: vtkIntArray.h:46
@ info
Definition: vtkX3D.h:376
@ port
Definition: vtkX3D.h:447
@ data
Definition: vtkX3D.h:315
vtkSetMacro(IgnoreDriverBugs, bool)
Updates the extensions string.
vtkBooleanMacro(IgnoreDriverBugs, bool)
Updates the extensions string.
#define VTK_SHORT
Definition: vtkType.h:52
int vtkIdType
Definition: vtkType.h:287
#define VTK_UNSIGNED_CHAR
Definition: vtkType.h:51
#define VTK_UNSIGNED_SHORT
Definition: vtkType.h:53
#define VTK_INT
Definition: vtkType.h:54