Mercurial > hg > orthanc-stone
annotate Framework/Toolbox/CoordinateSystem3D.h @ 151:c5044bbfc303 wasm
CoordinateSystem3D::IntersectSegment()
author | Sebastien Jodogne <s.jodogne@gmail.com> |
---|---|
date | Thu, 01 Feb 2018 17:37:03 +0100 |
parents | e2fe9352f240 |
children | 2e023be0563c |
rev | line source |
---|---|
0 | 1 /** |
2 * Stone of Orthanc | |
3 * Copyright (C) 2012-2016 Sebastien Jodogne, Medical Physics | |
4 * Department, University Hospital of Liege, Belgium | |
135
e2fe9352f240
upgrade to year 2018
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
122
diff
changeset
|
5 * Copyright (C) 2017-2018 Osimis S.A., Belgium |
0 | 6 * |
7 * This program is free software: you can redistribute it and/or | |
47 | 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. | |
0 | 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 | |
47 | 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 | |
0 | 18 * along with this program. If not, see <http://www.gnu.org/licenses/>. |
19 **/ | |
20 | |
21 | |
22 #pragma once | |
23 | |
32 | 24 #include "GeometryToolbox.h" |
113
2eca030792aa
using the Orthanc Framework
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
110
diff
changeset
|
25 |
2eca030792aa
using the Orthanc Framework
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
110
diff
changeset
|
26 #include <Plugins/Samples/Common/IDicomDataset.h> |
0 | 27 |
28 namespace OrthancStone | |
29 { | |
53
c2dc924f1a63
removing threading out of the framework
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
47
diff
changeset
|
30 // Geometry of a 3D plane |
110
53025eecbc95
renamed SliceGeometry as CoordinateSystem3D
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
89
diff
changeset
|
31 class CoordinateSystem3D |
0 | 32 { |
33 private: | |
34 Vector origin_; | |
35 Vector normal_; | |
36 Vector axisX_; | |
37 Vector axisY_; | |
38 | |
39 void CheckAndComputeNormal(); | |
40 | |
41 void Setup(const std::string& imagePositionPatient, | |
42 const std::string& imageOrientationPatient); | |
43 | |
44 void SetupCanonical(); | |
45 | |
46 public: | |
110
53025eecbc95
renamed SliceGeometry as CoordinateSystem3D
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
89
diff
changeset
|
47 CoordinateSystem3D() |
0 | 48 { |
49 SetupCanonical(); | |
50 } | |
51 | |
110
53025eecbc95
renamed SliceGeometry as CoordinateSystem3D
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
89
diff
changeset
|
52 CoordinateSystem3D(const Vector& origin, |
53025eecbc95
renamed SliceGeometry as CoordinateSystem3D
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
89
diff
changeset
|
53 const Vector& axisX, |
53025eecbc95
renamed SliceGeometry as CoordinateSystem3D
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
89
diff
changeset
|
54 const Vector& axisY); |
0 | 55 |
110
53025eecbc95
renamed SliceGeometry as CoordinateSystem3D
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
89
diff
changeset
|
56 CoordinateSystem3D(const OrthancPlugins::IDicomDataset& dicom); |
0 | 57 |
110
53025eecbc95
renamed SliceGeometry as CoordinateSystem3D
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
89
diff
changeset
|
58 CoordinateSystem3D(const std::string& imagePositionPatient, |
53025eecbc95
renamed SliceGeometry as CoordinateSystem3D
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
89
diff
changeset
|
59 const std::string& imageOrientationPatient) |
0 | 60 { |
61 Setup(imagePositionPatient, imageOrientationPatient); | |
62 } | |
63 | |
122
e3433dabfb8d
refactoring DicomStructureSet
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
113
diff
changeset
|
64 CoordinateSystem3D(const Orthanc::DicomMap& dicom); |
e3433dabfb8d
refactoring DicomStructureSet
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
113
diff
changeset
|
65 |
0 | 66 const Vector& GetNormal() const |
67 { | |
68 return normal_; | |
69 } | |
70 | |
71 const Vector& GetOrigin() const | |
72 { | |
73 return origin_; | |
74 } | |
75 | |
76 const Vector& GetAxisX() const | |
77 { | |
78 return axisX_; | |
79 } | |
80 | |
81 const Vector& GetAxisY() const | |
82 { | |
83 return axisY_; | |
84 } | |
85 | |
86 Vector MapSliceToWorldCoordinates(double x, | |
87 double y) const; | |
88 | |
89 double ProjectAlongNormal(const Vector& point) const; | |
90 | |
91 void ProjectPoint(double& offsetX, | |
92 double& offsetY, | |
93 const Vector& point) const; | |
151
c5044bbfc303
CoordinateSystem3D::IntersectSegment()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
135
diff
changeset
|
94 |
c5044bbfc303
CoordinateSystem3D::IntersectSegment()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
135
diff
changeset
|
95 bool IntersectSegment(double& x, |
c5044bbfc303
CoordinateSystem3D::IntersectSegment()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
135
diff
changeset
|
96 double& y, |
c5044bbfc303
CoordinateSystem3D::IntersectSegment()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
135
diff
changeset
|
97 const Vector& edgeFrom, |
c5044bbfc303
CoordinateSystem3D::IntersectSegment()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
135
diff
changeset
|
98 const Vector& edgeTo) const; |
0 | 99 }; |
100 } |