Mercurial > hg > orthanc
annotate OrthancFramework/Sources/OrthancFramework.cpp @ 5044:6fed78e13233
Refactored DicomMap to handle sequences when needed
author | Alain Mazy <am@osimis.io> |
---|---|
date | Tue, 28 Jun 2022 17:45:09 +0200 |
parents | 43e613a7756b |
children | 0ea402b4d901 |
rev | line source |
---|---|
4029
156fece692e3
missing OrthancFramework.cpp
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1 /** |
156fece692e3
missing OrthancFramework.cpp
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
2 * Orthanc - A Lightweight, RESTful DICOM Store |
156fece692e3
missing OrthancFramework.cpp
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
3 * Copyright (C) 2012-2016 Sebastien Jodogne, Medical Physics |
156fece692e3
missing OrthancFramework.cpp
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
4 * Department, University Hospital of Liege, Belgium |
4870
43e613a7756b
upgrade to year 2022
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4831
diff
changeset
|
5 * Copyright (C) 2017-2022 Osimis S.A., Belgium |
43e613a7756b
upgrade to year 2022
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4831
diff
changeset
|
6 * Copyright (C) 2021-2022 Sebastien Jodogne, ICTEAM UCLouvain, Belgium |
4029
156fece692e3
missing OrthancFramework.cpp
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
7 * |
156fece692e3
missing OrthancFramework.cpp
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
8 * This program is free software: you can redistribute it and/or |
4119
bf7b9edf6b81
re-licensing the OrthancFramework to LGPL, in order to license Stone of Orthanc under LGPL
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4044
diff
changeset
|
9 * modify it under the terms of the GNU Lesser General Public License |
bf7b9edf6b81
re-licensing the OrthancFramework to LGPL, in order to license Stone of Orthanc under LGPL
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4044
diff
changeset
|
10 * as published by the Free Software Foundation, either version 3 of |
bf7b9edf6b81
re-licensing the OrthancFramework to LGPL, in order to license Stone of Orthanc under LGPL
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4044
diff
changeset
|
11 * the License, or (at your option) any later version. |
4029
156fece692e3
missing OrthancFramework.cpp
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
12 * |
156fece692e3
missing OrthancFramework.cpp
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
13 * This program is distributed in the hope that it will be useful, but |
156fece692e3
missing OrthancFramework.cpp
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
14 * WITHOUT ANY WARRANTY; without even the implied warranty of |
156fece692e3
missing OrthancFramework.cpp
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
4119
bf7b9edf6b81
re-licensing the OrthancFramework to LGPL, in order to license Stone of Orthanc under LGPL
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4044
diff
changeset
|
16 * Lesser General Public License for more details. |
4029
156fece692e3
missing OrthancFramework.cpp
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
17 * |
4119
bf7b9edf6b81
re-licensing the OrthancFramework to LGPL, in order to license Stone of Orthanc under LGPL
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4044
diff
changeset
|
18 * You should have received a copy of the GNU Lesser General Public |
bf7b9edf6b81
re-licensing the OrthancFramework to LGPL, in order to license Stone of Orthanc under LGPL
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4044
diff
changeset
|
19 * License along with this program. If not, see |
bf7b9edf6b81
re-licensing the OrthancFramework to LGPL, in order to license Stone of Orthanc under LGPL
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4044
diff
changeset
|
20 * <http://www.gnu.org/licenses/>. |
4029
156fece692e3
missing OrthancFramework.cpp
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
21 **/ |
156fece692e3
missing OrthancFramework.cpp
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
22 |
156fece692e3
missing OrthancFramework.cpp
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
23 |
156fece692e3
missing OrthancFramework.cpp
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
24 #include "PrecompiledHeaders.h" |
156fece692e3
missing OrthancFramework.cpp
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
25 #include "OrthancFramework.h" |
156fece692e3
missing OrthancFramework.cpp
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
26 |
156fece692e3
missing OrthancFramework.cpp
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
27 #if !defined(ORTHANC_ENABLE_CURL) |
156fece692e3
missing OrthancFramework.cpp
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
28 # error Macro ORTHANC_ENABLE_CURL must be defined |
156fece692e3
missing OrthancFramework.cpp
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
29 #endif |
156fece692e3
missing OrthancFramework.cpp
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
30 |
156fece692e3
missing OrthancFramework.cpp
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
31 #if !defined(ORTHANC_ENABLE_SSL) |
156fece692e3
missing OrthancFramework.cpp
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
32 # error Macro ORTHANC_ENABLE_SSL must be defined |
156fece692e3
missing OrthancFramework.cpp
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
33 #endif |
156fece692e3
missing OrthancFramework.cpp
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
34 |
156fece692e3
missing OrthancFramework.cpp
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
35 #if !defined(ORTHANC_ENABLE_DCMTK) |
156fece692e3
missing OrthancFramework.cpp
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
36 # error Macro ORTHANC_ENABLE_DCMTK must be defined |
156fece692e3
missing OrthancFramework.cpp
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
37 #endif |
156fece692e3
missing OrthancFramework.cpp
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
38 |
156fece692e3
missing OrthancFramework.cpp
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
39 #if !defined(ORTHANC_ENABLE_DCMTK_NETWORKING) |
156fece692e3
missing OrthancFramework.cpp
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
40 # error Macro ORTHANC_ENABLE_DCMTK_NETWORKING must be defined |
156fece692e3
missing OrthancFramework.cpp
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
41 #endif |
156fece692e3
missing OrthancFramework.cpp
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
42 |
156fece692e3
missing OrthancFramework.cpp
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
43 #if ORTHANC_ENABLE_CURL == 1 |
156fece692e3
missing OrthancFramework.cpp
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
44 # include "HttpClient.h" |
156fece692e3
missing OrthancFramework.cpp
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
45 #endif |
156fece692e3
missing OrthancFramework.cpp
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
46 |
156fece692e3
missing OrthancFramework.cpp
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
47 #if ORTHANC_ENABLE_DCMTK == 1 |
156fece692e3
missing OrthancFramework.cpp
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
48 # include "DicomParsing/FromDcmtkBridge.h" |
156fece692e3
missing OrthancFramework.cpp
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
49 # if ORTHANC_ENABLE_DCMTK_NETWORKING == 1 |
156fece692e3
missing OrthancFramework.cpp
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
50 # include <dcmtk/dcmnet/dul.h> |
156fece692e3
missing OrthancFramework.cpp
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
51 # endif |
156fece692e3
missing OrthancFramework.cpp
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
52 #endif |
156fece692e3
missing OrthancFramework.cpp
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
53 |
156fece692e3
missing OrthancFramework.cpp
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
54 #include "Logging.h" |
156fece692e3
missing OrthancFramework.cpp
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
55 #include "Toolbox.h" |
156fece692e3
missing OrthancFramework.cpp
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
56 |
156fece692e3
missing OrthancFramework.cpp
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
57 |
156fece692e3
missing OrthancFramework.cpp
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
58 namespace Orthanc |
156fece692e3
missing OrthancFramework.cpp
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
59 { |
156fece692e3
missing OrthancFramework.cpp
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
60 void InitializeFramework(const std::string& locale, |
156fece692e3
missing OrthancFramework.cpp
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
61 bool loadPrivateDictionary) |
156fece692e3
missing OrthancFramework.cpp
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
62 { |
156fece692e3
missing OrthancFramework.cpp
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
63 Logging::Initialize(); |
156fece692e3
missing OrthancFramework.cpp
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
64 |
4030
100fbe970762
DANGEROUS commit: removing HAS_EMBEDDED_RESOURCES
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4029
diff
changeset
|
65 #if (ORTHANC_ENABLE_LOCALE == 1) && !defined(__EMSCRIPTEN__) // No global locale in wasm/asm.js |
4029
156fece692e3
missing OrthancFramework.cpp
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
66 if (locale.empty()) |
156fece692e3
missing OrthancFramework.cpp
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
67 { |
156fece692e3
missing OrthancFramework.cpp
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
68 Toolbox::InitializeGlobalLocale(NULL); |
156fece692e3
missing OrthancFramework.cpp
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
69 } |
156fece692e3
missing OrthancFramework.cpp
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
70 else |
156fece692e3
missing OrthancFramework.cpp
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
71 { |
156fece692e3
missing OrthancFramework.cpp
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
72 Toolbox::InitializeGlobalLocale(locale.c_str()); |
156fece692e3
missing OrthancFramework.cpp
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
73 } |
156fece692e3
missing OrthancFramework.cpp
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
74 #endif |
156fece692e3
missing OrthancFramework.cpp
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
75 |
156fece692e3
missing OrthancFramework.cpp
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
76 Toolbox::InitializeOpenSsl(); |
156fece692e3
missing OrthancFramework.cpp
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
77 |
156fece692e3
missing OrthancFramework.cpp
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
78 #if ORTHANC_ENABLE_CURL == 1 |
156fece692e3
missing OrthancFramework.cpp
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
79 HttpClient::GlobalInitialize(); |
156fece692e3
missing OrthancFramework.cpp
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
80 #endif |
156fece692e3
missing OrthancFramework.cpp
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
81 |
156fece692e3
missing OrthancFramework.cpp
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
82 #if ORTHANC_ENABLE_DCMTK == 1 |
4696
dd6274412ff4
new configuration option "ExternalDictionaries" to load external DICOM dictionaries
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
83 FromDcmtkBridge::InitializeDictionary(loadPrivateDictionary); |
4029
156fece692e3
missing OrthancFramework.cpp
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
84 FromDcmtkBridge::InitializeCodecs(); |
156fece692e3
missing OrthancFramework.cpp
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
85 #endif |
156fece692e3
missing OrthancFramework.cpp
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
86 |
156fece692e3
missing OrthancFramework.cpp
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
87 #if (ORTHANC_ENABLE_DCMTK == 1 && \ |
156fece692e3
missing OrthancFramework.cpp
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
88 ORTHANC_ENABLE_DCMTK_NETWORKING == 1) |
156fece692e3
missing OrthancFramework.cpp
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
89 /* Disable "gethostbyaddr" (which results in memory leaks) and use raw IP addresses */ |
156fece692e3
missing OrthancFramework.cpp
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
90 dcmDisableGethostbyaddr.set(OFTrue); |
156fece692e3
missing OrthancFramework.cpp
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
91 #endif |
156fece692e3
missing OrthancFramework.cpp
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
92 } |
156fece692e3
missing OrthancFramework.cpp
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
93 |
156fece692e3
missing OrthancFramework.cpp
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
94 |
156fece692e3
missing OrthancFramework.cpp
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
95 void FinalizeFramework() |
156fece692e3
missing OrthancFramework.cpp
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
96 { |
156fece692e3
missing OrthancFramework.cpp
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
97 #if ORTHANC_ENABLE_DCMTK == 1 |
156fece692e3
missing OrthancFramework.cpp
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
98 FromDcmtkBridge::FinalizeCodecs(); |
156fece692e3
missing OrthancFramework.cpp
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
99 #endif |
156fece692e3
missing OrthancFramework.cpp
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
100 |
156fece692e3
missing OrthancFramework.cpp
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
101 #if ORTHANC_ENABLE_CURL == 1 |
156fece692e3
missing OrthancFramework.cpp
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
102 HttpClient::GlobalFinalize(); |
156fece692e3
missing OrthancFramework.cpp
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
103 #endif |
156fece692e3
missing OrthancFramework.cpp
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
104 |
156fece692e3
missing OrthancFramework.cpp
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
105 Toolbox::FinalizeOpenSsl(); |
4030
100fbe970762
DANGEROUS commit: removing HAS_EMBEDDED_RESOURCES
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4029
diff
changeset
|
106 |
100fbe970762
DANGEROUS commit: removing HAS_EMBEDDED_RESOURCES
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4029
diff
changeset
|
107 #if (ORTHANC_ENABLE_LOCALE == 1) && !defined(__EMSCRIPTEN__) |
4029
156fece692e3
missing OrthancFramework.cpp
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
108 Toolbox::FinalizeGlobalLocale(); |
4030
100fbe970762
DANGEROUS commit: removing HAS_EMBEDDED_RESOURCES
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4029
diff
changeset
|
109 #endif |
100fbe970762
DANGEROUS commit: removing HAS_EMBEDDED_RESOURCES
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4029
diff
changeset
|
110 |
4029
156fece692e3
missing OrthancFramework.cpp
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
111 Logging::Finalize(); |
156fece692e3
missing OrthancFramework.cpp
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
112 } |
156fece692e3
missing OrthancFramework.cpp
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
113 } |