My Project
critical_point.hh
Go to the documentation of this file.
1/* -*- mia-c++ -*-
2 *
3 * This file is part of MIA - a toolbox for medical image analysis
4 * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
5 *
6 * MIA is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 3 of the License, or
9 * (at your option) any later version.
10 *
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License
17 * along with MIA; if not, see <http://www.gnu.org/licenses/>.
18 *
19 */
20
21#ifndef __mia_3d_criticalpoint_h
22#define __mia_3d_criticalpoint_h
23
24#include <list>
25
26#include <mia/3d/matrix.hh>
27
29
45{
46public:
47
49 typedef std::vector< C3DCriticalPoint > List;
50
57
73 C3DCriticalPoint(float x, float y, float z);
74
80
85 C3DCriticalPoint& operator = (const C3DCriticalPoint& org);
86
88 const C3DFVector get_point()const;
89
91 const C3DFMatrix get_a()const;
92
94 float get_gamma()const;
95
97 void set_point(const C3DFVector&);
98
100 void set_a(const C3DFMatrix&);
101
102
107 void set_gamma(float gamma_);
108
114 C3DFVector at(const C3DFVector& x) const;
115
122 C3DFVector at_alt(const C3DFVector& x) const;
123
127 bool operator ==(const C3DCriticalPoint& cp) const;
128#ifdef UGLY_HACK
129 bool operator < (const C3DCriticalPoint& cp) const;
130#endif
131
132
133private:
134 float gamma;
135 C3DFVector x0;
136 C3DFMatrix A;
137};
138
141
142
151{
152
153
155 C3DFVector location;
156
157
159 C3DFMatrix portrait;
160
162 float eval1;
164 float eval2;
166 float eval3;
167
169 T3DCVector<float> evec1;
170
172 T3DCVector<float> evec2;
173
175 T3DCVector<float> evec3;
176
177public:
183 ev_complex
184 };
190
196
209 const C3DFMatrix& portrait_,
210 float eval1, float eval2, float eval3,
211 const C3DFVector& evec1, const C3DFVector& evec2, const C3DFVector& evec3,
212 EVType type);
213
214
216 EVType get_type()const;
217
219 float get_eval1()const;
223 float get_eval2()const;
227 float get_eval3()const;
228
232 float get_real_eval2()const;
236 float get_real_eval3()const;
237
241 std::complex<float> get_complex_eval2()const;
242
246 std::complex<float> get_complex_eval3()const;
247
250 const C3DFMatrix get_portrait()const;
251
254 const C3DFVector get_location()const;
255
258 const C3DFVector get_evect1()const;
259
264 const C3DFVector get_real_evect2()const;
265 const C3DFVector get_real_evect3()const;
266 const T3DCVector<float> get_complex_evect2()const;
267 const T3DCVector<float> get_complex_evect3()const;
268
269
270private:
271 EVType type;
272 bool estimate();
273};
274
275typedef std::vector< C3DCriticalPointEigen > C3DCriticalPointEigenList;
276
278{
279 return type;
280}
282{
283 return eval1;
284}
286{
287 return eval2;
288}
290{
291 return eval3;
292}
293
295{
296 assert(type != ev_complex);
297 return eval2;
298}
300{
301 assert(type != ev_complex);
302 return eval3;
303}
304inline std::complex<float> C3DCriticalPointEigen::get_complex_eval2()const
305{
306 assert(type == ev_complex);
307 return std::complex<float>(eval2, eval3);
308}
309inline std::complex<float> C3DCriticalPointEigen::get_complex_eval3()const
310{
311 assert(type == ev_complex);
312 return std::complex<float>(eval2, eval3);
313}
314
316{
317 return C3DFVector(evec1.x.real(), evec1.y.real(), evec1.z.real());
318}
320{
321 assert(type != ev_complex);
322 return C3DFVector(evec2.x.real(), evec2.y.real(), evec2.z.real());
323}
325{
326 assert(type != ev_complex);
327 return C3DFVector(evec3.x.real(), evec3.y.real(), evec3.z.real()); ;
328}
330{
331 assert(type == ev_complex);
332 return evec2;
333}
335{
336 assert(type == ev_complex);
337 return evec3;
338}
339
341{
342 return location;
343}
344
345
347{
348 return portrait;
349}
350
351
352//template implementation
353
354
356{
357 return x0;
358}
359
361{
362 return A;
363}
364
365
367{
368 x0 = x;
369}
370
372{
373 A = a;
374}
375
376
378{
379 return gamma;
380}
381
382inline void C3DCriticalPoint::set_gamma(float _gamma)
383{
384 gamma = _gamma;
385}
386
387
389{
390 return gamma == cp.gamma && A == cp.A && x0 == cp.x0;
391}
392
393#ifdef UGLY_HACK
394inline bool C3DCriticalPoint::operator < (const C3DCriticalPoint& cp) const
395{
396 // we shouldn't need this ...
397 return x0 < cp.x0;
398}
399#endif
400
401#endif
402
bool operator<(const T2DVector< T > &a, const T2DVector< S > &b)
Definition 2d/vector.hh:495
T3DVector< float > C3DFVector
A float 3D Vector.
Definition 3d/vector.hh:409
bool operator==(const CAttribute &a, const CAttribute &b)
Definition attributes.hh:95
A class to hold a criticalpoint with eigenvalues and eigenvectors.
C3DCriticalPointEigen(C3DCriticalPoint cp)
float get_real_eval2() const
const C3DFVector get_evect1() const
const C3DFVector get_real_evect3() const
EVType
types of critical points
const T3DCVector< float > get_complex_evect2() const
const C3DFVector get_real_evect2() const
float get_real_eval3() const
C3DCriticalPointEigen(const C3DFVector &location_, const C3DFMatrix &portrait_, float eval1, float eval2, float eval3, const C3DFVector &evec1, const C3DFVector &evec2, const C3DFVector &evec3, EVType type)
std::complex< float > get_complex_eval2() const
std::complex< float > get_complex_eval3() const
const C3DFMatrix get_portrait() const
C3DCriticalPointEigen(const C3DFVector &l, const C3DFMatrix &m)
const T3DCVector< float > get_complex_evect3() const
const C3DFVector get_location() const
A class to hold a critical point. This class holds a critical point in a 3D vector field It consists ...
bool operator==(const C3DCriticalPoint &cp) const
C3DCriticalPoint(const C3DFVector &x0_)
C3DCriticalPoint(float x, float y, float z)
float get_gamma() const
std::vector< C3DCriticalPoint > List
A list of critical points.
const C3DFMatrix get_a() const
C3DFVector at(const C3DFVector &x) const
const C3DFVector get_point() const
void set_point(const C3DFVector &)
C3DCriticalPoint(const C3DCriticalPoint &org)
void set_a(const C3DFMatrix &)
C3DFVector at_alt(const C3DFVector &x) const
void set_gamma(float gamma_)
C3DCriticalPoint::List C3DCriticalPointList
typedef for convinience
std::vector< C3DCriticalPointEigen > C3DCriticalPointEigenList
#define EXPORT_3D
Definition defines3d.hh:45
#define NS_MIA_BEGIN
conveniance define to start the mia namespace
Definition defines.hh:33
#define NS_MIA_END
conveniance define to end the mia namespace
Definition defines.hh:36