Mercurial > hg > orthanc-stone
comparison Framework/StoneEnumerations.cpp @ 194:7a031ac16b2d wasm
rename Enumerations.h to StoneEnumerations.h to avoid clashes with Orthanc
author | Sebastien Jodogne <s.jodogne@gmail.com> |
---|---|
date | Tue, 20 Mar 2018 14:46:58 +0100 |
parents | Framework/Enumerations.cpp@a7674c0ae4ac |
children | e9c7a78a3e77 |
comparison
equal
deleted
inserted
replaced
193:4abddd083374 | 194:7a031ac16b2d |
---|---|
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-2018 Osimis S.A., 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 #include "StoneEnumerations.h" | |
23 | |
24 #include <Core/Logging.h> | |
25 #include <Core/OrthancException.h> | |
26 #include <Core/Toolbox.h> | |
27 | |
28 namespace OrthancStone | |
29 { | |
30 bool StringToSopClassUid(SopClassUid& result, | |
31 const std::string& source) | |
32 { | |
33 std::string s = Orthanc::Toolbox::StripSpaces(source); | |
34 | |
35 if (s == "1.2.840.10008.5.1.4.1.1.481.2") | |
36 { | |
37 result = SopClassUid_RTDose; | |
38 return true; | |
39 } | |
40 else | |
41 { | |
42 //LOG(INFO) << "Unknown SOP class UID: " << source; | |
43 return false; | |
44 } | |
45 } | |
46 | |
47 | |
48 void ComputeWindowing(float& targetCenter, | |
49 float& targetWidth, | |
50 ImageWindowing windowing, | |
51 float defaultCenter, | |
52 float defaultWidth) | |
53 { | |
54 switch (windowing) | |
55 { | |
56 case ImageWindowing_Default: | |
57 targetCenter = defaultCenter; | |
58 targetWidth = defaultWidth; | |
59 break; | |
60 | |
61 case ImageWindowing_Bone: | |
62 targetCenter = 300; | |
63 targetWidth = 2000; | |
64 break; | |
65 | |
66 case ImageWindowing_Lung: | |
67 targetCenter = -600; | |
68 targetWidth = 1600; | |
69 break; | |
70 | |
71 default: | |
72 throw Orthanc::OrthancException(Orthanc::ErrorCode_ParameterOutOfRange); | |
73 } | |
74 } | |
75 } |