Mercurial > hg > orthanc-stone
annotate Framework/Enumerations.cpp @ 161:197a5ddaf68c wasm
FiniteProjectiveCamera
author | Sebastien Jodogne <s.jodogne@gmail.com> |
---|---|
date | Wed, 14 Feb 2018 11:29:26 +0100 |
parents | f19194a11c1d |
children | a7674c0ae4ac |
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 |
135
e2fe9352f240
upgrade to year 2018
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
117
diff
changeset
|
5 * Copyright (C) 2017-2018 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 |
42c05a3baee3
loading multi-frame instances as 3D volumes
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
22 #include "Enumerations.h" |
42c05a3baee3
loading multi-frame instances as 3D volumes
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
23 |
42c05a3baee3
loading multi-frame instances as 3D volumes
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
24 #include <Core/Logging.h> |
142
f19194a11c1d
ComputeWindowing in Enumerations.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
135
diff
changeset
|
25 #include <Core/OrthancException.h> |
117
42c05a3baee3
loading multi-frame instances as 3D volumes
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
26 |
42c05a3baee3
loading multi-frame instances as 3D volumes
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
27 namespace OrthancStone |
42c05a3baee3
loading multi-frame instances as 3D volumes
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
28 { |
42c05a3baee3
loading multi-frame instances as 3D volumes
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
29 bool StringToSopClassUid(SopClassUid& result, |
42c05a3baee3
loading multi-frame instances as 3D volumes
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
30 const std::string& source) |
42c05a3baee3
loading multi-frame instances as 3D volumes
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
31 { |
42c05a3baee3
loading multi-frame instances as 3D volumes
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
32 if (source == "1.2.840.10008.5.1.4.1.1.481.2") |
42c05a3baee3
loading multi-frame instances as 3D volumes
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
33 { |
42c05a3baee3
loading multi-frame instances as 3D volumes
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
34 result = SopClassUid_RTDose; |
42c05a3baee3
loading multi-frame instances as 3D volumes
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
35 return true; |
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 else |
42c05a3baee3
loading multi-frame instances as 3D volumes
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
38 { |
42c05a3baee3
loading multi-frame instances as 3D volumes
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
39 //LOG(INFO) << "Unknown SOP class UID: " << source; |
42c05a3baee3
loading multi-frame instances as 3D volumes
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
40 return false; |
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 } |
142
f19194a11c1d
ComputeWindowing in Enumerations.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
135
diff
changeset
|
43 |
f19194a11c1d
ComputeWindowing in Enumerations.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
135
diff
changeset
|
44 |
f19194a11c1d
ComputeWindowing in Enumerations.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
135
diff
changeset
|
45 void ComputeWindowing(float& targetCenter, |
f19194a11c1d
ComputeWindowing in Enumerations.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
135
diff
changeset
|
46 float& targetWidth, |
f19194a11c1d
ComputeWindowing in Enumerations.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
135
diff
changeset
|
47 ImageWindowing windowing, |
f19194a11c1d
ComputeWindowing in Enumerations.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
135
diff
changeset
|
48 float defaultCenter, |
f19194a11c1d
ComputeWindowing in Enumerations.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
135
diff
changeset
|
49 float defaultWidth) |
f19194a11c1d
ComputeWindowing in Enumerations.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
135
diff
changeset
|
50 { |
f19194a11c1d
ComputeWindowing in Enumerations.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
135
diff
changeset
|
51 switch (windowing) |
f19194a11c1d
ComputeWindowing in Enumerations.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
135
diff
changeset
|
52 { |
f19194a11c1d
ComputeWindowing in Enumerations.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
135
diff
changeset
|
53 case ImageWindowing_Default: |
f19194a11c1d
ComputeWindowing in Enumerations.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
135
diff
changeset
|
54 targetCenter = defaultCenter; |
f19194a11c1d
ComputeWindowing in Enumerations.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
135
diff
changeset
|
55 targetWidth = defaultWidth; |
f19194a11c1d
ComputeWindowing in Enumerations.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
135
diff
changeset
|
56 break; |
f19194a11c1d
ComputeWindowing in Enumerations.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
135
diff
changeset
|
57 |
f19194a11c1d
ComputeWindowing in Enumerations.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
135
diff
changeset
|
58 case ImageWindowing_Bone: |
f19194a11c1d
ComputeWindowing in Enumerations.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
135
diff
changeset
|
59 targetCenter = 300; |
f19194a11c1d
ComputeWindowing in Enumerations.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
135
diff
changeset
|
60 targetWidth = 2000; |
f19194a11c1d
ComputeWindowing in Enumerations.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
135
diff
changeset
|
61 break; |
f19194a11c1d
ComputeWindowing in Enumerations.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
135
diff
changeset
|
62 |
f19194a11c1d
ComputeWindowing in Enumerations.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
135
diff
changeset
|
63 case ImageWindowing_Lung: |
f19194a11c1d
ComputeWindowing in Enumerations.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
135
diff
changeset
|
64 targetCenter = -600; |
f19194a11c1d
ComputeWindowing in Enumerations.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
135
diff
changeset
|
65 targetWidth = 1600; |
f19194a11c1d
ComputeWindowing in Enumerations.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
135
diff
changeset
|
66 break; |
f19194a11c1d
ComputeWindowing in Enumerations.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
135
diff
changeset
|
67 |
f19194a11c1d
ComputeWindowing in Enumerations.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
135
diff
changeset
|
68 default: |
f19194a11c1d
ComputeWindowing in Enumerations.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
135
diff
changeset
|
69 throw Orthanc::OrthancException(Orthanc::ErrorCode_ParameterOutOfRange); |
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 } |
117
42c05a3baee3
loading multi-frame instances as 3D volumes
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
72 } |