annotate OrthancFramework/Sources/DicomFormat/DicomValue.h @ 4870:43e613a7756b

upgrade to year 2022
author Sebastien Jodogne <s.jodogne@gmail.com>
date Tue, 11 Jan 2022 11:15:42 +0100
parents 7053502fbf97
children 6fed78e13233
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
0
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1 /**
59
c996319e90bc renaming in Core
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 50
diff changeset
2 * Orthanc - A Lightweight, RESTful DICOM Store
1900
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1761
diff changeset
3 * Copyright (C) 2012-2016 Sebastien Jodogne, Medical Physics
1288
6e7e5ed91c2d upgrade to year 2015
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 689
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
0
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7 *
3959d33612cc initial commit
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.
136
fe180eae201d openssl exception
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 59
diff changeset
12 *
0
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
13 * This program is distributed in the hope that it will be useful, but
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
14 * WITHOUT ANY WARRANTY; without even the implied warranty of
3959d33612cc initial commit
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.
0
3959d33612cc initial commit
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/>.
0
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
21 **/
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
22
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
23
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
24 #pragma once
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
25
2905
ae20fccdd867 refactoring mime types
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2863
diff changeset
26 #include "../Enumerations.h"
ae20fccdd867 refactoring mime types
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2863
diff changeset
27
2417
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2412
diff changeset
28 #include <stdint.h>
1737
ec66a16aa398 removal of DicomStringValue and DicomNullValue
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1288
diff changeset
29 #include <boost/noncopyable.hpp>
2863
da12ba232119 serialization of DicomMap
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2447
diff changeset
30 #include <json/value.h>
0
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
31
2138
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1900
diff changeset
32 #if !defined(ORTHANC_ENABLE_BASE64)
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1900
diff changeset
33 # error The macro ORTHANC_ENABLE_BASE64 must be defined
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1900
diff changeset
34 #endif
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1900
diff changeset
35
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1900
diff changeset
36
59
c996319e90bc renaming in Core
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 50
diff changeset
37 namespace Orthanc
0
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
38 {
3992
f9863630ec7f working on the shared library for Orthanc framework
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3690
diff changeset
39 class ORTHANC_PUBLIC DicomValue : public boost::noncopyable
0
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
40 {
1737
ec66a16aa398 removal of DicomStringValue and DicomNullValue
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1288
diff changeset
41 private:
ec66a16aa398 removal of DicomStringValue and DicomNullValue
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1288
diff changeset
42 enum Type
ec66a16aa398 removal of DicomStringValue and DicomNullValue
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1288
diff changeset
43 {
ec66a16aa398 removal of DicomStringValue and DicomNullValue
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1288
diff changeset
44 Type_Null,
ec66a16aa398 removal of DicomStringValue and DicomNullValue
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1288
diff changeset
45 Type_String,
ec66a16aa398 removal of DicomStringValue and DicomNullValue
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1288
diff changeset
46 Type_Binary
ec66a16aa398 removal of DicomStringValue and DicomNullValue
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1288
diff changeset
47 };
ec66a16aa398 removal of DicomStringValue and DicomNullValue
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1288
diff changeset
48
ec66a16aa398 removal of DicomStringValue and DicomNullValue
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1288
diff changeset
49 Type type_;
ec66a16aa398 removal of DicomStringValue and DicomNullValue
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1288
diff changeset
50 std::string content_;
ec66a16aa398 removal of DicomStringValue and DicomNullValue
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1288
diff changeset
51
1738
15a788a63846 DicomToJsonFlags_IncludeBinary
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1737
diff changeset
52 DicomValue(const DicomValue& other);
0
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
53
1737
ec66a16aa398 removal of DicomStringValue and DicomNullValue
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1288
diff changeset
54 public:
4296
3b70a2e6a06c moving inline methods to source files for ABI compatibility
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4119
diff changeset
55 DicomValue();
1737
ec66a16aa398 removal of DicomStringValue and DicomNullValue
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1288
diff changeset
56
ec66a16aa398 removal of DicomStringValue and DicomNullValue
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1288
diff changeset
57 DicomValue(const std::string& content,
1738
15a788a63846 DicomToJsonFlags_IncludeBinary
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1737
diff changeset
58 bool isBinary);
1737
ec66a16aa398 removal of DicomStringValue and DicomNullValue
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1288
diff changeset
59
ec66a16aa398 removal of DicomStringValue and DicomNullValue
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1288
diff changeset
60 DicomValue(const char* data,
ec66a16aa398 removal of DicomStringValue and DicomNullValue
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1288
diff changeset
61 size_t size,
1738
15a788a63846 DicomToJsonFlags_IncludeBinary
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1737
diff changeset
62 bool isBinary);
1737
ec66a16aa398 removal of DicomStringValue and DicomNullValue
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1288
diff changeset
63
1738
15a788a63846 DicomToJsonFlags_IncludeBinary
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1737
diff changeset
64 const std::string& GetContent() const;
0
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
65
4296
3b70a2e6a06c moving inline methods to source files for ABI compatibility
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4119
diff changeset
66 bool IsNull() const;
1737
ec66a16aa398 removal of DicomStringValue and DicomNullValue
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1288
diff changeset
67
4296
3b70a2e6a06c moving inline methods to source files for ABI compatibility
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4119
diff changeset
68 bool IsBinary() const;
1737
ec66a16aa398 removal of DicomStringValue and DicomNullValue
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1288
diff changeset
69
1738
15a788a63846 DicomToJsonFlags_IncludeBinary
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1737
diff changeset
70 DicomValue* Clone() const;
15a788a63846 DicomToJsonFlags_IncludeBinary
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1737
diff changeset
71
2138
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1900
diff changeset
72 #if ORTHANC_ENABLE_BASE64 == 1
1738
15a788a63846 DicomToJsonFlags_IncludeBinary
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1737
diff changeset
73 void FormatDataUriScheme(std::string& target,
15a788a63846 DicomToJsonFlags_IncludeBinary
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1737
diff changeset
74 const std::string& mime) const;
15a788a63846 DicomToJsonFlags_IncludeBinary
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1737
diff changeset
75
4304
50b0c69b653a continued abi
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4296
diff changeset
76 void FormatDataUriScheme(std::string& target) const;
1761
f4286d99ee0a fix sample database plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1738
diff changeset
77 #endif
2410
3590c936e56f parsing numbers in DicomValue
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2244
diff changeset
78
2412
cad393b41bc3 handy shortcuts in DicomMap
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2410
diff changeset
79 bool CopyToString(std::string& result,
cad393b41bc3 handy shortcuts in DicomMap
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2410
diff changeset
80 bool allowBinary) const;
cad393b41bc3 handy shortcuts in DicomMap
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2410
diff changeset
81
2410
3590c936e56f parsing numbers in DicomValue
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2244
diff changeset
82 bool ParseInteger32(int32_t& result) const;
3590c936e56f parsing numbers in DicomValue
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2244
diff changeset
83
3590c936e56f parsing numbers in DicomValue
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2244
diff changeset
84 bool ParseInteger64(int64_t& result) const;
3590c936e56f parsing numbers in DicomValue
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2244
diff changeset
85
3590c936e56f parsing numbers in DicomValue
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2244
diff changeset
86 bool ParseUnsignedInteger32(uint32_t& result) const;
3590c936e56f parsing numbers in DicomValue
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2244
diff changeset
87
3590c936e56f parsing numbers in DicomValue
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2244
diff changeset
88 bool ParseUnsignedInteger64(uint64_t& result) const;
3590c936e56f parsing numbers in DicomValue
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2244
diff changeset
89
3590c936e56f parsing numbers in DicomValue
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2244
diff changeset
90 bool ParseFloat(float& result) const;
3590c936e56f parsing numbers in DicomValue
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2244
diff changeset
91
2863
da12ba232119 serialization of DicomMap
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2447
diff changeset
92 bool ParseDouble(double& result) const;
da12ba232119 serialization of DicomMap
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2447
diff changeset
93
3690
a9ce35d67c3c implementation of "/instances/.../rendered" for grayscale images
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3640
diff changeset
94 bool ParseFirstFloat(float& result) const;
a9ce35d67c3c implementation of "/instances/.../rendered" for grayscale images
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3640
diff changeset
95
3519
fc26659493b6 added support for COLUMNS/ROWS tags with invalid 800\0 value observed in some US images
amazy
parents: 3060
diff changeset
96 bool ParseFirstUnsignedInteger(unsigned int& result) const;
fc26659493b6 added support for COLUMNS/ROWS tags with invalid 800\0 value observed in some US images
amazy
parents: 3060
diff changeset
97
2863
da12ba232119 serialization of DicomMap
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2447
diff changeset
98 void Serialize(Json::Value& target) const;
da12ba232119 serialization of DicomMap
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2447
diff changeset
99
da12ba232119 serialization of DicomMap
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2447
diff changeset
100 void Unserialize(const Json::Value& source);
0
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
101 };
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
102 }