1 /*=========================================================================
6 Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de
7 l'Image). All rights reserved. See Doc/License.txt or
8 http://www.creatis.insa-lyon.fr/Public/Gdcm/License.html for details.
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 notices for more information.
14 =========================================================================*/
16 #ifndef CLITKELLIPSE_H
17 #define CLITKELLIPSE_H
19 #include "clitkCommon.h"
20 #include "clitkSignal.h"
21 #include "itkVector.h"
22 #include <vnl/algo/vnl_generalized_eigensystem.h>
23 #include <vnl/algo/vnl_symmetric_eigensystem.h>
24 #include <vnl/algo/vnl_real_eigensystem.h>
28 //---------------------------------------------------------------------
29 class Ellipse : public itk::Vector<double,6> {
31 typedef itk::Vector<double,2> Vector2d;
32 typedef itk::Vector<double,6> Vector6d;
33 typedef itk::Matrix<double,6,6> Matrix6x6d;
34 typedef itk::Matrix<double,3,3> Matrix3x3d;
37 Ellipse(const Ellipse & e);
38 void InitialiseEllipseFitting(double eta, unsigned int n, clitk::Signal & inputX, clitk::Signal & inputY);
39 double EllipseFittingNextIteration();
40 Vector2d ComputeCenter();
41 Vector2d ComputeSemiAxeLengths();
42 double ComputeAngleInRad();
43 void SetCenterAndSemiAxes(double x0, double y0, double r1, double r2);
44 void Copy(const Vector6d & a);
45 double GetEta() { return mEta; }
46 void UpdateSMatrix(unsigned int begin, unsigned int n,
47 clitk::Signal & inputX, clitk::Signal & inputY);
64 std::vector<Vector6d> z;
65 clitk::Signal * mInputX;
66 clitk::Signal * mInputY;
68 void CopyBlock(Matrix6x6d & out, const Matrix6x6d & in,
69 int ox, int oy, int l, double factor=1.0);
70 void CopyBlock(Matrix6x6d & out, const Matrix3x3d & in,
71 int ox, int oy, double factor=1.0);
72 Matrix3x3d GetBlock3x3(const Matrix6x6d & M, int x, int y);
75 //---------------------------------------------------------------------