Mercurial > hg > orthanc-stone
annotate Framework/StoneInitialization.cpp @ 1302:d6d56df61715 broker
integration mainline->broker
author | Sebastien Jodogne <s.jodogne@gmail.com> |
---|---|
date | Mon, 02 Mar 2020 18:30:04 +0100 |
parents | c38c89684d83 |
children | 1c2d065ba372 |
rev | line source |
---|---|
610
0c4c0693b97c
OrthancStone::StoneInitialize()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1 /** |
0c4c0693b97c
OrthancStone::StoneInitialize()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
2 * Stone of Orthanc |
0c4c0693b97c
OrthancStone::StoneInitialize()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
3 * Copyright (C) 2012-2016 Sebastien Jodogne, Medical Physics |
0c4c0693b97c
OrthancStone::StoneInitialize()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
4 * Department, University Hospital of Liege, Belgium |
1270
2d8ab34c8c91
upgrade to year 2020
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1047
diff
changeset
|
5 * Copyright (C) 2017-2020 Osimis S.A., Belgium |
610
0c4c0693b97c
OrthancStone::StoneInitialize()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
6 * |
0c4c0693b97c
OrthancStone::StoneInitialize()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
7 * This program is free software: you can redistribute it and/or |
0c4c0693b97c
OrthancStone::StoneInitialize()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
8 * modify it under the terms of the GNU Affero General Public License |
0c4c0693b97c
OrthancStone::StoneInitialize()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
9 * as published by the Free Software Foundation, either version 3 of |
0c4c0693b97c
OrthancStone::StoneInitialize()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
10 * the License, or (at your option) any later version. |
0c4c0693b97c
OrthancStone::StoneInitialize()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
11 * |
0c4c0693b97c
OrthancStone::StoneInitialize()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
12 * This program is distributed in the hope that it will be useful, but |
0c4c0693b97c
OrthancStone::StoneInitialize()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
13 * WITHOUT ANY WARRANTY; without even the implied warranty of |
0c4c0693b97c
OrthancStone::StoneInitialize()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
0c4c0693b97c
OrthancStone::StoneInitialize()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
15 * Affero General Public License for more details. |
0c4c0693b97c
OrthancStone::StoneInitialize()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
16 * |
0c4c0693b97c
OrthancStone::StoneInitialize()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
17 * You should have received a copy of the GNU Affero General Public License |
0c4c0693b97c
OrthancStone::StoneInitialize()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
18 * along with this program. If not, see <http://www.gnu.org/licenses/>. |
0c4c0693b97c
OrthancStone::StoneInitialize()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
19 **/ |
0c4c0693b97c
OrthancStone::StoneInitialize()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
20 |
0c4c0693b97c
OrthancStone::StoneInitialize()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
21 |
0c4c0693b97c
OrthancStone::StoneInitialize()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
22 #include "StoneInitialization.h" |
0c4c0693b97c
OrthancStone::StoneInitialize()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
23 |
0c4c0693b97c
OrthancStone::StoneInitialize()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
24 #if !defined(ORTHANC_ENABLE_SDL) |
0c4c0693b97c
OrthancStone::StoneInitialize()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
25 # error Macro ORTHANC_ENABLE_SDL must be defined |
0c4c0693b97c
OrthancStone::StoneInitialize()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
26 #endif |
0c4c0693b97c
OrthancStone::StoneInitialize()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
27 |
1187
092ec2a225ad
dealing with locales in Qt
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1167
diff
changeset
|
28 #if !defined(ORTHANC_ENABLE_QT) |
092ec2a225ad
dealing with locales in Qt
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1167
diff
changeset
|
29 # error Macro ORTHANC_ENABLE_QT must be defined |
092ec2a225ad
dealing with locales in Qt
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1167
diff
changeset
|
30 #endif |
092ec2a225ad
dealing with locales in Qt
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1167
diff
changeset
|
31 |
1167
ad4e21df4e40
enriching OrthancStone::StoneInitialize()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1047
diff
changeset
|
32 #if !defined(ORTHANC_ENABLE_SSL) |
ad4e21df4e40
enriching OrthancStone::StoneInitialize()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1047
diff
changeset
|
33 # error Macro ORTHANC_ENABLE_SSL must be defined |
ad4e21df4e40
enriching OrthancStone::StoneInitialize()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1047
diff
changeset
|
34 #endif |
ad4e21df4e40
enriching OrthancStone::StoneInitialize()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1047
diff
changeset
|
35 |
ad4e21df4e40
enriching OrthancStone::StoneInitialize()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1047
diff
changeset
|
36 #if !defined(ORTHANC_ENABLE_CURL) |
ad4e21df4e40
enriching OrthancStone::StoneInitialize()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1047
diff
changeset
|
37 # error Macro ORTHANC_ENABLE_CURL must be defined |
ad4e21df4e40
enriching OrthancStone::StoneInitialize()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1047
diff
changeset
|
38 #endif |
ad4e21df4e40
enriching OrthancStone::StoneInitialize()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1047
diff
changeset
|
39 |
ad4e21df4e40
enriching OrthancStone::StoneInitialize()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1047
diff
changeset
|
40 #if !defined(ORTHANC_ENABLE_DCMTK) |
ad4e21df4e40
enriching OrthancStone::StoneInitialize()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1047
diff
changeset
|
41 # error Macro ORTHANC_ENABLE_DCMTK must be defined |
ad4e21df4e40
enriching OrthancStone::StoneInitialize()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1047
diff
changeset
|
42 # if !defined(DCMTK_VERSION_NUMBER) |
ad4e21df4e40
enriching OrthancStone::StoneInitialize()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1047
diff
changeset
|
43 # error Macro DCMTK_VERSION_NUMBER must be defined |
ad4e21df4e40
enriching OrthancStone::StoneInitialize()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1047
diff
changeset
|
44 # endif |
ad4e21df4e40
enriching OrthancStone::StoneInitialize()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1047
diff
changeset
|
45 #endif |
ad4e21df4e40
enriching OrthancStone::StoneInitialize()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1047
diff
changeset
|
46 |
610
0c4c0693b97c
OrthancStone::StoneInitialize()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
47 #if ORTHANC_ENABLE_SDL == 1 |
1047 | 48 # include "Viewport/SdlWindow.h" |
610
0c4c0693b97c
OrthancStone::StoneInitialize()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
49 #endif |
0c4c0693b97c
OrthancStone::StoneInitialize()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
50 |
1187
092ec2a225ad
dealing with locales in Qt
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1167
diff
changeset
|
51 #if ORTHANC_ENABLE_QT == 1 |
092ec2a225ad
dealing with locales in Qt
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1167
diff
changeset
|
52 # include <QCoreApplication> |
092ec2a225ad
dealing with locales in Qt
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1167
diff
changeset
|
53 #endif |
092ec2a225ad
dealing with locales in Qt
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1167
diff
changeset
|
54 |
797
20262f5e5e88
Added missing HttpClient::GlobalInitialize in StoneInitialize
Benjamin Golinvaux <bgo@osimis.io>
parents:
663
diff
changeset
|
55 #if ORTHANC_ENABLE_CURL == 1 |
1167
ad4e21df4e40
enriching OrthancStone::StoneInitialize()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1047
diff
changeset
|
56 # include <Core/HttpClient.h> |
ad4e21df4e40
enriching OrthancStone::StoneInitialize()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1047
diff
changeset
|
57 #endif |
ad4e21df4e40
enriching OrthancStone::StoneInitialize()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1047
diff
changeset
|
58 |
ad4e21df4e40
enriching OrthancStone::StoneInitialize()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1047
diff
changeset
|
59 #if ORTHANC_ENABLE_DCMTK == 1 |
ad4e21df4e40
enriching OrthancStone::StoneInitialize()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1047
diff
changeset
|
60 # include <Core/DicomParsing/FromDcmtkBridge.h> |
797
20262f5e5e88
Added missing HttpClient::GlobalInitialize in StoneInitialize
Benjamin Golinvaux <bgo@osimis.io>
parents:
663
diff
changeset
|
61 #endif |
20262f5e5e88
Added missing HttpClient::GlobalInitialize in StoneInitialize
Benjamin Golinvaux <bgo@osimis.io>
parents:
663
diff
changeset
|
62 |
1236
358461330978
global function GetWebGLViewportsRegistry()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1187
diff
changeset
|
63 #if ORTHANC_ENABLE_WASM == 1 |
358461330978
global function GetWebGLViewportsRegistry()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1187
diff
changeset
|
64 static double viewportsTimeout_ = 1000; |
1299
c38c89684d83
replacing std::auto_ptr by std::unique_ptr
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1279
diff
changeset
|
65 static std::unique_ptr<OrthancStone::WebGLViewportsRegistry> viewportsRegistry_; |
1236
358461330978
global function GetWebGLViewportsRegistry()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1187
diff
changeset
|
66 #endif |
358461330978
global function GetWebGLViewportsRegistry()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1187
diff
changeset
|
67 |
1167
ad4e21df4e40
enriching OrthancStone::StoneInitialize()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1047
diff
changeset
|
68 #include "Toolbox/LinearAlgebra.h" |
ad4e21df4e40
enriching OrthancStone::StoneInitialize()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1047
diff
changeset
|
69 |
ad4e21df4e40
enriching OrthancStone::StoneInitialize()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1047
diff
changeset
|
70 #include <Core/OrthancException.h> |
ad4e21df4e40
enriching OrthancStone::StoneInitialize()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1047
diff
changeset
|
71 #include <Core/Toolbox.h> |
ad4e21df4e40
enriching OrthancStone::StoneInitialize()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1047
diff
changeset
|
72 |
1187
092ec2a225ad
dealing with locales in Qt
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1167
diff
changeset
|
73 #include <locale> |
092ec2a225ad
dealing with locales in Qt
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1167
diff
changeset
|
74 |
1167
ad4e21df4e40
enriching OrthancStone::StoneInitialize()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1047
diff
changeset
|
75 |
610
0c4c0693b97c
OrthancStone::StoneInitialize()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
76 namespace OrthancStone |
0c4c0693b97c
OrthancStone::StoneInitialize()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
77 { |
663
b8b2bb75fde1
fix to include Stone within an Orthanc plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
613
diff
changeset
|
78 #if ORTHANC_ENABLE_LOGGING_PLUGIN == 1 |
b8b2bb75fde1
fix to include Stone within an Orthanc plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
613
diff
changeset
|
79 void StoneInitialize(OrthancPluginContext* context) |
b8b2bb75fde1
fix to include Stone within an Orthanc plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
613
diff
changeset
|
80 #else |
610
0c4c0693b97c
OrthancStone::StoneInitialize()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
81 void StoneInitialize() |
663
b8b2bb75fde1
fix to include Stone within an Orthanc plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
613
diff
changeset
|
82 #endif |
610
0c4c0693b97c
OrthancStone::StoneInitialize()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
83 { |
663
b8b2bb75fde1
fix to include Stone within an Orthanc plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
613
diff
changeset
|
84 #if ORTHANC_ENABLE_LOGGING_PLUGIN == 1 |
b8b2bb75fde1
fix to include Stone within an Orthanc plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
613
diff
changeset
|
85 Orthanc::Logging::Initialize(context); |
b8b2bb75fde1
fix to include Stone within an Orthanc plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
613
diff
changeset
|
86 #else |
610
0c4c0693b97c
OrthancStone::StoneInitialize()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
87 Orthanc::Logging::Initialize(); |
663
b8b2bb75fde1
fix to include Stone within an Orthanc plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
613
diff
changeset
|
88 #endif |
610
0c4c0693b97c
OrthancStone::StoneInitialize()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
89 |
1167
ad4e21df4e40
enriching OrthancStone::StoneInitialize()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1047
diff
changeset
|
90 #if ORTHANC_ENABLE_SSL == 1 |
ad4e21df4e40
enriching OrthancStone::StoneInitialize()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1047
diff
changeset
|
91 // Must be before curl |
ad4e21df4e40
enriching OrthancStone::StoneInitialize()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1047
diff
changeset
|
92 Orthanc::Toolbox::InitializeOpenSsl(); |
610
0c4c0693b97c
OrthancStone::StoneInitialize()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
93 #endif |
797
20262f5e5e88
Added missing HttpClient::GlobalInitialize in StoneInitialize
Benjamin Golinvaux <bgo@osimis.io>
parents:
663
diff
changeset
|
94 |
20262f5e5e88
Added missing HttpClient::GlobalInitialize in StoneInitialize
Benjamin Golinvaux <bgo@osimis.io>
parents:
663
diff
changeset
|
95 #if ORTHANC_ENABLE_CURL == 1 |
20262f5e5e88
Added missing HttpClient::GlobalInitialize in StoneInitialize
Benjamin Golinvaux <bgo@osimis.io>
parents:
663
diff
changeset
|
96 Orthanc::HttpClient::GlobalInitialize(); |
1167
ad4e21df4e40
enriching OrthancStone::StoneInitialize()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1047
diff
changeset
|
97 # if ORTHANC_ENABLE_SSL == 1 |
ad4e21df4e40
enriching OrthancStone::StoneInitialize()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1047
diff
changeset
|
98 Orthanc::HttpClient::ConfigureSsl(false, ""); |
ad4e21df4e40
enriching OrthancStone::StoneInitialize()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1047
diff
changeset
|
99 # endif |
ad4e21df4e40
enriching OrthancStone::StoneInitialize()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1047
diff
changeset
|
100 #endif |
ad4e21df4e40
enriching OrthancStone::StoneInitialize()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1047
diff
changeset
|
101 |
ad4e21df4e40
enriching OrthancStone::StoneInitialize()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1047
diff
changeset
|
102 #if ORTHANC_ENABLE_DCMTK == 1 |
ad4e21df4e40
enriching OrthancStone::StoneInitialize()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1047
diff
changeset
|
103 Orthanc::FromDcmtkBridge::InitializeDictionary(true); |
ad4e21df4e40
enriching OrthancStone::StoneInitialize()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1047
diff
changeset
|
104 Orthanc::FromDcmtkBridge::InitializeCodecs(); |
ad4e21df4e40
enriching OrthancStone::StoneInitialize()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1047
diff
changeset
|
105 # if DCMTK_VERSION_NUMBER <= 360 |
ad4e21df4e40
enriching OrthancStone::StoneInitialize()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1047
diff
changeset
|
106 OFLog::configure(OFLogger::FATAL_LOG_LEVEL); |
ad4e21df4e40
enriching OrthancStone::StoneInitialize()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1047
diff
changeset
|
107 # else |
ad4e21df4e40
enriching OrthancStone::StoneInitialize()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1047
diff
changeset
|
108 OFLog::configure(OFLogger::OFF_LOG_LEVEL); |
ad4e21df4e40
enriching OrthancStone::StoneInitialize()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1047
diff
changeset
|
109 # endif |
ad4e21df4e40
enriching OrthancStone::StoneInitialize()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1047
diff
changeset
|
110 #endif |
ad4e21df4e40
enriching OrthancStone::StoneInitialize()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1047
diff
changeset
|
111 |
1187
092ec2a225ad
dealing with locales in Qt
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1167
diff
changeset
|
112 /** |
092ec2a225ad
dealing with locales in Qt
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1167
diff
changeset
|
113 * This call is necessary to make "boost::lexical_cast<>" work in |
092ec2a225ad
dealing with locales in Qt
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1167
diff
changeset
|
114 * a consistent way in the presence of "double" or "float", and of |
092ec2a225ad
dealing with locales in Qt
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1167
diff
changeset
|
115 * a numeric locale that replaces dot (".") by comma (",") as the |
092ec2a225ad
dealing with locales in Qt
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1167
diff
changeset
|
116 * decimal separator. |
092ec2a225ad
dealing with locales in Qt
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1167
diff
changeset
|
117 * https://stackoverflow.com/a/18981514/881731 |
092ec2a225ad
dealing with locales in Qt
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1167
diff
changeset
|
118 **/ |
092ec2a225ad
dealing with locales in Qt
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1167
diff
changeset
|
119 std::locale::global(std::locale::classic()); |
092ec2a225ad
dealing with locales in Qt
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1167
diff
changeset
|
120 |
1167
ad4e21df4e40
enriching OrthancStone::StoneInitialize()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1047
diff
changeset
|
121 { |
1187
092ec2a225ad
dealing with locales in Qt
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1167
diff
changeset
|
122 // Run-time checks of locale settings, to be run after Qt has |
092ec2a225ad
dealing with locales in Qt
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1167
diff
changeset
|
123 // been initialized, as Qt changes locale settings |
092ec2a225ad
dealing with locales in Qt
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1167
diff
changeset
|
124 |
092ec2a225ad
dealing with locales in Qt
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1167
diff
changeset
|
125 #if ORTHANC_ENABLE_QT == 1 |
092ec2a225ad
dealing with locales in Qt
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1167
diff
changeset
|
126 if (QCoreApplication::instance() == NULL) |
092ec2a225ad
dealing with locales in Qt
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1167
diff
changeset
|
127 { |
092ec2a225ad
dealing with locales in Qt
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1167
diff
changeset
|
128 throw Orthanc::OrthancException(Orthanc::ErrorCode_BadSequenceOfCalls, |
092ec2a225ad
dealing with locales in Qt
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1167
diff
changeset
|
129 "Qt must be initialized before Stone"); |
092ec2a225ad
dealing with locales in Qt
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1167
diff
changeset
|
130 } |
092ec2a225ad
dealing with locales in Qt
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1167
diff
changeset
|
131 #endif |
092ec2a225ad
dealing with locales in Qt
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1167
diff
changeset
|
132 |
1167
ad4e21df4e40
enriching OrthancStone::StoneInitialize()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1047
diff
changeset
|
133 { |
1187
092ec2a225ad
dealing with locales in Qt
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1167
diff
changeset
|
134 OrthancStone::Vector v; |
092ec2a225ad
dealing with locales in Qt
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1167
diff
changeset
|
135 if (!OrthancStone::LinearAlgebra::ParseVector(v, "1.3671875\\-1.3671875") || |
092ec2a225ad
dealing with locales in Qt
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1167
diff
changeset
|
136 v.size() != 2 || |
092ec2a225ad
dealing with locales in Qt
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1167
diff
changeset
|
137 !OrthancStone::LinearAlgebra::IsNear(1.3671875f, v[0]) || |
092ec2a225ad
dealing with locales in Qt
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1167
diff
changeset
|
138 !OrthancStone::LinearAlgebra::IsNear(-1.3671875f, v[1])) |
092ec2a225ad
dealing with locales in Qt
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1167
diff
changeset
|
139 { |
092ec2a225ad
dealing with locales in Qt
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1167
diff
changeset
|
140 throw Orthanc::OrthancException(Orthanc::ErrorCode_InternalError, |
092ec2a225ad
dealing with locales in Qt
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1167
diff
changeset
|
141 "Error in the locale settings, giving up"); |
092ec2a225ad
dealing with locales in Qt
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1167
diff
changeset
|
142 } |
092ec2a225ad
dealing with locales in Qt
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1167
diff
changeset
|
143 } |
092ec2a225ad
dealing with locales in Qt
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1167
diff
changeset
|
144 |
092ec2a225ad
dealing with locales in Qt
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1167
diff
changeset
|
145 { |
092ec2a225ad
dealing with locales in Qt
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1167
diff
changeset
|
146 Json::Value dicomweb = Json::objectValue; |
092ec2a225ad
dealing with locales in Qt
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1167
diff
changeset
|
147 dicomweb["00280030"] = Json::objectValue; |
092ec2a225ad
dealing with locales in Qt
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1167
diff
changeset
|
148 dicomweb["00280030"]["vr"] = "DS"; |
092ec2a225ad
dealing with locales in Qt
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1167
diff
changeset
|
149 dicomweb["00280030"]["Value"] = Json::arrayValue; |
092ec2a225ad
dealing with locales in Qt
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1167
diff
changeset
|
150 dicomweb["00280030"]["Value"].append(1.2f); |
092ec2a225ad
dealing with locales in Qt
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1167
diff
changeset
|
151 dicomweb["00280030"]["Value"].append(-1.5f); |
092ec2a225ad
dealing with locales in Qt
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1167
diff
changeset
|
152 |
092ec2a225ad
dealing with locales in Qt
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1167
diff
changeset
|
153 Orthanc::DicomMap source; |
092ec2a225ad
dealing with locales in Qt
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1167
diff
changeset
|
154 source.FromDicomWeb(dicomweb); |
092ec2a225ad
dealing with locales in Qt
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1167
diff
changeset
|
155 |
092ec2a225ad
dealing with locales in Qt
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1167
diff
changeset
|
156 std::string s; |
092ec2a225ad
dealing with locales in Qt
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1167
diff
changeset
|
157 OrthancStone::Vector v; |
092ec2a225ad
dealing with locales in Qt
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1167
diff
changeset
|
158 if (!source.LookupStringValue(s, Orthanc::DICOM_TAG_PIXEL_SPACING, false) || |
092ec2a225ad
dealing with locales in Qt
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1167
diff
changeset
|
159 !OrthancStone::LinearAlgebra::ParseVector(v, s) || |
092ec2a225ad
dealing with locales in Qt
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1167
diff
changeset
|
160 v.size() != 2 || |
092ec2a225ad
dealing with locales in Qt
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1167
diff
changeset
|
161 !OrthancStone::LinearAlgebra::IsNear(1.2f, v[0]) || |
092ec2a225ad
dealing with locales in Qt
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1167
diff
changeset
|
162 !OrthancStone::LinearAlgebra::IsNear(-1.5f, v[1])) |
092ec2a225ad
dealing with locales in Qt
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1167
diff
changeset
|
163 { |
092ec2a225ad
dealing with locales in Qt
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1167
diff
changeset
|
164 throw Orthanc::OrthancException(Orthanc::ErrorCode_InternalError, |
092ec2a225ad
dealing with locales in Qt
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1167
diff
changeset
|
165 "Error in the locale settings, giving up"); |
092ec2a225ad
dealing with locales in Qt
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1167
diff
changeset
|
166 } |
1167
ad4e21df4e40
enriching OrthancStone::StoneInitialize()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1047
diff
changeset
|
167 } |
ad4e21df4e40
enriching OrthancStone::StoneInitialize()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1047
diff
changeset
|
168 } |
ad4e21df4e40
enriching OrthancStone::StoneInitialize()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1047
diff
changeset
|
169 |
ad4e21df4e40
enriching OrthancStone::StoneInitialize()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1047
diff
changeset
|
170 #if ORTHANC_ENABLE_SDL == 1 |
ad4e21df4e40
enriching OrthancStone::StoneInitialize()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1047
diff
changeset
|
171 OrthancStone::SdlWindow::GlobalInitialize(); |
797
20262f5e5e88
Added missing HttpClient::GlobalInitialize in StoneInitialize
Benjamin Golinvaux <bgo@osimis.io>
parents:
663
diff
changeset
|
172 #endif |
610
0c4c0693b97c
OrthancStone::StoneInitialize()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
173 } |
1167
ad4e21df4e40
enriching OrthancStone::StoneInitialize()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1047
diff
changeset
|
174 |
610
0c4c0693b97c
OrthancStone::StoneInitialize()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
175 |
0c4c0693b97c
OrthancStone::StoneInitialize()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
176 void StoneFinalize() |
0c4c0693b97c
OrthancStone::StoneInitialize()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
177 { |
1236
358461330978
global function GetWebGLViewportsRegistry()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1187
diff
changeset
|
178 #if ORTHANC_ENABLE_WASM == 1 |
358461330978
global function GetWebGLViewportsRegistry()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1187
diff
changeset
|
179 viewportsRegistry_.reset(); |
358461330978
global function GetWebGLViewportsRegistry()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1187
diff
changeset
|
180 #endif |
358461330978
global function GetWebGLViewportsRegistry()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1187
diff
changeset
|
181 |
610
0c4c0693b97c
OrthancStone::StoneInitialize()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
182 #if ORTHANC_ENABLE_SDL == 1 |
0c4c0693b97c
OrthancStone::StoneInitialize()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
183 OrthancStone::SdlWindow::GlobalFinalize(); |
0c4c0693b97c
OrthancStone::StoneInitialize()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
184 #endif |
0c4c0693b97c
OrthancStone::StoneInitialize()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
185 |
1167
ad4e21df4e40
enriching OrthancStone::StoneInitialize()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1047
diff
changeset
|
186 #if ORTHANC_ENABLE_DCMTK == 1 |
ad4e21df4e40
enriching OrthancStone::StoneInitialize()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1047
diff
changeset
|
187 Orthanc::FromDcmtkBridge::FinalizeCodecs(); |
ad4e21df4e40
enriching OrthancStone::StoneInitialize()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1047
diff
changeset
|
188 #endif |
ad4e21df4e40
enriching OrthancStone::StoneInitialize()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1047
diff
changeset
|
189 |
804
61ba4b504e9a
PolylineSceneLayer now has one color per chain
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
797
diff
changeset
|
190 #if ORTHANC_ENABLE_CURL == 1 |
61ba4b504e9a
PolylineSceneLayer now has one color per chain
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
797
diff
changeset
|
191 Orthanc::HttpClient::GlobalFinalize(); |
61ba4b504e9a
PolylineSceneLayer now has one color per chain
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
797
diff
changeset
|
192 #endif |
61ba4b504e9a
PolylineSceneLayer now has one color per chain
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
797
diff
changeset
|
193 |
1167
ad4e21df4e40
enriching OrthancStone::StoneInitialize()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1047
diff
changeset
|
194 #if ORTHANC_ENABLE_SSL == 1 |
ad4e21df4e40
enriching OrthancStone::StoneInitialize()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1047
diff
changeset
|
195 Orthanc::Toolbox::FinalizeOpenSsl(); |
ad4e21df4e40
enriching OrthancStone::StoneInitialize()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1047
diff
changeset
|
196 #endif |
ad4e21df4e40
enriching OrthancStone::StoneInitialize()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1047
diff
changeset
|
197 |
610
0c4c0693b97c
OrthancStone::StoneInitialize()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
198 Orthanc::Logging::Finalize(); |
0c4c0693b97c
OrthancStone::StoneInitialize()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
199 } |
1236
358461330978
global function GetWebGLViewportsRegistry()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1187
diff
changeset
|
200 |
358461330978
global function GetWebGLViewportsRegistry()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1187
diff
changeset
|
201 |
358461330978
global function GetWebGLViewportsRegistry()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1187
diff
changeset
|
202 #if ORTHANC_ENABLE_WASM == 1 |
358461330978
global function GetWebGLViewportsRegistry()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1187
diff
changeset
|
203 void SetWebGLViewportsRegistryTimeout(double timeout) |
358461330978
global function GetWebGLViewportsRegistry()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1187
diff
changeset
|
204 { |
358461330978
global function GetWebGLViewportsRegistry()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1187
diff
changeset
|
205 if (viewportsRegistry_.get()) |
358461330978
global function GetWebGLViewportsRegistry()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1187
diff
changeset
|
206 { |
358461330978
global function GetWebGLViewportsRegistry()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1187
diff
changeset
|
207 throw Orthanc::OrthancException(Orthanc::ErrorCode_BadSequenceOfCalls); |
358461330978
global function GetWebGLViewportsRegistry()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1187
diff
changeset
|
208 } |
358461330978
global function GetWebGLViewportsRegistry()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1187
diff
changeset
|
209 else |
358461330978
global function GetWebGLViewportsRegistry()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1187
diff
changeset
|
210 { |
358461330978
global function GetWebGLViewportsRegistry()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1187
diff
changeset
|
211 viewportsTimeout_ = timeout; |
358461330978
global function GetWebGLViewportsRegistry()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1187
diff
changeset
|
212 } |
358461330978
global function GetWebGLViewportsRegistry()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1187
diff
changeset
|
213 } |
358461330978
global function GetWebGLViewportsRegistry()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1187
diff
changeset
|
214 #endif |
358461330978
global function GetWebGLViewportsRegistry()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1187
diff
changeset
|
215 |
358461330978
global function GetWebGLViewportsRegistry()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1187
diff
changeset
|
216 |
358461330978
global function GetWebGLViewportsRegistry()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1187
diff
changeset
|
217 #if ORTHANC_ENABLE_WASM == 1 |
358461330978
global function GetWebGLViewportsRegistry()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1187
diff
changeset
|
218 WebGLViewportsRegistry& GetWebGLViewportsRegistry() |
358461330978
global function GetWebGLViewportsRegistry()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1187
diff
changeset
|
219 { |
358461330978
global function GetWebGLViewportsRegistry()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1187
diff
changeset
|
220 if (viewportsRegistry_.get() == NULL) |
358461330978
global function GetWebGLViewportsRegistry()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1187
diff
changeset
|
221 { |
358461330978
global function GetWebGLViewportsRegistry()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1187
diff
changeset
|
222 viewportsRegistry_.reset(new WebGLViewportsRegistry(viewportsTimeout_)); |
358461330978
global function GetWebGLViewportsRegistry()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1187
diff
changeset
|
223 } |
358461330978
global function GetWebGLViewportsRegistry()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1187
diff
changeset
|
224 |
358461330978
global function GetWebGLViewportsRegistry()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1187
diff
changeset
|
225 return *viewportsRegistry_; |
358461330978
global function GetWebGLViewportsRegistry()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1187
diff
changeset
|
226 } |
358461330978
global function GetWebGLViewportsRegistry()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1187
diff
changeset
|
227 #endif |
610
0c4c0693b97c
OrthancStone::StoneInitialize()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
228 } |