Mercurial > hg > orthanc-stone
annotate Applications/Samples/Common/SampleHelpers.h @ 1947:31fd7aba48ca
Support of DICOM images without the Study Date (0008,0020) tag
author | Sebastien Jodogne <s.jodogne@gmail.com> |
---|---|
date | Fri, 15 Jul 2022 14:35:05 +0200 |
parents | 7053b8a0aaec |
children | 07964689cb0b |
rev | line source |
---|---|
1458
828a9b4ee1b7
added missing copyright
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1457
diff
changeset
|
1 /** |
828a9b4ee1b7
added missing copyright
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1457
diff
changeset
|
2 * Stone of Orthanc |
828a9b4ee1b7
added missing copyright
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1457
diff
changeset
|
3 * Copyright (C) 2012-2016 Sebastien Jodogne, Medical Physics |
828a9b4ee1b7
added missing copyright
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1457
diff
changeset
|
4 * Department, University Hospital of Liege, Belgium |
1871
7053b8a0aaec
upgrade to year 2022
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1870
diff
changeset
|
5 * Copyright (C) 2017-2022 Osimis S.A., Belgium |
7053b8a0aaec
upgrade to year 2022
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1870
diff
changeset
|
6 * Copyright (C) 2021-2022 Sebastien Jodogne, ICTEAM UCLouvain, Belgium |
1458
828a9b4ee1b7
added missing copyright
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1457
diff
changeset
|
7 * |
828a9b4ee1b7
added missing copyright
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1457
diff
changeset
|
8 * This program is free software: you can redistribute it and/or |
828a9b4ee1b7
added missing copyright
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1457
diff
changeset
|
9 * modify it under the terms of the GNU Affero General Public License |
828a9b4ee1b7
added missing copyright
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1457
diff
changeset
|
10 * as published by the Free Software Foundation, either version 3 of |
828a9b4ee1b7
added missing copyright
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1457
diff
changeset
|
11 * the License, or (at your option) any later version. |
828a9b4ee1b7
added missing copyright
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1457
diff
changeset
|
12 * |
828a9b4ee1b7
added missing copyright
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1457
diff
changeset
|
13 * This program is distributed in the hope that it will be useful, but |
828a9b4ee1b7
added missing copyright
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1457
diff
changeset
|
14 * WITHOUT ANY WARRANTY; without even the implied warranty of |
828a9b4ee1b7
added missing copyright
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1457
diff
changeset
|
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
828a9b4ee1b7
added missing copyright
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1457
diff
changeset
|
16 * Affero General Public License for more details. |
1596
4fb8fdf03314
removed annoying whitespace
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1538
diff
changeset
|
17 * |
1458
828a9b4ee1b7
added missing copyright
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1457
diff
changeset
|
18 * You should have received a copy of the GNU Affero General Public License |
828a9b4ee1b7
added missing copyright
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1457
diff
changeset
|
19 * along with this program. If not, see <http://www.gnu.org/licenses/>. |
828a9b4ee1b7
added missing copyright
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1457
diff
changeset
|
20 **/ |
828a9b4ee1b7
added missing copyright
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1457
diff
changeset
|
21 |
828a9b4ee1b7
added missing copyright
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1457
diff
changeset
|
22 |
1382
9d138883be66
Proper command-line parameter management for SDL sample
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
23 #pragma once |
9d138883be66
Proper command-line parameter management for SDL sample
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
24 |
1457 | 25 #include <Logging.h> |
1386
dfb48f0794b1
Ongoing splitting SDL vs WASM (preparing RtViewer WASM)
Benjamin Golinvaux <bgo@osimis.io>
parents:
1383
diff
changeset
|
26 |
dfb48f0794b1
Ongoing splitting SDL vs WASM (preparing RtViewer WASM)
Benjamin Golinvaux <bgo@osimis.io>
parents:
1383
diff
changeset
|
27 #include <boost/algorithm/string.hpp> |
dfb48f0794b1
Ongoing splitting SDL vs WASM (preparing RtViewer WASM)
Benjamin Golinvaux <bgo@osimis.io>
parents:
1383
diff
changeset
|
28 |
1382
9d138883be66
Proper command-line parameter management for SDL sample
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
29 #include <string> |
9d138883be66
Proper command-line parameter management for SDL sample
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
30 #include <iostream> |
9d138883be66
Proper command-line parameter management for SDL sample
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
31 |
9d138883be66
Proper command-line parameter management for SDL sample
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
32 namespace OrthancStoneHelpers |
9d138883be66
Proper command-line parameter management for SDL sample
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
33 { |
9d138883be66
Proper command-line parameter management for SDL sample
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
34 inline void SetLogLevel(std::string logLevel) |
9d138883be66
Proper command-line parameter management for SDL sample
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
35 { |
9d138883be66
Proper command-line parameter management for SDL sample
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
36 boost::to_lower(logLevel); |
9d138883be66
Proper command-line parameter management for SDL sample
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
37 if (logLevel == "warning") |
9d138883be66
Proper command-line parameter management for SDL sample
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
38 { |
9d138883be66
Proper command-line parameter management for SDL sample
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
39 Orthanc::Logging::EnableInfoLevel(false); |
9d138883be66
Proper command-line parameter management for SDL sample
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
40 Orthanc::Logging::EnableTraceLevel(false); |
9d138883be66
Proper command-line parameter management for SDL sample
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
41 } |
9d138883be66
Proper command-line parameter management for SDL sample
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
42 else if (logLevel == "info") |
9d138883be66
Proper command-line parameter management for SDL sample
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
43 { |
9d138883be66
Proper command-line parameter management for SDL sample
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
44 Orthanc::Logging::EnableInfoLevel(true); |
9d138883be66
Proper command-line parameter management for SDL sample
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
45 Orthanc::Logging::EnableTraceLevel(false); |
9d138883be66
Proper command-line parameter management for SDL sample
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
46 } |
9d138883be66
Proper command-line parameter management for SDL sample
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
47 else if (logLevel == "trace") |
9d138883be66
Proper command-line parameter management for SDL sample
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
48 { |
9d138883be66
Proper command-line parameter management for SDL sample
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
49 Orthanc::Logging::EnableInfoLevel(true); |
9d138883be66
Proper command-line parameter management for SDL sample
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
50 Orthanc::Logging::EnableTraceLevel(true); |
9d138883be66
Proper command-line parameter management for SDL sample
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
51 } |
9d138883be66
Proper command-line parameter management for SDL sample
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
52 else |
9d138883be66
Proper command-line parameter management for SDL sample
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
53 { |
9d138883be66
Proper command-line parameter management for SDL sample
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
54 std::cerr << "Unknown log level \"" << logLevel << "\". Will use TRACE as default!"; |
9d138883be66
Proper command-line parameter management for SDL sample
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
55 Orthanc::Logging::EnableInfoLevel(true); |
9d138883be66
Proper command-line parameter management for SDL sample
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
56 Orthanc::Logging::EnableTraceLevel(true); |
9d138883be66
Proper command-line parameter management for SDL sample
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
57 } |
9d138883be66
Proper command-line parameter management for SDL sample
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
58 } |
1386
dfb48f0794b1
Ongoing splitting SDL vs WASM (preparing RtViewer WASM)
Benjamin Golinvaux <bgo@osimis.io>
parents:
1383
diff
changeset
|
59 } |