MeVisLab Toolbox Reference
mlDisc.h
Go to the documentation of this file.
1/*************************************************************************************
2**
3** Copyright 2007, MeVis Medical Solutions AG
4**
5** The user may use this file in accordance with the license agreement provided with
6** the Software or, alternatively, in accordance with the terms contained in a
7** written agreement between the user and MeVis Medical Solutions AG.
8**
9** For further information use the contact form at https://www.mevislab.de/contact
10**
11**************************************************************************************/
12
13#ifndef ML_DISC_H
14#define ML_DISC_H
15
16
18
19#include "MLToolsSystem.h"
20#include "mlModuleIncludes.h"
21#include "mlPlane.h"
22#include "mlTVirtualVolume.h"
23
24ML_START_NAMESPACE
25
27 class Line;
28
29 //----------------------------------------------------------------------------------
32 //----------------------------------------------------------------------------------
34 {
35 public:
38
40 Disc(const Vector3 &c, const Vector3 &n, double r);
41
43 inline void setValue(const Vector3 &c, const Vector3 &n, double r)
44 { _center = c; _radius = r; setNormal(n); }
45
47 inline void setCenter(const Vector3 &c) { _center = c; }
48
51 bool setNormal(const Vector3 &n);
52
54 inline void setRadius(double r) { _radius = r; }
55
57 inline const Vector3 &getCenter() const { return _center; }
58
60 inline const Vector3 &getNormal() const { return _normal; }
61
63 inline double getRadius() const { return _radius; }
64
66 inline bool project(const Vector3 &p, Vector3 &proj) const
67 { proj = getPlane().getClosestPoint(p); return (proj - _center).length() <= _radius; }
68
70 inline bool intersect(const Line &l, Vector3 &cut) const
71 { return getPlane().intersect(l, cut); }
72
74 inline Plane getPlane() const
75 { return Plane(_normal, _center); }
76
79 void getBoundingBox(const Matrix4 &transform, Vector3 &boxMin, Vector3 &boxMax) const;
80
85
89 void fill(const MedicalImageProperties &pImg, SubImage &destImg, double fillVal) const;
90
94 void fill(const MedicalImageProperties &pImg, VirtualVolume &destImg, double fillVal) const;
95
96 private:
97
99 Vector3 _center;
100
102 Vector3 _normal;
103
105 double _radius;
106 };
107
108ML_END_NAMESPACE
109
110#endif // __mlDisc_H
111
#define MLTOOLS_EXPORT
void setCenter(const Vector3 &c)
Set center.
Definition mlDisc.h:47
double getRadius() const
Get radius.
Definition mlDisc.h:63
SubImageBox getBoundingBox(const MedicalImageProperties &pImg) const
void setRadius(double r)
Set radius.
Definition mlDisc.h:54
void getBoundingBox(const Matrix4 &transform, Vector3 &boxMin, Vector3 &boxMax) const
void fill(const MedicalImageProperties &pImg, SubImage &destImg, double fillVal) const
const Vector3 & getCenter() const
Get center.
Definition mlDisc.h:57
bool intersect(const Line &l, Vector3 &cut) const
Intersects line l with disc plane, true if cut point exists, no radius check.
Definition mlDisc.h:70
bool setNormal(const Vector3 &n)
void fill(const MedicalImageProperties &pImg, VirtualVolume &destImg, double fillVal) const
void setValue(const Vector3 &c, const Vector3 &n, double r)
Initialize disc parameters (used by constructor).
Definition mlDisc.h:43
Disc()
Constructor. Default state is center at (0,0,0), normal (1,0,0) and radius 0.
bool project(const Vector3 &p, Vector3 &proj) const
Project p to disc plane, return true if projected point lies on disc.
Definition mlDisc.h:66
Disc(const Vector3 &c, const Vector3 &n, double r)
Convenience constructor.
Plane getPlane() const
Get Plane object in which disc is located.
Definition mlDisc.h:74
const Vector3 & getNormal() const
Get normal.
Definition mlDisc.h:60
Class defining a plane in 3D.
Definition mlPlane.h:30
Tmat4< MLdouble > Matrix4
The standard 4x4 matrix of type double.
Definition mlMatrix4.h:713
Tvec3< MLdouble > Vector3
A vector with three components of type double.
Definition mlVector3.h:286
TSubImageBox< MLint > SubImageBox
Defines the standard SubImageBox type used in the ML. Its size varies with the size of the MLint type...