00001 #ifndef __AutoControlPoints_h_INCLUDED__
00002 #define __AutoControlPoints_h_INCLUDED__
00003
00004 #include "manualContourModel.h"
00005 #include "Propagation.h"
00006 #include "vectorFunctions.h"
00007
00008 class AutoControlPoints : Vector
00009 {
00010 public:
00011 AutoControlPoints();
00012 ~AutoControlPoints();
00013 int GetSizeVector ( std::vector<double>*Vector );
00014
00015 void PointLeft ( std::vector<double>*IndX, std::vector<double>*InY, std::vector<double>*InZ,
00016 double* lex, double* ley, double* lez );
00017 void PointRight ( std::vector<double>*IndX, std::vector<double>*InY, std::vector<double>*InZ,
00018 double* rix, double* riy, double* riz );
00019 void PointHigh ( std::vector<double>*IndX, std::vector<double>*InY, std::vector<double>*InZ,
00020 double* hix, double* hiy, double* hiz );
00021 void PointLow ( std::vector<double>*IndX, std::vector<double>*InY, std::vector<double>*InZ,
00022 double* lox, double* loy, double* loz );
00023 void TwoPoints ( std::vector<double>*InX, std::vector<double>*InY, std::vector<double>*InZ );
00024
00025 void Intersection ( double x01, double y01, double x02, double y02, double mn, double m2, double* x, double* y );
00026 void InterBetweenContours ( std::vector<double>*InX, std::vector<double>*InY, std::vector<double>*InZ );
00027 void GetInterBetweenContours ( std::vector<Vector>*interVX, std::vector<Vector>*interVY );
00028 void IntersectionPoints ( );
00029 void GetIntersectionPoints ( std::vector<Vector>*interVX, std::vector<Vector>*interVY );
00030 void GetErrorBetweenContours ( std::vector<double>*vec );
00031 void CalculeControlPoints ( std::vector<double>*InX, std::vector<double>*InY, std::vector<double>*InZ );
00032 void GetControlPoints ( std::vector<double>*OutX, std::vector<double>*OutY, std::vector<double>*OutZ );
00033 void CalculeInitialControlPoints ( std::vector<double>*InX, std::vector<double>*InY, std::vector<double>*InZ );
00034 void GetInitialControlPoints ( std::vector<double>*OutX, std::vector<double>*OutY, std::vector<double>*OutZ );
00035 void SetNumSplineInterpolation ( int num );
00036
00037 private:
00038 void ChargeSpline ( );
00039 double Slope ( double x0, double y0, double x1, double y1 );
00040 double Normal ( double x0, double y0, double* m, double xi );
00041 void CircleCenter ( std::vector<double>*InX, std::vector<double>*InY, std::vector<double>*InZ, double *cx, double *cy, double *r );
00042 void CirclePoints ( double cx, double cy, double r, double grad, double *x, double *y );
00043 void InterCircle ( std::vector<double>*InX, std::vector<double>*InY, std::vector<double>*InZ );
00044 void maxminLocal ( );
00045 void fixBetweenPoints ( double val );
00046 void ErrorBetweenContours ( );
00047 void AddControlPoint ( bool activate );
00048 void InterBetweenControl ( );
00049 void fixBetweenControl ( );
00050 void PossibleIntersections ( std::vector<double>*InX, std::vector<double>*InY, std::vector<double>*InZ );
00051 void ControlInContour ( std::vector<double>*InX, std::vector<double>*InY, std::vector<double>*InZ );
00052 void NearMaxError2Control ( );
00053 void MoveControlPointInContour ( std::vector<double>*InX, std::vector<double>*InY, std::vector<double>*InZ );
00054 double MoveAndAverage ( int dir, std::vector<double>*InX, std::vector<double>*InY, std::vector<double>*InZ );
00055 void MoveControlPoints ( std::vector<double>*InX, std::vector<double>*InY, std::vector<double>*InZ );
00056 void GetNewPoints ( std::vector<double>*InX, std::vector<double>*InY, std::vector<double>*InZ );
00057 void GetInitialNewPoints ( std::vector<double>*InX, std::vector<double>*InY, std::vector<double>*InZ );
00058
00059 int _SizeVectorIn;
00060 std::vector<double> _controlpointsX;
00061 std::vector<double> _controlpointsY;
00062 std::vector<double> _controlpointsZ;
00063
00064 manualContourModel *_mContourModel;
00065 int _numspline;
00066 double _pathsize;
00067
00068 std::vector<double> _chargecontrolpointsX;
00069 std::vector<double> _chargecontrolpointsY;
00070 std::vector<double> _chargecontrolpointsZ;
00071
00072 std::vector<double> _circleX;
00073 std::vector<double> _circleY;
00074 std::vector<double> _intercircleX;
00075 std::vector<double> _intercircleY;
00076 std::vector<double> _intercircleDist;
00077 std::vector<double> _interbewteencircleX;
00078 std::vector<double> _interbewteencircleY;
00079 std::vector<double> _interbewteencircleDist;
00080 std::vector<int> _interbewteencirclePos;
00081
00082 std::vector<int> _posmaxlocal;
00083 std::vector<int> _posminlocal;
00084 std::vector<double> _maxlocalX;
00085 std::vector<double> _maxlocalY;
00086 std::vector<double> _minlocalX;
00087 std::vector<double> _minlocalY;
00088 std::vector<double> _minmaxlocalX;
00089 std::vector<double> _minmaxlocalY;
00090 std::vector<int> _posminmaxlocal;
00091
00092 std::vector<Vector> _intervectorX;
00093 std::vector<Vector> _intervectorY;
00094 std::vector<double> _interpointsX;
00095 std::vector<double> _interpointsY;
00096 int _posA;
00097 int _posB;
00098
00099 double _errorpos;
00100 std::vector<double> _errorvector;
00101
00102 std::vector<Vector> _intervecXX;
00103 std::vector<Vector> _intervecYY;
00104 std::vector<Vector> _interitselfX;
00105 std::vector<Vector> _interitselfY;
00106
00107 int _posn;
00108 std::vector<int> _contIncontpos;
00109
00110 };
00111
00112 #endif // __AutoControlPoints_h_INCLUDED__
00113
00114