1 /*# ---------------------------------------------------------------------
3 # Copyright (c) CREATIS (Centre de Recherche en Acquisition et Traitement de l'Image
5 # Authors : Eduardo Davila, Frederic Cervenansky, Claire Mouton
6 # Previous Authors : Laurent Guigues, Jean-Pierre Roux
7 # CreaTools website : www.creatis.insa-lyon.fr/site/fr/creatools_accueil
9 # This software is governed by the CeCILL-B license under French law and
10 # abiding by the rules of distribution of free software. You can use,
11 # modify and/ or redistribute the software under the terms of the CeCILL-B
12 # license as circulated by CEA, CNRS and INRIA at the following URL
13 # http://www.cecill.info/licences/Licence_CeCILL-B_V1-en.html
14 # or in the file LICENSE.txt.
16 # As a counterpart to the access to the source code and rights to copy,
17 # modify and redistribute granted by the license, users are provided only
18 # with a limited warranty and the software's author, the holder of the
19 # economic rights, and the successive licensors have only limited
22 # The fact that you are presently reading this means that you have had
23 # knowledge of the CeCILL-B license and that you accept its terms.
24 # ------------------------------------------------------------------------ */
26 #ifndef __AutoControlPoints_h_INCLUDED__
27 #define __AutoControlPoints_h_INCLUDED__
29 #include "manualContourModel.h"
30 #include "Propagation.h"
31 #include "vectorFunctions.h"
33 class AutoControlPoints : Vector
38 int GetSizeVector ( std::vector<double>*Vector );
40 void PointLeft ( std::vector<double>*IndX, std::vector<double>*InY, std::vector<double>*InZ,
41 double* lex, double* ley, double* lez );
42 void PointRight ( std::vector<double>*IndX, std::vector<double>*InY, std::vector<double>*InZ,
43 double* rix, double* riy, double* riz );
44 void PointHigh ( std::vector<double>*IndX, std::vector<double>*InY, std::vector<double>*InZ,
45 double* hix, double* hiy, double* hiz );
46 void PointLow ( std::vector<double>*IndX, std::vector<double>*InY, std::vector<double>*InZ,
47 double* lox, double* loy, double* loz );
48 void TwoPoints ( std::vector<double>*InX, std::vector<double>*InY, std::vector<double>*InZ );
50 void Intersection ( double x01, double y01, double x02, double y02, double mn, double m2, double* x, double* y );
51 void InterBetweenContours ( std::vector<double>*InX, std::vector<double>*InY, std::vector<double>*InZ );
52 void GetInterBetweenContours ( std::vector<Vector>*interVX, std::vector<Vector>*interVY );
53 void IntersectionPoints ( );
54 void GetIntersectionPoints ( std::vector<Vector>*interVX, std::vector<Vector>*interVY );
55 void GetErrorBetweenContours ( std::vector<double>*vec );
56 void CalculeControlPoints ( std::vector<double>*InX, std::vector<double>*InY, std::vector<double>*InZ );
57 void GetControlPoints ( std::vector<double>*OutX, std::vector<double>*OutY, std::vector<double>*OutZ );
58 void CalculeInitialControlPoints ( std::vector<double>*InX, std::vector<double>*InY, std::vector<double>*InZ );
59 void GetInitialControlPoints ( std::vector<double>*OutX, std::vector<double>*OutY, std::vector<double>*OutZ );
60 void SetNumSplineInterpolation ( int num );
63 void ChargeSpline ( );
64 double Slope ( double x0, double y0, double x1, double y1 );
65 double Normal ( double x0, double y0, double* m, double xi );
66 void CircleCenter ( std::vector<double>*InX, std::vector<double>*InY, std::vector<double>*InZ, double *cx, double *cy, double *r );
67 void CirclePoints ( double cx, double cy, double r, double grad, double *x, double *y );
68 void InterCircle ( std::vector<double>*InX, std::vector<double>*InY, std::vector<double>*InZ );
70 void fixBetweenPoints ( double val );
71 void ErrorBetweenContours ( );
72 void AddControlPoint ( bool activate );
73 void InterBetweenControl ( );
74 void fixBetweenControl ( );
75 void PossibleIntersections ( std::vector<double>*InX, std::vector<double>*InY, std::vector<double>*InZ );
76 void ControlInContour ( std::vector<double>*InX, std::vector<double>*InY, std::vector<double>*InZ );
77 void NearMaxError2Control ( );
78 void MoveControlPointInContour ( std::vector<double>*InX, std::vector<double>*InY, std::vector<double>*InZ );
79 double MoveAndAverage ( int dir, std::vector<double>*InX, std::vector<double>*InY, std::vector<double>*InZ );
80 void MoveControlPoints ( std::vector<double>*InX, std::vector<double>*InY, std::vector<double>*InZ );
81 void GetNewPoints ( std::vector<double>*InX, std::vector<double>*InY, std::vector<double>*InZ );
82 void GetInitialNewPoints ( std::vector<double>*InX, std::vector<double>*InY, std::vector<double>*InZ );
85 std::vector<double> _controlpointsX;
86 std::vector<double> _controlpointsY;
87 std::vector<double> _controlpointsZ;
89 manualContourModel *_mContourModel;
93 std::vector<double> _chargecontrolpointsX;
94 std::vector<double> _chargecontrolpointsY;
95 std::vector<double> _chargecontrolpointsZ;
97 std::vector<double> _circleX;
98 std::vector<double> _circleY;
99 std::vector<double> _intercircleX;
100 std::vector<double> _intercircleY;
101 std::vector<double> _intercircleDist;
102 std::vector<double> _interbewteencircleX;
103 std::vector<double> _interbewteencircleY;
104 std::vector<double> _interbewteencircleDist;
105 std::vector<int> _interbewteencirclePos;
107 std::vector<int> _posmaxlocal;
108 std::vector<int> _posminlocal;
109 std::vector<double> _maxlocalX;
110 std::vector<double> _maxlocalY;
111 std::vector<double> _minlocalX;
112 std::vector<double> _minlocalY;
113 std::vector<double> _minmaxlocalX;
114 std::vector<double> _minmaxlocalY;
115 std::vector<int> _posminmaxlocal;
117 std::vector<Vector> _intervectorX;
118 std::vector<Vector> _intervectorY;
119 std::vector<double> _interpointsX;
120 std::vector<double> _interpointsY;
125 std::vector<double> _errorvector;
127 std::vector<Vector> _intervecXX;
128 std::vector<Vector> _intervecYY;
129 std::vector<Vector> _interitselfX;
130 std::vector<Vector> _interitselfY;
133 std::vector<int> _contIncontpos;
137 #endif // __AutoControlPoints_h_INCLUDED__