OSDN Git Service

FIRST REPOSITORY
[eos/hostdependOTHERS.git] / ALPHALINUX5 / util / ALPHALINUX5 / include / vtk / vtkLinkEdgels.h
1 /*=========================================================================
2
3   Program:   Visualization Toolkit
4   Module:    $RCSfile: vtkLinkEdgels.h,v $
5   Language:  C++
6   Date:      $Date: 2002/02/01 06:35:49 $
7   Version:   $Revision: 1.1.1.1 $
8
9 Copyright (c) 1993-1995 Ken Martin, Will Schroeder, Bill Lorensen.
10
11 This software is copyrighted by Ken Martin, Will Schroeder and Bill Lorensen.
12 The following terms apply to all files associated with the software unless
13 explicitly disclaimed in individual files. This copyright specifically does
14 not apply to the related textbook "The Visualization Toolkit" ISBN
15 013199837-4 published by Prentice Hall which is covered by its own copyright.
16
17 The authors hereby grant permission to use, copy, and distribute this
18 software and its documentation for any purpose, provided that existing
19 copyright notices are retained in all copies and that this notice is included
20 verbatim in any distributions. Additionally, the authors grant permission to
21 modify this software and its documentation for any purpose, provided that
22 such modifications are not distributed without the explicit consent of the
23 authors and that existing copyright notices are retained in all copies. Some
24 of the algorithms implemented by this software are patented, observe all
25 applicable patent law.
26
27 IN NO EVENT SHALL THE AUTHORS OR DISTRIBUTORS BE LIABLE TO ANY PARTY FOR
28 DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES ARISING OUT
29 OF THE USE OF THIS SOFTWARE, ITS DOCUMENTATION, OR ANY DERIVATIVES THEREOF,
30 EVEN IF THE AUTHORS HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
31
32 THE AUTHORS AND DISTRIBUTORS SPECIFICALLY DISCLAIM ANY WARRANTIES, INCLUDING,
33 BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
34 PARTICULAR PURPOSE, AND NON-INFRINGEMENT.  THIS SOFTWARE IS PROVIDED ON AN
35 "AS IS" BASIS, AND THE AUTHORS AND DISTRIBUTORS HAVE NO OBLIGATION TO PROVIDE
36 MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
37
38
39 =========================================================================*/
40 // .NAME vtkLinkEdgels - links edgels together to form digital curves.
41 // .SECTION Description
42 // vtkLinkEdgels links edgels into digital curves which are then stored 
43 // as polylines. The algorithm works one pixel at a time only looking at
44 // its immediate neighbors. There is a GradientThreshold that can be set 
45 // that eliminates any pixels with a smaller gradient value. This can
46 // be used as the lower threshold of a two value edgel thresholding. 
47 //
48 // For the remaining edgels, links are first tried for the four
49 // connected neighbors.  A succesful neighbor will satisfy three
50 // tests. First both edgels must be above the gradient
51 // threshold. Second, the difference between the orientation between
52 // the two edgels (Alpha) and each edgels orientation (Phi) must be
53 // less than LinkThreshold. Third, the difference between the two
54 // edgels Phi values must be less than PhiThreshold.
55 // The most successful link is selected. The meaure is simply the 
56 // sum of the three angle differences (actually stored as the sum of
57 // the cosines). If none of the four connect neighbors succeds, then
58 // the eight connect neighbors are examined using the same method.
59 //  
60 // This filter requires gradient information so you will need to use
61 // a vtkImageGradient at some point prior to this filter.  Typically
62 // a vtkNonMaximumSuppression filter is also used. vtkThresholdEdgels
63 // can be used to complete the two value edgel thresholding as used
64 // in a Canny edge detector. The vtkSubpixelPositionEdgels filter 
65 // can also be used after this filter to adjust the edgel locations.
66
67 // .SECTION see also
68 // vtkImage vtkImageGradient vtkNonMaximumSuppression
69
70 #ifndef __vtkLinkEdgels_h
71 #define __vtkLinkEdgels_h
72
73 #include "vtkStructuredPointsToPolyDataFilter.h"
74
75 class VTK_EXPORT vtkLinkEdgels : public vtkStructuredPointsToPolyDataFilter
76 {
77 public:
78   vtkLinkEdgels();
79   static vtkLinkEdgels *New() {return new vtkLinkEdgels;};
80   const char *GetClassName() {return "vtkLinkEdgels";};
81   void PrintSelf(ostream& os, vtkIndent indent);
82
83   // Description:
84   // Set/Get the threshold for Phi vs. Alpha link thresholding.
85   vtkSetMacro(LinkThreshold,float);
86   vtkGetMacro(LinkThreshold,float);
87
88   // Description:
89   // Set/get the threshold for Phi vs. Phi link thresholding.
90   vtkSetMacro(PhiThreshold,float);
91   vtkGetMacro(PhiThreshold,float);
92
93   // Description:
94   // Set/Get the threshold for image gradient thresholding.
95   vtkSetMacro(GradientThreshold,float);
96   vtkGetMacro(GradientThreshold,float);
97
98 protected:
99   void Execute();
100   void LinkEdgels(int xdim, int ydim,float *image, vtkVectors *inVectors,
101                   vtkCellArray *newLines, vtkPoints *newPts,
102                   vtkScalars *outScalars, vtkVectors *outVectors,
103                   int z);
104   float GradientThreshold;
105   float PhiThreshold;
106   float LinkThreshold;
107 };
108
109 #endif