forked from Kitware/VTK
/
vtkImageNonMaximumSuppression.h
89 lines (67 loc) · 3.36 KB
/
vtkImageNonMaximumSuppression.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
/*=========================================================================
Program: Visualization Toolkit
Module: vtkImageNonMaximumSuppression.h
Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
All rights reserved.
See Copyright.txt or http://www.kitware.com/Copyright.htm for details.
This software is distributed WITHOUT ANY WARRANTY; without even
the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
PURPOSE. See the above copyright notice for more information.
=========================================================================*/
// .NAME vtkImageNonMaximumSuppression - Performs non-maximum suppression
// .SECTION Description
// vtkImageNonMaximumSuppression Sets to zero any pixel that is not a peak.
// If a pixel has a neighbor along the vector that has larger magnitude, the
// smaller pixel is set to zero. The filter takes two inputs: a magnitude
// and a vector. Output is magnitude information and is always in doubles.
// Typically this filter is used with vtkImageGradient and
// vtkImageGradientMagnitude as inputs.
#ifndef vtkImageNonMaximumSuppression_h
#define vtkImageNonMaximumSuppression_h
#define VTK_IMAGE_NON_MAXIMUM_SUPPRESSION_MAGNITUDE_INPUT 0
#define VTK_IMAGE_NON_MAXIMUM_SUPPRESSION_VECTOR_INPUT 1
#include "vtkImagingMorphologicalModule.h" // For export macro
#include "vtkThreadedImageAlgorithm.h"
#include "vtkImageData.h" // makes things a bit easier
class VTKIMAGINGMORPHOLOGICAL_EXPORT vtkImageNonMaximumSuppression : public vtkThreadedImageAlgorithm
{
public:
static vtkImageNonMaximumSuppression *New();
vtkTypeMacro(vtkImageNonMaximumSuppression,vtkThreadedImageAlgorithm);
void PrintSelf(ostream& os, vtkIndent indent);
// Description:
// Set the magnitude and vector inputs.
void SetMagnitudeInputData(vtkImageData *input) {this->SetInputData(0,input);};
void SetVectorInputData(vtkImageData *input) {this->SetInputData(1,input);};
// Description:
// If "HandleBoundariesOn" then boundary pixels are duplicated
// So central differences can get values.
vtkSetMacro(HandleBoundaries, int);
vtkGetMacro(HandleBoundaries, int);
vtkBooleanMacro(HandleBoundaries, int);
// Description:
// Determines how the input is interpreted (set of 2d slices or a 3D volume)
vtkSetClampMacro(Dimensionality,int,2,3);
vtkGetMacro(Dimensionality,int);
protected:
vtkImageNonMaximumSuppression();
~vtkImageNonMaximumSuppression() {}
int HandleBoundaries;
int Dimensionality;
virtual int RequestInformation (vtkInformation *,
vtkInformationVector **,
vtkInformationVector *);
virtual int RequestUpdateExtent(vtkInformation*,
vtkInformationVector**,
vtkInformationVector*);
virtual void ThreadedRequestData(vtkInformation *request,
vtkInformationVector **inputVector,
vtkInformationVector *outputVector,
vtkImageData ***inData,
vtkImageData **outData,
int extent[6], int threadId);
private:
vtkImageNonMaximumSuppression(const vtkImageNonMaximumSuppression&); // Not implemented.
void operator=(const vtkImageNonMaximumSuppression&); // Not implemented.
};
#endif