annotate OrthancFramework/Sources/DicomParsing/FromDcmtkBridge.h @ 4226:7bd5eab3ba25

prototyping IWebDavBucket
author Sebastien Jodogne <s.jodogne@gmail.com>
date Sun, 04 Oct 2020 13:23:53 +0200
parents 0ddc5297a8ab
children 785a2713323e
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 /**
62
a70bb32802ae renaming Server
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 57
diff changeset
2 * Orthanc - A Lightweight, RESTful DICOM Store
1900
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1831
diff changeset
3 * Copyright (C) 2012-2016 Sebastien Jodogne, Medical Physics
1288
6e7e5ed91c2d upgrade to year 2015
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1004
diff changeset
4 * Department, University Hospital of Liege, Belgium
3640
94f4a18a79cc upgrade to year 2020
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3577
diff changeset
5 * Copyright (C) 2017-2020 Osimis S.A., Belgium
0
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6 *
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7 * 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: 4105
diff changeset
8 * 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: 4105
diff changeset
9 * 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: 4105
diff changeset
10 * the License, or (at your option) any later version.
136
fe180eae201d openssl exception
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 62
diff changeset
11 *
0
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
12 * 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
13 * WITHOUT ANY WARRANTY; without even the implied warranty of
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
14 * 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: 4105
diff changeset
15 * Lesser General Public License for more details.
0
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
16 *
4119
bf7b9edf6b81 re-licensing the OrthancFramework to LGPL, in order to license Stone of Orthanc under LGPL
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4105
diff changeset
17 * 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: 4105
diff changeset
18 * 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: 4105
diff changeset
19 * <http://www.gnu.org/licenses/>.
0
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
20 **/
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 #pragma once
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
24
2499
83b8b6743531 ITagVisitor - for anonymization relationships
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2447
diff changeset
25 #include "ITagVisitor.h"
2382
7284093111b0 big reorganization to cleanly separate framework vs. server
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2381
diff changeset
26 #include "../DicomFormat/DicomElement.h"
7284093111b0 big reorganization to cleanly separate framework vs. server
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2381
diff changeset
27 #include "../DicomFormat/DicomMap.h"
791
381f90e2b69d refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 790
diff changeset
28
0
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
29 #include <dcmtk/dcmdata/dcdatset.h>
1831
3ae2ff249675 "/instances/.../header" to get the meta information (header) of the DICOM instance
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1818
diff changeset
30 #include <dcmtk/dcmdata/dcmetinf.h>
1924
6c73df12ca51 New URI: "/instances/.../frames/.../raw" to access the raw frames (bypass image decoding)
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1900
diff changeset
31 #include <dcmtk/dcmdata/dcpixseq.h>
1935
e251606c1433 FromDcmtkBridge::LoadFromMemoryBuffer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1934
diff changeset
32 #include <dcmtk/dcmdata/dcfilefo.h>
0
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
33 #include <json/json.h>
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
34
2380
96b3ec054b69 reorganization in macros
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2244
diff changeset
35 #if ORTHANC_ENABLE_DCMTK != 1
96b3ec054b69 reorganization in macros
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2244
diff changeset
36 # error The macro ORTHANC_ENABLE_DCMTK must be set to 1
2232
3dd44baebc36 macro ORTHANC_ENABLE_LUA for orthanc-wsi
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2218
diff changeset
37 #endif
3dd44baebc36 macro ORTHANC_ENABLE_LUA for orthanc-wsi
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2218
diff changeset
38
2126
03b065778fc3 cleaning up
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2125
diff changeset
39 #if ORTHANC_BUILD_UNIT_TESTS == 1
03b065778fc3 cleaning up
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2125
diff changeset
40 # include <gtest/gtest_prod.h>
03b065778fc3 cleaning up
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2125
diff changeset
41 #endif
03b065778fc3 cleaning up
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2125
diff changeset
42
2381
b8969010b534 uncoupling DCMTK primitives from Orthanc::Configuration
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2380
diff changeset
43 #if !defined(ORTHANC_ENABLE_DCMTK_JPEG)
b8969010b534 uncoupling DCMTK primitives from Orthanc::Configuration
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2380
diff changeset
44 # error The macro ORTHANC_ENABLE_DCMTK_JPEG must be defined
b8969010b534 uncoupling DCMTK primitives from Orthanc::Configuration
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2380
diff changeset
45 #endif
b8969010b534 uncoupling DCMTK primitives from Orthanc::Configuration
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2380
diff changeset
46
b8969010b534 uncoupling DCMTK primitives from Orthanc::Configuration
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2380
diff changeset
47 #if !defined(ORTHANC_ENABLE_DCMTK_JPEG_LOSSLESS)
b8969010b534 uncoupling DCMTK primitives from Orthanc::Configuration
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2380
diff changeset
48 # error The macro ORTHANC_ENABLE_DCMTK_JPEG_LOSSLESS must be defined
b8969010b534 uncoupling DCMTK primitives from Orthanc::Configuration
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2380
diff changeset
49 #endif
b8969010b534 uncoupling DCMTK primitives from Orthanc::Configuration
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2380
diff changeset
50
2126
03b065778fc3 cleaning up
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2125
diff changeset
51
62
a70bb32802ae renaming Server
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 57
diff changeset
52 namespace Orthanc
0
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
53 {
3992
f9863630ec7f working on the shared library for Orthanc framework
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3885
diff changeset
54 class ORTHANC_PUBLIC FromDcmtkBridge : public boost::noncopyable
0
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
55 {
2126
03b065778fc3 cleaning up
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2125
diff changeset
56 #if ORTHANC_BUILD_UNIT_TESTS == 1
03b065778fc3 cleaning up
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2125
diff changeset
57 FRIEND_TEST(FromDcmtkBridge, FromJson);
03b065778fc3 cleaning up
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2125
diff changeset
58 #endif
03b065778fc3 cleaning up
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2125
diff changeset
59
2128
9329ba17a069 Possibility to DELETE "dicom-as-json" attachments to reconstruct them
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2126
diff changeset
60 friend class ParsedDicomFile;
9329ba17a069 Possibility to DELETE "dicom-as-json" attachments to reconstruct them
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2126
diff changeset
61
2125
b9bd52c72ba2 cleaning up
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2115
diff changeset
62 private:
b9bd52c72ba2 cleaning up
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2115
diff changeset
63 FromDcmtkBridge(); // Pure static class
b9bd52c72ba2 cleaning up
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2115
diff changeset
64
2126
03b065778fc3 cleaning up
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2125
diff changeset
65 static void DatasetToJson(Json::Value& parent,
03b065778fc3 cleaning up
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2125
diff changeset
66 DcmItem& item,
03b065778fc3 cleaning up
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2125
diff changeset
67 DicomToJsonFormat format,
03b065778fc3 cleaning up
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2125
diff changeset
68 DicomToJsonFlags flags,
03b065778fc3 cleaning up
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2125
diff changeset
69 unsigned int maxStringLength,
2409
e4045b3c9772 ignore-length argument if retrieving DICOM tags
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2382
diff changeset
70 Encoding encoding,
3217
cf8cbeb35f33 preliminary support of Korean character set
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3060
diff changeset
71 bool hasCodeExtensions,
2409
e4045b3c9772 ignore-length argument if retrieving DICOM tags
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2382
diff changeset
72 const std::set<DicomTag>& ignoreTagLength);
2126
03b065778fc3 cleaning up
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2125
diff changeset
73
03b065778fc3 cleaning up
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2125
diff changeset
74 static void ElementToJson(Json::Value& parent,
03b065778fc3 cleaning up
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2125
diff changeset
75 DcmElement& element,
03b065778fc3 cleaning up
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2125
diff changeset
76 DicomToJsonFormat format,
03b065778fc3 cleaning up
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2125
diff changeset
77 DicomToJsonFlags flags,
03b065778fc3 cleaning up
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2125
diff changeset
78 unsigned int maxStringLength,
2409
e4045b3c9772 ignore-length argument if retrieving DICOM tags
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2382
diff changeset
79 Encoding dicomEncoding,
3217
cf8cbeb35f33 preliminary support of Korean character set
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3060
diff changeset
80 bool hasCodeExtensions,
2409
e4045b3c9772 ignore-length argument if retrieving DICOM tags
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2382
diff changeset
81 const std::set<DicomTag>& ignoreTagLength);
2126
03b065778fc3 cleaning up
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2125
diff changeset
82
2207
6dc3bdb4088b Fix handling of encodings in C-FIND for worklists
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2151
diff changeset
83 static void ChangeStringEncoding(DcmItem& dataset,
6dc3bdb4088b Fix handling of encodings in C-FIND for worklists
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2151
diff changeset
84 Encoding source,
3217
cf8cbeb35f33 preliminary support of Korean character set
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3060
diff changeset
85 bool hasSourceCodeExtensions,
2207
6dc3bdb4088b Fix handling of encodings in C-FIND for worklists
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2151
diff changeset
86 Encoding target);
6dc3bdb4088b Fix handling of encodings in C-FIND for worklists
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2151
diff changeset
87
0
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
88 public:
2151
8cbb55089a1d New configuration option: "LoadPrivateDictionary"
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2131
diff changeset
89 static void InitializeDictionary(bool loadPrivateDictionary);
1656
d3ba98d6b6e9 refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1655
diff changeset
90
1657
5360cdba70d8 New function "OrthancPluginRegisterDictionaryTag()" to declare DICOM tags
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1656
diff changeset
91 static void RegisterDictionaryTag(const DicomTag& tag,
2006
6301bbcbcaed more generic support of value representations
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1998
diff changeset
92 ValueRepresentation vr,
1657
5360cdba70d8 New function "OrthancPluginRegisterDictionaryTag()" to declare DICOM tags
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1656
diff changeset
93 const std::string& name,
5360cdba70d8 New function "OrthancPluginRegisterDictionaryTag()" to declare DICOM tags
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1656
diff changeset
94 unsigned int minMultiplicity,
2115
a657f7772e69 Handling of private tags/creators in the "Dictionary" configuration option
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2006
diff changeset
95 unsigned int maxMultiplicity,
a657f7772e69 Handling of private tags/creators in the "Dictionary" configuration option
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2006
diff changeset
96 const std::string& privateCreator);
1657
5360cdba70d8 New function "OrthancPluginRegisterDictionaryTag()" to declare DICOM tags
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1656
diff changeset
97
3217
cf8cbeb35f33 preliminary support of Korean character set
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3060
diff changeset
98 static Encoding DetectEncoding(bool& hasCodeExtensions,
cf8cbeb35f33 preliminary support of Korean character set
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3060
diff changeset
99 DcmItem& dataset,
1928
84c7eaeb5244 Configuration::GetDefaultEncoding
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1924
diff changeset
100 Encoding defaultEncoding);
956
2fd5a163776d primitives for proper encoding handling
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 874
diff changeset
101
3232
01a5b2530b68 thin compatibility wrapper for FromDcmtkBridge::DetectEncoding()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3217
diff changeset
102 static Encoding DetectEncoding(DcmItem& dataset,
01a5b2530b68 thin compatibility wrapper for FromDcmtkBridge::DetectEncoding()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3217
diff changeset
103 Encoding defaultEncoding)
01a5b2530b68 thin compatibility wrapper for FromDcmtkBridge::DetectEncoding()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3217
diff changeset
104 {
01a5b2530b68 thin compatibility wrapper for FromDcmtkBridge::DetectEncoding()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3217
diff changeset
105 // Compatibility wrapper for Orthanc <= 1.5.4
01a5b2530b68 thin compatibility wrapper for FromDcmtkBridge::DetectEncoding()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3217
diff changeset
106 bool hasCodeExtensions; // ignored
01a5b2530b68 thin compatibility wrapper for FromDcmtkBridge::DetectEncoding()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3217
diff changeset
107 return DetectEncoding(hasCodeExtensions, dataset, defaultEncoding);
01a5b2530b68 thin compatibility wrapper for FromDcmtkBridge::DetectEncoding()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3217
diff changeset
108 }
01a5b2530b68 thin compatibility wrapper for FromDcmtkBridge::DetectEncoding()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3217
diff changeset
109
991
2f76b92addd4 keep private tags during anonymization
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 956
diff changeset
110 static DicomTag Convert(const DcmTag& tag);
2f76b92addd4 keep private tags during anonymization
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 956
diff changeset
111
0
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
112 static DicomTag GetTag(const DcmElement& element);
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
113
1655
e40fd0d925c5 /tools/create-dicom can create tags with unknown VR
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1417
diff changeset
114 static bool IsUnknownTag(const DicomTag& tag);
e40fd0d925c5 /tools/create-dicom can create tags with unknown VR
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1417
diff changeset
115
956
2fd5a163776d primitives for proper encoding handling
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 874
diff changeset
116 static DicomValue* ConvertLeafElement(DcmElement& element,
1736
b953c6eef28d ToJson: IncludePrivateTags and IncludeUnknownTags
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1735
diff changeset
117 DicomToJsonFlags flags,
1929
cda5b0ab4ce5 ORTHANC_MAXIMUM_TAG_LENGTH made explicit
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1928
diff changeset
118 unsigned int maxStringLength,
2409
e4045b3c9772 ignore-length argument if retrieving DICOM tags
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2382
diff changeset
119 Encoding encoding,
3217
cf8cbeb35f33 preliminary support of Korean character set
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3060
diff changeset
120 bool hasCodeExtensions,
2409
e4045b3c9772 ignore-length argument if retrieving DICOM tags
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2382
diff changeset
121 const std::set<DicomTag>& ignoreTagLength);
0
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
122
2126
03b065778fc3 cleaning up
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2125
diff changeset
123 static void ExtractHeaderAsJson(Json::Value& target,
03b065778fc3 cleaning up
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2125
diff changeset
124 DcmMetaInfo& header,
03b065778fc3 cleaning up
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2125
diff changeset
125 DicomToJsonFormat format,
03b065778fc3 cleaning up
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2125
diff changeset
126 DicomToJsonFlags flags,
03b065778fc3 cleaning up
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2125
diff changeset
127 unsigned int maxStringLength);
1831
3ae2ff249675 "/instances/.../header" to get the meta information (header) of the DICOM instance
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1818
diff changeset
128
2115
a657f7772e69 Handling of private tags/creators in the "Dictionary" configuration option
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2006
diff changeset
129 static std::string GetTagName(const DicomTag& tag,
a657f7772e69 Handling of private tags/creators in the "Dictionary" configuration option
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2006
diff changeset
130 const std::string& privateCreator);
a657f7772e69 Handling of private tags/creators in the "Dictionary" configuration option
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2006
diff changeset
131
a657f7772e69 Handling of private tags/creators in the "Dictionary" configuration option
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2006
diff changeset
132 static std::string GetTagName(const DcmElement& element);
a657f7772e69 Handling of private tags/creators in the "Dictionary" configuration option
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2006
diff changeset
133
a657f7772e69 Handling of private tags/creators in the "Dictionary" configuration option
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2006
diff changeset
134 static std::string GetTagName(const DicomElement& element)
a657f7772e69 Handling of private tags/creators in the "Dictionary" configuration option
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2006
diff changeset
135 {
a657f7772e69 Handling of private tags/creators in the "Dictionary" configuration option
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2006
diff changeset
136 return GetTagName(element.GetTag(), "");
a657f7772e69 Handling of private tags/creators in the "Dictionary" configuration option
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2006
diff changeset
137 }
0
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
138
304
4eea080e6e7a refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 302
diff changeset
139 static DicomTag ParseTag(const char* name);
0
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
140
304
4eea080e6e7a refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 302
diff changeset
141 static DicomTag ParseTag(const std::string& name)
0
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
142 {
304
4eea080e6e7a refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 302
diff changeset
143 return ParseTag(name.c_str());
0
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
144 }
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
145
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
146 static bool HasTag(const DicomMap& fields,
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
147 const std::string& tagName)
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
148 {
304
4eea080e6e7a refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 302
diff changeset
149 return fields.HasTag(ParseTag(tagName));
0
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
150 }
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
151
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
152 static const DicomValue& GetValue(const DicomMap& fields,
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
153 const std::string& tagName)
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
154 {
304
4eea080e6e7a refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 302
diff changeset
155 return fields.GetValue(ParseTag(tagName));
0
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
156 }
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
157
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
158 static void SetValue(DicomMap& target,
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
159 const std::string& tagName,
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
160 DicomValue* value)
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
161 {
3651
46cb00e4adbb DicomMap::DumpMainDicomTags() and DicomMap::ParseMainDicomTags()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3640
diff changeset
162 const DicomTag tag = ParseTag(tagName);
46cb00e4adbb DicomMap::DumpMainDicomTags() and DicomMap::ParseMainDicomTags()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3640
diff changeset
163 target.SetValueInternal(tag.GetGroup(), tag.GetElement(), value);
0
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
164 }
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
165
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
166 static void ToJson(Json::Value& result,
1368
b22ba8c5edbe query retrieve
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1360
diff changeset
167 const DicomMap& values,
b22ba8c5edbe query retrieve
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1360
diff changeset
168 bool simplify);
176
81f11fb357f2 uid generation
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 136
diff changeset
169
788
7ebe4bf87196 refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 784
diff changeset
170 static std::string GenerateUniqueIdentifier(ResourceType level);
291
4d7469f72a0b embedding of dicom dictionaries
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 285
diff changeset
171
4d7469f72a0b embedding of dicom dictionaries
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 285
diff changeset
172 static bool SaveToMemoryBuffer(std::string& buffer,
1004
a226e0959d8b DicomInstanceToStore
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 991
diff changeset
173 DcmDataset& dataSet);
1360
0649c5aef34a DicomFindQuery
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1288
diff changeset
174
3872
b40dfa6dc8da working on a simpler abstraction for transcoding
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3748
diff changeset
175 static bool Transcode(DcmFileFormat& dicom,
3748
ca36e3f1112c transcoding to uncompressed transfer syntaxes
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3743
diff changeset
176 DicomTransferSyntax syntax,
ca36e3f1112c transcoding to uncompressed transfer syntaxes
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3743
diff changeset
177 const DcmRepresentationParameter* representation);
ca36e3f1112c transcoding to uncompressed transfer syntaxes
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3743
diff changeset
178
2006
6301bbcbcaed more generic support of value representations
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1998
diff changeset
179 static ValueRepresentation Convert(DcmEVR vr);
6301bbcbcaed more generic support of value representations
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1998
diff changeset
180
6301bbcbcaed more generic support of value representations
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1998
diff changeset
181 static ValueRepresentation LookupValueRepresentation(const DicomTag& tag);
1689
26083d84d237 refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1686
diff changeset
182
3691
4922bdd046dd Fix issue #140 (Modifying private tags with REST API changes VR from LO to UN) - DANGEROUS COMMIT
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3651
diff changeset
183 static DcmElement* CreateElementForTag(const DicomTag& tag,
4922bdd046dd Fix issue #140 (Modifying private tags with REST API changes VR from LO to UN) - DANGEROUS COMMIT
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3651
diff changeset
184 const std::string& privateCreator);
1689
26083d84d237 refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1686
diff changeset
185
26083d84d237 refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1686
diff changeset
186 static void FillElementWithString(DcmElement& element,
1695
18c02c6987d5 fix for encodings
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1694
diff changeset
187 const std::string& utf8alue, // Encoded using UTF-8
1818
1065401501fb ParsedDicomFile::CreateFromJson
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1765
diff changeset
188 bool decodeDataUriScheme,
1695
18c02c6987d5 fix for encodings
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1694
diff changeset
189 Encoding dicomEncoding);
1689
26083d84d237 refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1686
diff changeset
190
1693
558b25228a23 creation of tag hierarchy from json
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1690
diff changeset
191 static DcmElement* FromJson(const DicomTag& tag,
1934
72a2fd7fed8b FromDcmtkBridge::FromJson
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1929
diff changeset
192 const Json::Value& element, // Encoded using UTF-8
1818
1065401501fb ParsedDicomFile::CreateFromJson
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1765
diff changeset
193 bool decodeDataUriScheme,
3691
4922bdd046dd Fix issue #140 (Modifying private tags with REST API changes VR from LO to UN) - DANGEROUS COMMIT
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3651
diff changeset
194 Encoding dicomEncoding,
4922bdd046dd Fix issue #140 (Modifying private tags with REST API changes VR from LO to UN) - DANGEROUS COMMIT
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3651
diff changeset
195 const std::string& privateCreator);
1765
57b9e6890482 New configuration option: "Dictionary" to declare custom DICOM tags
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1737
diff changeset
196
1924
6c73df12ca51 New URI: "/instances/.../frames/.../raw" to access the raw frames (bypass image decoding)
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1900
diff changeset
197 static DcmPixelSequence* GetPixelSequence(DcmDataset& dataset);
1934
72a2fd7fed8b FromDcmtkBridge::FromJson
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1929
diff changeset
198
72a2fd7fed8b FromDcmtkBridge::FromJson
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1929
diff changeset
199 static Encoding ExtractEncoding(const Json::Value& json,
72a2fd7fed8b FromDcmtkBridge::FromJson
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1929
diff changeset
200 Encoding defaultEncoding);
72a2fd7fed8b FromDcmtkBridge::FromJson
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1929
diff changeset
201
72a2fd7fed8b FromDcmtkBridge::FromJson
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1929
diff changeset
202 static DcmDataset* FromJson(const Json::Value& json, // Encoded using UTF-8
72a2fd7fed8b FromDcmtkBridge::FromJson
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1929
diff changeset
203 bool generateIdentifiers,
72a2fd7fed8b FromDcmtkBridge::FromJson
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1929
diff changeset
204 bool decodeDataUriScheme,
3691
4922bdd046dd Fix issue #140 (Modifying private tags with REST API changes VR from LO to UN) - DANGEROUS COMMIT
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3651
diff changeset
205 Encoding defaultEncoding,
4922bdd046dd Fix issue #140 (Modifying private tags with REST API changes VR from LO to UN) - DANGEROUS COMMIT
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3651
diff changeset
206 const std::string& privateCreator);
1935
e251606c1433 FromDcmtkBridge::LoadFromMemoryBuffer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1934
diff changeset
207
e251606c1433 FromDcmtkBridge::LoadFromMemoryBuffer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1934
diff changeset
208 static DcmFileFormat* LoadFromMemoryBuffer(const void* buffer,
e251606c1433 FromDcmtkBridge::LoadFromMemoryBuffer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1934
diff changeset
209 size_t size);
1998
9b61701c35f2 New URI "/modalities/.../move" to issue C-Move SCU requests
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1936
diff changeset
210
9b61701c35f2 New URI "/modalities/.../move" to issue C-Move SCU requests
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1936
diff changeset
211 static void FromJson(DicomMap& values,
9b61701c35f2 New URI "/modalities/.../move" to issue C-Move SCU requests
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1936
diff changeset
212 const Json::Value& result);
2209
e3fd5bc429a2 URI to reconstruct the main DICOM tags, the JSON summary and the metadata
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2207
diff changeset
213
2381
b8969010b534 uncoupling DCMTK primitives from Orthanc::Configuration
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2380
diff changeset
214 static void ExtractDicomSummary(DicomMap& target,
3577
33cfcc74d1b1 argument "ignoreTagLength" to ParsedDicomFile::ExtractDicomSummary()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3232
diff changeset
215 DcmItem& dataset,
4136
2724977419fb Fix DICOM SCP filters if some query tag has more than 256 characters
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4119
diff changeset
216 unsigned int maxStringLength,
3577
33cfcc74d1b1 argument "ignoreTagLength" to ParsedDicomFile::ExtractDicomSummary()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3232
diff changeset
217 const std::set<DicomTag>& ignoreTagLength);
33cfcc74d1b1 argument "ignoreTagLength" to ParsedDicomFile::ExtractDicomSummary()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3232
diff changeset
218
2381
b8969010b534 uncoupling DCMTK primitives from Orthanc::Configuration
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2380
diff changeset
219 static void ExtractDicomAsJson(Json::Value& target,
2409
e4045b3c9772 ignore-length argument if retrieving DICOM tags
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2382
diff changeset
220 DcmDataset& dataset,
4140
0ddc5297a8ab centralization of default parameters for JSON/DicomMap conversions from DCMTK
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4137
diff changeset
221 DicomToJsonFormat format,
0ddc5297a8ab centralization of default parameters for JSON/DicomMap conversions from DCMTK
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4137
diff changeset
222 DicomToJsonFlags flags,
0ddc5297a8ab centralization of default parameters for JSON/DicomMap conversions from DCMTK
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4137
diff changeset
223 unsigned int maxStringLength,
2409
e4045b3c9772 ignore-length argument if retrieving DICOM tags
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2382
diff changeset
224 const std::set<DicomTag>& ignoreTagLength);
2381
b8969010b534 uncoupling DCMTK primitives from Orthanc::Configuration
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2380
diff changeset
225
b8969010b534 uncoupling DCMTK primitives from Orthanc::Configuration
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2380
diff changeset
226 static void InitializeCodecs();
b8969010b534 uncoupling DCMTK primitives from Orthanc::Configuration
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2380
diff changeset
227
b8969010b534 uncoupling DCMTK primitives from Orthanc::Configuration
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2380
diff changeset
228 static void FinalizeCodecs();
2499
83b8b6743531 ITagVisitor - for anonymization relationships
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2447
diff changeset
229
83b8b6743531 ITagVisitor - for anonymization relationships
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2447
diff changeset
230 static void Apply(DcmItem& dataset,
83b8b6743531 ITagVisitor - for anonymization relationships
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2447
diff changeset
231 ITagVisitor& visitor,
83b8b6743531 ITagVisitor - for anonymization relationships
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2447
diff changeset
232 Encoding defaultEncoding);
3727
090022f1b5e1 auto-generation of primitives to handle transfer syntaxes
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3691
diff changeset
233
3743
33c19a6643e1 creating IDicomTranscoder abstraction
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3727
diff changeset
234 static bool LookupDcmtkTransferSyntax(E_TransferSyntax& target,
33c19a6643e1 creating IDicomTranscoder abstraction
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3727
diff changeset
235 DicomTransferSyntax source);
33c19a6643e1 creating IDicomTranscoder abstraction
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3727
diff changeset
236
33c19a6643e1 creating IDicomTranscoder abstraction
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3727
diff changeset
237 static bool LookupOrthancTransferSyntax(DicomTransferSyntax& target,
33c19a6643e1 creating IDicomTranscoder abstraction
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3727
diff changeset
238 E_TransferSyntax source);
3881
f23ab7829a8d reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3872
diff changeset
239
f23ab7829a8d reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3872
diff changeset
240 static bool LookupOrthancTransferSyntax(DicomTransferSyntax& target,
3882
904575738462 implemented IDicomTranscoder::Store()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3881
diff changeset
241 DcmFileFormat& dicom);
0
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
242 };
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
243 }