comparison Framework/Toolbox/CoordinateSystem3D.h @ 110:53025eecbc95 wasm

renamed SliceGeometry as CoordinateSystem3D
author Sebastien Jodogne <s.jodogne@gmail.com>
date Wed, 14 Jun 2017 15:50:38 +0200
parents Framework/Toolbox/SliceGeometry.h@f244018a4e4b
children 2eca030792aa
comparison
equal deleted inserted replaced
109:53bd9277b025 110:53025eecbc95
1 /**
2 * Stone of Orthanc
3 * Copyright (C) 2012-2016 Sebastien Jodogne, Medical Physics
4 * Department, University Hospital of Liege, Belgium
5 * Copyright (C) 2017 Osimis, Belgium
6 *
7 * This program is free software: you can redistribute it and/or
8 * modify it under the terms of the GNU Affero General Public License
9 * as published by the Free Software Foundation, either version 3 of
10 * the License, or (at your option) any later version.
11 *
12 * This program is distributed in the hope that it will be useful, but
13 * WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 * Affero General Public License for more details.
16 *
17 * You should have received a copy of the GNU Affero General Public License
18 * along with this program. If not, see <http://www.gnu.org/licenses/>.
19 **/
20
21
22 #pragma once
23
24 #include "GeometryToolbox.h"
25 #include "../../Resources/Orthanc/Plugins/Samples/Common/IDicomDataset.h"
26
27 namespace OrthancStone
28 {
29 // Geometry of a 3D plane
30 class CoordinateSystem3D
31 {
32 private:
33 Vector origin_;
34 Vector normal_;
35 Vector axisX_;
36 Vector axisY_;
37
38 void CheckAndComputeNormal();
39
40 void Setup(const std::string& imagePositionPatient,
41 const std::string& imageOrientationPatient);
42
43 void SetupCanonical();
44
45 public:
46 CoordinateSystem3D()
47 {
48 SetupCanonical();
49 }
50
51 CoordinateSystem3D(const Vector& origin,
52 const Vector& axisX,
53 const Vector& axisY);
54
55 CoordinateSystem3D(const OrthancPlugins::IDicomDataset& dicom);
56
57 CoordinateSystem3D(const std::string& imagePositionPatient,
58 const std::string& imageOrientationPatient)
59 {
60 Setup(imagePositionPatient, imageOrientationPatient);
61 }
62
63 const Vector& GetNormal() const
64 {
65 return normal_;
66 }
67
68 const Vector& GetOrigin() const
69 {
70 return origin_;
71 }
72
73 const Vector& GetAxisX() const
74 {
75 return axisX_;
76 }
77
78 const Vector& GetAxisY() const
79 {
80 return axisY_;
81 }
82
83 Vector MapSliceToWorldCoordinates(double x,
84 double y) const;
85
86 double ProjectAlongNormal(const Vector& point) const;
87
88 void ProjectPoint(double& offsetX,
89 double& offsetY,
90 const Vector& point) const;
91 };
92 }