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 public:
46 
48  typedef std::vector< C3DCriticalPoint > List;
49 
56 
64  C3DCriticalPoint(const C3DFVector& x0_);
72  C3DCriticalPoint(float x,float y, float z);
73 
79 
84  C3DCriticalPoint& operator = (const C3DCriticalPoint& org);
85 
87  const C3DFVector get_point()const;
88 
90  const C3DFMatrix get_a()const;
91 
93  float get_gamma()const;
94 
96  void set_point(const C3DFVector&);
97 
99  void set_a(const C3DFMatrix&);
100 
101 
106  void set_gamma(float gamma_);
107 
113  C3DFVector at(const C3DFVector& x) const;
114 
121  C3DFVector at_alt(const C3DFVector& x) const;
122 
126  bool operator ==(const C3DCriticalPoint& cp) const;
127 #ifdef UGLY_HACK
128  bool operator < (const C3DCriticalPoint& cp) const;
129 #endif
130 
131 
132 private:
133  float gamma;
134  C3DFVector x0;
135  C3DFMatrix A;
136 };
137 
140 
141 
150 
151 
153  C3DFVector location;
154 
155 
157  C3DFMatrix portrait;
158 
160  float eval1;
162  float eval2;
164  float eval3;
165 
167  T3DCVector<float> evec1;
168 
170  T3DCVector<float> evec2;
171 
173  T3DCVector<float> evec3;
174 
175 public:
177  enum EVType {ev_zero,
181  ev_complex };
187 
192  C3DCriticalPointEigen(const C3DFVector& l, const C3DFMatrix& m);
193 
205  C3DCriticalPointEigen(const C3DFVector& location_,
206  const C3DFMatrix& portrait_,
207  float eval1,float eval2,float eval3,
208  const C3DFVector& evec1,const C3DFVector& evec2, const C3DFVector& evec3,
209  EVType type);
210 
211 
213  EVType get_type()const;
214 
216  float get_eval1()const;
220  float get_eval2()const;
224  float get_eval3()const;
225 
229  float get_real_eval2()const;
233  float get_real_eval3()const;
234 
238  std::complex<float> get_complex_eval2()const;
239 
243  std::complex<float> get_complex_eval3()const;
244 
247  const C3DFMatrix get_portrait()const;
248 
251  const C3DFVector get_location()const;
252 
255  const C3DFVector get_evect1()const;
256 
261  const C3DFVector get_real_evect2()const;
262  const C3DFVector get_real_evect3()const;
263  const T3DCVector<float> get_complex_evect2()const;
264  const T3DCVector<float> get_complex_evect3()const;
265 
266 
267 private:
268  EVType type;
269  bool estimate();
270 };
271 
272 typedef std::vector< C3DCriticalPointEigen > C3DCriticalPointEigenList;
273 
275 {
276  return type;
277 }
279 {
280  return eval1;
281 }
283 {
284  return eval2;
285 }
287 {
288  return eval3;
289 }
290 
292 {
293  assert(type != ev_complex);
294  return eval2;
295 }
297 {
298  assert(type != ev_complex);
299  return eval3;
300 }
301 inline std::complex<float> C3DCriticalPointEigen::get_complex_eval2()const
302 {
303  assert(type == ev_complex);
304  return std::complex<float>(eval2,eval3);
305 }
306 inline std::complex<float> C3DCriticalPointEigen::get_complex_eval3()const
307 {
308  assert(type == ev_complex);
309  return std::complex<float>(eval2,eval3);
310 }
311 
313 {
314  return C3DFVector(evec1.x.real(), evec1.y.real(), evec1.z.real());
315 }
317 {
318  assert(type != ev_complex);
319  return C3DFVector(evec2.x.real(), evec2.y.real(), evec2.z.real());
320 }
322 {
323  assert(type != ev_complex);
324  return C3DFVector(evec3.x.real(), evec3.y.real(), evec3.z.real()); ;
325 }
327 {
328  assert(type == ev_complex);
329  return evec2;
330 }
332 {
333  assert(type == ev_complex);
334  return evec3;
335 }
336 
338 {
339  return location;
340 }
341 
342 
344 {
345  return portrait;
346 }
347 
348 
349 //template implementation
350 
351 
353 {
354  return x0;
355 }
356 
358 {
359  return A;
360 }
361 
362 
364 {
365  x0 = x;
366 }
367 
368 inline void C3DCriticalPoint::set_a(const C3DFMatrix& a)
369 {
370  A = a;
371 }
372 
373 
374 inline float C3DCriticalPoint::get_gamma()const
375 {
376  return gamma;
377 }
378 
379 inline void C3DCriticalPoint::set_gamma(float _gamma)
380 {
381  gamma = _gamma;
382 }
383 
384 
386 {
387  return gamma==cp.gamma && A == cp.A && x0 == cp.x0;
388 }
389 
390 #ifdef UGLY_HACK
392 {
393  // we shouldn't need this ...
394  return x0 < cp.x0;
395 }
396 #endif
397 
398 #endif
399 
const C3DFVector get_real_evect3() const
const C3DFVector get_real_evect2() const
bool operator<(const C3DCriticalPoint &cp) const
EVType
types of critical points
float get_real_eval3() const
bool operator==(const CAttribute &a, const CAttribute &b)
Definition: attributes.hh:93
const C3DFMatrix get_portrait() const
bool operator==(const C3DCriticalPoint &cp) const
A class to hold a critical point. This class holds a critical point in a 3D vector field It consists ...
float get_real_eval2() const
const T3DCVector< float > get_complex_evect2() const
std::complex< float > get_complex_eval2() const
EVType get_type() const
T3DVector< float > C3DFVector
A float 3D Vector.
Definition: 3d/vector.hh:346
#define NS_MIA_BEGIN
conveniance define to start the mia namespace
Definition: defines.hh:33
float get_gamma() const
bool operator<(const T2DVector< T > &a, const T2DVector< S > &b)
Definition: 2d/vector.hh:453
const C3DFVector get_point() const
#define EXPORT_3D
Definition: defines3d.hh:44
const C3DFVector get_evect1() const
void set_gamma(float gamma_)
const T3DCVector< float > get_complex_evect3() const
C3DCriticalPoint::List C3DCriticalPointList
typedef for convinience
const C3DFMatrix get_a() const
void set_point(const C3DFVector &)
std::vector< C3DCriticalPointEigen > C3DCriticalPointEigenList
const C3DFVector get_location() const
A class to hold a criticalpoint with eigenvalues and eigenvectors.
void set_a(const C3DFMatrix &)
std::complex< float > get_complex_eval3() const
std::vector< C3DCriticalPoint > List
A list of critical points.
#define NS_MIA_END
conveniance define to end the mia namespace
Definition: defines.hh:36