annotate Framework/StoneEnumerations.cpp @ 448:cc47e6eaefb0 bgo-commands-codegen

Fixed dummy change
author bgo-osimis
date Wed, 16 Jan 2019 21:08:38 +0100
parents b70e9be013e4
children 77a21b28becd
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
117
42c05a3baee3 loading multi-frame instances as 3D volumes
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1 /**
42c05a3baee3 loading multi-frame instances as 3D volumes
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2 * Stone of Orthanc
42c05a3baee3 loading multi-frame instances as 3D volumes
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3 * Copyright (C) 2012-2016 Sebastien Jodogne, Medical Physics
42c05a3baee3 loading multi-frame instances as 3D volumes
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4 * Department, University Hospital of Liege, Belgium
439
b70e9be013e4 preparing for 2019
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 366
diff changeset
5 * Copyright (C) 2017-2019 Osimis S.A., Belgium
117
42c05a3baee3 loading multi-frame instances as 3D volumes
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6 *
42c05a3baee3 loading multi-frame instances as 3D volumes
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7 * This program is free software: you can redistribute it and/or
42c05a3baee3 loading multi-frame instances as 3D volumes
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8 * modify it under the terms of the GNU Affero General Public License
42c05a3baee3 loading multi-frame instances as 3D volumes
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
9 * as published by the Free Software Foundation, either version 3 of
42c05a3baee3 loading multi-frame instances as 3D volumes
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
10 * the License, or (at your option) any later version.
42c05a3baee3 loading multi-frame instances as 3D volumes
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
11 *
42c05a3baee3 loading multi-frame instances as 3D volumes
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
12 * This program is distributed in the hope that it will be useful, but
42c05a3baee3 loading multi-frame instances as 3D volumes
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
13 * WITHOUT ANY WARRANTY; without even the implied warranty of
42c05a3baee3 loading multi-frame instances as 3D volumes
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
42c05a3baee3 loading multi-frame instances as 3D volumes
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
15 * Affero General Public License for more details.
42c05a3baee3 loading multi-frame instances as 3D volumes
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
16 *
42c05a3baee3 loading multi-frame instances as 3D volumes
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
17 * You should have received a copy of the GNU Affero General Public License
42c05a3baee3 loading multi-frame instances as 3D volumes
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
18 * along with this program. If not, see <http://www.gnu.org/licenses/>.
42c05a3baee3 loading multi-frame instances as 3D volumes
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
19 **/
42c05a3baee3 loading multi-frame instances as 3D volumes
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
20
42c05a3baee3 loading multi-frame instances as 3D volumes
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
21
194
7a031ac16b2d rename Enumerations.h to StoneEnumerations.h to avoid clashes with Orthanc
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 174
diff changeset
22 #include "StoneEnumerations.h"
117
42c05a3baee3 loading multi-frame instances as 3D volumes
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
23
212
5412adf19980 resort to OrthancFramework
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 201
diff changeset
24 #include <Core/Logging.h>
5412adf19980 resort to OrthancFramework
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 201
diff changeset
25 #include <Core/OrthancException.h>
5412adf19980 resort to OrthancFramework
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 201
diff changeset
26 #include <Core/Toolbox.h>
117
42c05a3baee3 loading multi-frame instances as 3D volumes
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
27
42c05a3baee3 loading multi-frame instances as 3D volumes
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
28 namespace OrthancStone
42c05a3baee3 loading multi-frame instances as 3D volumes
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
29 {
42c05a3baee3 loading multi-frame instances as 3D volumes
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
30 bool StringToSopClassUid(SopClassUid& result,
42c05a3baee3 loading multi-frame instances as 3D volumes
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
31 const std::string& source)
42c05a3baee3 loading multi-frame instances as 3D volumes
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
32 {
174
a7674c0ae4ac fix captain rt-dose
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 142
diff changeset
33 std::string s = Orthanc::Toolbox::StripSpaces(source);
a7674c0ae4ac fix captain rt-dose
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 142
diff changeset
34
a7674c0ae4ac fix captain rt-dose
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 142
diff changeset
35 if (s == "1.2.840.10008.5.1.4.1.1.481.2")
117
42c05a3baee3 loading multi-frame instances as 3D volumes
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
36 {
42c05a3baee3 loading multi-frame instances as 3D volumes
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
37 result = SopClassUid_RTDose;
42c05a3baee3 loading multi-frame instances as 3D volumes
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
38 return true;
42c05a3baee3 loading multi-frame instances as 3D volumes
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
39 }
42c05a3baee3 loading multi-frame instances as 3D volumes
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
40 else
42c05a3baee3 loading multi-frame instances as 3D volumes
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
41 {
42c05a3baee3 loading multi-frame instances as 3D volumes
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
42 //LOG(INFO) << "Unknown SOP class UID: " << source;
42c05a3baee3 loading multi-frame instances as 3D volumes
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
43 return false;
42c05a3baee3 loading multi-frame instances as 3D volumes
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
44 }
42c05a3baee3 loading multi-frame instances as 3D volumes
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
45 }
142
f19194a11c1d ComputeWindowing in Enumerations.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 135
diff changeset
46
f19194a11c1d ComputeWindowing in Enumerations.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 135
diff changeset
47
f19194a11c1d ComputeWindowing in Enumerations.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 135
diff changeset
48 void ComputeWindowing(float& targetCenter,
f19194a11c1d ComputeWindowing in Enumerations.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 135
diff changeset
49 float& targetWidth,
f19194a11c1d ComputeWindowing in Enumerations.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 135
diff changeset
50 ImageWindowing windowing,
f19194a11c1d ComputeWindowing in Enumerations.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 135
diff changeset
51 float defaultCenter,
f19194a11c1d ComputeWindowing in Enumerations.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 135
diff changeset
52 float defaultWidth)
f19194a11c1d ComputeWindowing in Enumerations.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 135
diff changeset
53 {
f19194a11c1d ComputeWindowing in Enumerations.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 135
diff changeset
54 switch (windowing)
f19194a11c1d ComputeWindowing in Enumerations.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 135
diff changeset
55 {
f19194a11c1d ComputeWindowing in Enumerations.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 135
diff changeset
56 case ImageWindowing_Default:
f19194a11c1d ComputeWindowing in Enumerations.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 135
diff changeset
57 targetCenter = defaultCenter;
f19194a11c1d ComputeWindowing in Enumerations.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 135
diff changeset
58 targetWidth = defaultWidth;
f19194a11c1d ComputeWindowing in Enumerations.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 135
diff changeset
59 break;
f19194a11c1d ComputeWindowing in Enumerations.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 135
diff changeset
60
f19194a11c1d ComputeWindowing in Enumerations.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 135
diff changeset
61 case ImageWindowing_Bone:
f19194a11c1d ComputeWindowing in Enumerations.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 135
diff changeset
62 targetCenter = 300;
f19194a11c1d ComputeWindowing in Enumerations.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 135
diff changeset
63 targetWidth = 2000;
f19194a11c1d ComputeWindowing in Enumerations.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 135
diff changeset
64 break;
f19194a11c1d ComputeWindowing in Enumerations.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 135
diff changeset
65
f19194a11c1d ComputeWindowing in Enumerations.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 135
diff changeset
66 case ImageWindowing_Lung:
f19194a11c1d ComputeWindowing in Enumerations.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 135
diff changeset
67 targetCenter = -600;
f19194a11c1d ComputeWindowing in Enumerations.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 135
diff changeset
68 targetWidth = 1600;
f19194a11c1d ComputeWindowing in Enumerations.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 135
diff changeset
69 break;
f19194a11c1d ComputeWindowing in Enumerations.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 135
diff changeset
70
f19194a11c1d ComputeWindowing in Enumerations.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 135
diff changeset
71 default:
f19194a11c1d ComputeWindowing in Enumerations.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 135
diff changeset
72 throw Orthanc::OrthancException(Orthanc::ErrorCode_ParameterOutOfRange);
f19194a11c1d ComputeWindowing in Enumerations.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 135
diff changeset
73 }
f19194a11c1d ComputeWindowing in Enumerations.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 135
diff changeset
74 }
366
a7de01c8fd29 new enum BitmapAnchor
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 212
diff changeset
75
a7de01c8fd29 new enum BitmapAnchor
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 212
diff changeset
76
a7de01c8fd29 new enum BitmapAnchor
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 212
diff changeset
77 void ComputeAnchorTranslation(double& deltaX,
a7de01c8fd29 new enum BitmapAnchor
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 212
diff changeset
78 double& deltaY,
a7de01c8fd29 new enum BitmapAnchor
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 212
diff changeset
79 BitmapAnchor anchor,
a7de01c8fd29 new enum BitmapAnchor
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 212
diff changeset
80 unsigned int bitmapWidth,
a7de01c8fd29 new enum BitmapAnchor
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 212
diff changeset
81 unsigned int bitmapHeight)
a7de01c8fd29 new enum BitmapAnchor
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 212
diff changeset
82 {
a7de01c8fd29 new enum BitmapAnchor
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 212
diff changeset
83 double dw = static_cast<double>(bitmapWidth);
a7de01c8fd29 new enum BitmapAnchor
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 212
diff changeset
84 double dh = static_cast<double>(bitmapHeight);
a7de01c8fd29 new enum BitmapAnchor
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 212
diff changeset
85
a7de01c8fd29 new enum BitmapAnchor
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 212
diff changeset
86 switch (anchor)
a7de01c8fd29 new enum BitmapAnchor
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 212
diff changeset
87 {
a7de01c8fd29 new enum BitmapAnchor
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 212
diff changeset
88 case BitmapAnchor_TopLeft:
a7de01c8fd29 new enum BitmapAnchor
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 212
diff changeset
89 deltaX = 0;
a7de01c8fd29 new enum BitmapAnchor
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 212
diff changeset
90 deltaY = 0;
a7de01c8fd29 new enum BitmapAnchor
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 212
diff changeset
91 break;
a7de01c8fd29 new enum BitmapAnchor
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 212
diff changeset
92
a7de01c8fd29 new enum BitmapAnchor
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 212
diff changeset
93 case BitmapAnchor_TopCenter:
a7de01c8fd29 new enum BitmapAnchor
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 212
diff changeset
94 deltaX = -dw / 2.0;
a7de01c8fd29 new enum BitmapAnchor
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 212
diff changeset
95 deltaY = 0;
a7de01c8fd29 new enum BitmapAnchor
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 212
diff changeset
96 break;
a7de01c8fd29 new enum BitmapAnchor
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 212
diff changeset
97
a7de01c8fd29 new enum BitmapAnchor
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 212
diff changeset
98 case BitmapAnchor_TopRight:
a7de01c8fd29 new enum BitmapAnchor
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 212
diff changeset
99 deltaX = -dw;
a7de01c8fd29 new enum BitmapAnchor
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 212
diff changeset
100 deltaY = 0;
a7de01c8fd29 new enum BitmapAnchor
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 212
diff changeset
101 break;
a7de01c8fd29 new enum BitmapAnchor
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 212
diff changeset
102
a7de01c8fd29 new enum BitmapAnchor
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 212
diff changeset
103 case BitmapAnchor_CenterLeft:
a7de01c8fd29 new enum BitmapAnchor
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 212
diff changeset
104 deltaX = 0;
a7de01c8fd29 new enum BitmapAnchor
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 212
diff changeset
105 deltaY = -dh / 2.0;
a7de01c8fd29 new enum BitmapAnchor
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 212
diff changeset
106 break;
a7de01c8fd29 new enum BitmapAnchor
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 212
diff changeset
107
a7de01c8fd29 new enum BitmapAnchor
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 212
diff changeset
108 case BitmapAnchor_Center:
a7de01c8fd29 new enum BitmapAnchor
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 212
diff changeset
109 deltaX = -dw / 2.0;
a7de01c8fd29 new enum BitmapAnchor
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 212
diff changeset
110 deltaY = -dh / 2.0;
a7de01c8fd29 new enum BitmapAnchor
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 212
diff changeset
111 break;
a7de01c8fd29 new enum BitmapAnchor
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 212
diff changeset
112
a7de01c8fd29 new enum BitmapAnchor
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 212
diff changeset
113 case BitmapAnchor_CenterRight:
a7de01c8fd29 new enum BitmapAnchor
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 212
diff changeset
114 deltaX = -dw;
a7de01c8fd29 new enum BitmapAnchor
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 212
diff changeset
115 deltaY = -dh / 2.0;
a7de01c8fd29 new enum BitmapAnchor
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 212
diff changeset
116 break;
a7de01c8fd29 new enum BitmapAnchor
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 212
diff changeset
117
a7de01c8fd29 new enum BitmapAnchor
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 212
diff changeset
118 case BitmapAnchor_BottomLeft:
a7de01c8fd29 new enum BitmapAnchor
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 212
diff changeset
119 deltaX = 0;
a7de01c8fd29 new enum BitmapAnchor
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 212
diff changeset
120 deltaY = -dh;
a7de01c8fd29 new enum BitmapAnchor
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 212
diff changeset
121 break;
a7de01c8fd29 new enum BitmapAnchor
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 212
diff changeset
122
a7de01c8fd29 new enum BitmapAnchor
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 212
diff changeset
123 case BitmapAnchor_BottomCenter:
a7de01c8fd29 new enum BitmapAnchor
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 212
diff changeset
124 deltaX = -dw / 2.0;
a7de01c8fd29 new enum BitmapAnchor
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 212
diff changeset
125 deltaY = -dh;
a7de01c8fd29 new enum BitmapAnchor
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 212
diff changeset
126 break;
a7de01c8fd29 new enum BitmapAnchor
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 212
diff changeset
127
a7de01c8fd29 new enum BitmapAnchor
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 212
diff changeset
128 case BitmapAnchor_BottomRight:
a7de01c8fd29 new enum BitmapAnchor
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 212
diff changeset
129 deltaX = -dw;
a7de01c8fd29 new enum BitmapAnchor
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 212
diff changeset
130 deltaY = -dh;
a7de01c8fd29 new enum BitmapAnchor
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 212
diff changeset
131 break;
a7de01c8fd29 new enum BitmapAnchor
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 212
diff changeset
132
a7de01c8fd29 new enum BitmapAnchor
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 212
diff changeset
133 default:
a7de01c8fd29 new enum BitmapAnchor
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 212
diff changeset
134 throw Orthanc::OrthancException(Orthanc::ErrorCode_ParameterOutOfRange);
a7de01c8fd29 new enum BitmapAnchor
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 212
diff changeset
135 }
a7de01c8fd29 new enum BitmapAnchor
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 212
diff changeset
136 }
117
42c05a3baee3 loading multi-frame instances as 3D volumes
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
137 }