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 {
46 public:
47 
49  typedef std::vector< C3DCriticalPoint > List;
50 
57 
65  C3DCriticalPoint(const C3DFVector& x0_);
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 
133 private:
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 
177 public:
179  enum EVType {ev_zero,
183  ev_complex
184  };
190 
195  C3DCriticalPointEigen(const C3DFVector& l, const C3DFMatrix& m);
196 
208  C3DCriticalPointEigen(const C3DFVector& location_,
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 
270 private:
271  EVType type;
272  bool estimate();
273 };
274 
275 typedef 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 }
304 inline std::complex<float> C3DCriticalPointEigen::get_complex_eval2()const
305 {
306  assert(type == ev_complex);
307  return std::complex<float>(eval2, eval3);
308 }
309 inline 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 
371 inline void C3DCriticalPoint::set_a(const C3DFMatrix& a)
372 {
373  A = a;
374 }
375 
376 
377 inline float C3DCriticalPoint::get_gamma()const
378 {
379  return gamma;
380 }
381 
382 inline 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
395 {
396  // we shouldn't need this ...
397  return x0 < cp.x0;
398 }
399 #endif
400 
401 #endif
402 
C3DCriticalPointEigen::ev_real_two_equal
@ ev_real_two_equal
Definition: critical_point.hh:181
T3DMatrix< float >
C3DCriticalPointEigen::get_eval2
float get_eval2() const
Definition: critical_point.hh:285
C3DCriticalPoint::set_point
void set_point(const C3DFVector &)
Definition: critical_point.hh:366
C3DCriticalPointEigen::get_portrait
const C3DFMatrix get_portrait() const
Definition: critical_point.hh:346
C3DCriticalPointEigen::get_real_evect2
const C3DFVector get_real_evect2() const
Definition: critical_point.hh:319
NS_MIA_BEGIN
#define NS_MIA_BEGIN
conveniance define to start the mia namespace
Definition: defines.hh:33
C3DCriticalPointEigen::get_evect1
const C3DFVector get_evect1() const
Definition: critical_point.hh:315
C3DCriticalPointEigen::ev_complex
@ ev_complex
Definition: critical_point.hh:183
C3DCriticalPointEigen::get_complex_evect2
const T3DCVector< float > get_complex_evect2() const
Definition: critical_point.hh:329
C3DCriticalPoint::List
std::vector< C3DCriticalPoint > List
A list of critical points.
Definition: critical_point.hh:49
C3DCriticalPointEigenList
std::vector< C3DCriticalPointEigen > C3DCriticalPointEigenList
Definition: critical_point.hh:275
NS_MIA_END
#define NS_MIA_END
conveniance define to end the mia namespace
Definition: defines.hh:36
C3DCriticalPoint::set_a
void set_a(const C3DFMatrix &)
Definition: critical_point.hh:371
C3DCriticalPointEigen::get_real_eval3
float get_real_eval3() const
Definition: critical_point.hh:299
C3DCriticalPointEigen::get_real_evect3
const C3DFVector get_real_evect3() const
Definition: critical_point.hh:324
C3DCriticalPointEigen::get_complex_eval3
std::complex< float > get_complex_eval3() const
Definition: critical_point.hh:309
operator<
bool operator<(const T2DVector< T > &a, const T2DVector< S > &b)
Definition: 2d/vector.hh:495
operator==
bool operator==(const CAttribute &a, const CAttribute &b)
Definition: attributes.hh:95
EXPORT_3D
#define EXPORT_3D
Definition: defines3d.hh:45
C3DCriticalPointEigen::EVType
EVType
types of critical points
Definition: critical_point.hh:179
matrix.hh
C3DCriticalPointList
C3DCriticalPoint::List C3DCriticalPointList
typedef for convinience
Definition: critical_point.hh:140
C3DFVector
T3DVector< float > C3DFVector
A float 3D Vector.
Definition: 3d/vector.hh:409
C3DCriticalPoint
A class to hold a critical point. This class holds a critical point in a 3D vector field It consists ...
Definition: critical_point.hh:44
C3DCriticalPointEigen::get_real_eval2
float get_real_eval2() const
Definition: critical_point.hh:294
C3DCriticalPointEigen::get_complex_eval2
std::complex< float > get_complex_eval2() const
Definition: critical_point.hh:304
C3DCriticalPoint::operator<
bool operator<(const C3DCriticalPoint &cp) const
Definition: critical_point.hh:394
C3DCriticalPoint::get_gamma
float get_gamma() const
Definition: critical_point.hh:377
C3DCriticalPoint::get_point
const C3DFVector get_point() const
Definition: critical_point.hh:355
C3DCriticalPointEigen::get_eval3
float get_eval3() const
Definition: critical_point.hh:289
C3DCriticalPointEigen::get_location
const C3DFVector get_location() const
Definition: critical_point.hh:340
C3DCriticalPointEigen::get_type
EVType get_type() const
Definition: critical_point.hh:277
C3DCriticalPoint::operator==
bool operator==(const C3DCriticalPoint &cp) const
Definition: critical_point.hh:388
C3DCriticalPointEigen
A class to hold a criticalpoint with eigenvalues and eigenvectors.
Definition: critical_point.hh:150
C3DCriticalPointEigen::ev_real
@ ev_real
Definition: critical_point.hh:180
C3DCriticalPoint::get_a
const C3DFMatrix get_a() const
Definition: critical_point.hh:360
T3DVector< float >
C3DCriticalPointEigen::get_eval1
float get_eval1() const
Definition: critical_point.hh:281
C3DCriticalPointEigen::get_complex_evect3
const T3DCVector< float > get_complex_evect3() const
Definition: critical_point.hh:334
C3DCriticalPointEigen::ev_real_three_equal
@ ev_real_three_equal
Definition: critical_point.hh:182
C3DCriticalPoint::set_gamma
void set_gamma(float gamma_)
Definition: critical_point.hh:382