1 /*=========================================================================
4 Module: $RCSfile: clitkTrajectory2D.h,v $
6 Date: $Date: 2010/03/03 12:41:27 $
7 Version: $Revision: 1.1 $
9 Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de
10 l'Image). All rights reserved. See Doc/License.txt or
11 http://www.creatis.insa-lyon.fr/Public/Gdcm/License.html for details.
13 This software is distributed WITHOUT ANY WARRANTY; without even
14 the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
15 PURPOSE. See the above copyright notices for more information.
17 =========================================================================*/
19 #ifndef CLITKTRAJECTORY2D_H
20 #define CLITKTRAJECTORY2D_H
22 #include "clitkCommon.h"
23 #include "clitkSignal.h"
24 #include "itkVector.h"
25 #include <vnl/algo/vnl_generalized_eigensystem.h>
26 #include <vnl/algo/vnl_symmetric_eigensystem.h>
27 #include <vnl/algo/vnl_real_eigensystem.h>
31 //---------------------------------------------------------------------
34 typedef itk::Vector<double,2> Vector2d;
36 void ResampleWithTimeWarpTo(int begin, int end, Trajectory2D & output) const;
37 void ResampleWithTimeWarpTo(Trajectory2D & output) const;
40 bool Read(std::string filename);
42 void GetPoint(const int index, Vector2d & p);
43 void GetMean(Vector2d & m);
44 double GetU(const int index) const { return mU[index]; }
45 double GetV(const int index) const { return mV[index]; }
46 clitk::Signal & GetU() { return mU; }
47 clitk::Signal & GetV() { return mV; }
49 int size() const { return mU.size(); }
50 void resize(int n) { mU.resize(n); mV.resize(n); }
52 void SetPoint(const int i, Vector2d & p) { mU[i] = p[0]; mV[i] = p[1]; }
53 void SetPoint(const int i, double u, double v) { mU[i] = u; mV[i] = v; }
54 void GetValueAtLin(double t, Vector2d & p) const;
56 double GetSamplingPeriod() const { return mU.GetSamplingPeriod(); }
57 void SetSamplingPeriod(double sp){ mU.SetSamplingPeriod(sp); mV.SetSamplingPeriod(sp); }
58 double DistanceTo(int delta, const clitk::Trajectory2D & B) const;
60 Trajectory2D & operator+(Trajectory2D & d);
61 Trajectory2D & operator-(Trajectory2D & d);
63 void Print(const std::string & name) const;
64 void Print(const std::string & name, int begin, int end) const;
66 void push_back(double u, double v) { mU.push_back(u); mV.push_back(v); }
67 void Substract(const Vector2d & m);
68 double GetTotalTimeDuration() const { return mU.GetTotalTimeDuration(); }
75 //---------------------------------------------------------------------