Mercurial > hg > orthanc
annotate OrthancServer/FromDcmtkBridge.h @ 1926:2a129de4b5e2
EnumerationToString for PixelFormat
author | Sebastien Jodogne <s.jodogne@gmail.com> |
---|---|
date | Wed, 09 Mar 2016 09:53:41 +0100 |
parents | 6c73df12ca51 |
children | 84c7eaeb5244 |
rev | line source |
---|---|
0 | 1 /** |
62 | 2 * Orthanc - A Lightweight, RESTful DICOM Store |
1900 | 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 |
0 | 5 * |
6 * This program is free software: you can redistribute it and/or | |
7 * modify it under the terms of the GNU General Public License as | |
8 * published by the Free Software Foundation, either version 3 of the | |
9 * License, or (at your option) any later version. | |
136 | 10 * |
11 * In addition, as a special exception, the copyright holders of this | |
12 * program give permission to link the code of its release with the | |
13 * OpenSSL project's "OpenSSL" library (or with modified versions of it | |
14 * that use the same license as the "OpenSSL" library), and distribute | |
15 * the linked executables. You must obey the GNU General Public License | |
16 * in all respects for all of the code used other than "OpenSSL". If you | |
17 * modify file(s) with this exception, you may extend this exception to | |
18 * your version of the file(s), but you are not obligated to do so. If | |
19 * you do not wish to do so, delete this exception statement from your | |
20 * version. If you delete this exception statement from all source files | |
21 * in the program, then also delete it here. | |
0 | 22 * |
23 * This program is distributed in the hope that it will be useful, but | |
24 * WITHOUT ANY WARRANTY; without even the implied warranty of | |
25 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |
26 * General Public License for more details. | |
27 * | |
28 * You should have received a copy of the GNU General Public License | |
29 * along with this program. If not, see <http://www.gnu.org/licenses/>. | |
30 **/ | |
31 | |
32 | |
33 #pragma once | |
34 | |
789 | 35 #include "ServerEnumerations.h" |
285
4031f73fe0e4
access to the raw dicom tags
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
176
diff
changeset
|
36 |
791 | 37 #include "../Core/DicomFormat/DicomMap.h" |
38 | |
0 | 39 #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
|
40 #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
|
41 #include <dcmtk/dcmdata/dcpixseq.h> |
0 | 42 #include <json/json.h> |
43 | |
62 | 44 namespace Orthanc |
0 | 45 { |
46 class FromDcmtkBridge | |
47 { | |
48 public: | |
1656 | 49 static void InitializeDictionary(); |
50 | |
1657
5360cdba70d8
New function "OrthancPluginRegisterDictionaryTag()" to declare DICOM tags
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1656
diff
changeset
|
51 static void RegisterDictionaryTag(const DicomTag& tag, |
5360cdba70d8
New function "OrthancPluginRegisterDictionaryTag()" to declare DICOM tags
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1656
diff
changeset
|
52 const DcmEVR& vr, |
5360cdba70d8
New function "OrthancPluginRegisterDictionaryTag()" to declare DICOM tags
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1656
diff
changeset
|
53 const std::string& name, |
5360cdba70d8
New function "OrthancPluginRegisterDictionaryTag()" to declare DICOM tags
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1656
diff
changeset
|
54 unsigned int minMultiplicity, |
5360cdba70d8
New function "OrthancPluginRegisterDictionaryTag()" to declare DICOM tags
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1656
diff
changeset
|
55 unsigned int maxMultiplicity); |
5360cdba70d8
New function "OrthancPluginRegisterDictionaryTag()" to declare DICOM tags
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1656
diff
changeset
|
56 |
956
2fd5a163776d
primitives for proper encoding handling
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
874
diff
changeset
|
57 static Encoding DetectEncoding(DcmDataset& dataset); |
2fd5a163776d
primitives for proper encoding handling
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
874
diff
changeset
|
58 |
0 | 59 static void Convert(DicomMap& target, DcmDataset& dataset); |
60 | |
991
2f76b92addd4
keep private tags during anonymization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
956
diff
changeset
|
61 static DicomTag Convert(const DcmTag& tag); |
2f76b92addd4
keep private tags during anonymization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
956
diff
changeset
|
62 |
0 | 63 static DicomTag GetTag(const DcmElement& element); |
64 | |
1655
e40fd0d925c5
/tools/create-dicom can create tags with unknown VR
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1417
diff
changeset
|
65 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
|
66 |
956
2fd5a163776d
primitives for proper encoding handling
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
874
diff
changeset
|
67 static DicomValue* ConvertLeafElement(DcmElement& element, |
1736
b953c6eef28d
ToJson: IncludePrivateTags and IncludeUnknownTags
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1735
diff
changeset
|
68 DicomToJsonFlags flags, |
956
2fd5a163776d
primitives for proper encoding handling
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
874
diff
changeset
|
69 Encoding encoding); |
0 | 70 |
1690 | 71 static void ToJson(Json::Value& parent, |
72 DcmElement& element, | |
73 DicomToJsonFormat format, | |
1735
a001f6226c7c
primitives for flags in dicom-to-json conversions
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1695
diff
changeset
|
74 DicomToJsonFlags flags, |
1690 | 75 unsigned int maxStringLength, |
1735
a001f6226c7c
primitives for flags in dicom-to-json conversions
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1695
diff
changeset
|
76 Encoding dicomEncoding); |
1690 | 77 |
0 | 78 static void ToJson(Json::Value& target, |
79 DcmDataset& dataset, | |
1686 | 80 DicomToJsonFormat format, |
1735
a001f6226c7c
primitives for flags in dicom-to-json conversions
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1695
diff
changeset
|
81 DicomToJsonFlags flags, |
1686 | 82 unsigned int maxStringLength); |
0 | 83 |
1831
3ae2ff249675
"/instances/.../header" to get the meta information (header) of the DICOM instance
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1818
diff
changeset
|
84 static void ToJson(Json::Value& target, |
3ae2ff249675
"/instances/.../header" to get the meta information (header) of the DICOM instance
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1818
diff
changeset
|
85 DcmMetaInfo& header, |
3ae2ff249675
"/instances/.../header" to get the meta information (header) of the DICOM instance
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1818
diff
changeset
|
86 DicomToJsonFormat format, |
3ae2ff249675
"/instances/.../header" to get the meta information (header) of the DICOM instance
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1818
diff
changeset
|
87 DicomToJsonFlags flags, |
3ae2ff249675
"/instances/.../header" to get the meta information (header) of the DICOM instance
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1818
diff
changeset
|
88 unsigned int maxStringLength); |
3ae2ff249675
"/instances/.../header" to get the meta information (header) of the DICOM instance
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1818
diff
changeset
|
89 |
0 | 90 static std::string GetName(const DicomTag& tag); |
91 | |
304 | 92 static DicomTag ParseTag(const char* name); |
0 | 93 |
304 | 94 static DicomTag ParseTag(const std::string& name) |
0 | 95 { |
304 | 96 return ParseTag(name.c_str()); |
0 | 97 } |
98 | |
99 static bool HasTag(const DicomMap& fields, | |
100 const std::string& tagName) | |
101 { | |
304 | 102 return fields.HasTag(ParseTag(tagName)); |
0 | 103 } |
104 | |
105 static const DicomValue& GetValue(const DicomMap& fields, | |
106 const std::string& tagName) | |
107 { | |
304 | 108 return fields.GetValue(ParseTag(tagName)); |
0 | 109 } |
110 | |
111 static void SetValue(DicomMap& target, | |
112 const std::string& tagName, | |
113 DicomValue* value) | |
114 { | |
304 | 115 target.SetValue(ParseTag(tagName), value); |
0 | 116 } |
117 | |
118 static void ToJson(Json::Value& result, | |
1368 | 119 const DicomMap& values, |
120 bool simplify); | |
176 | 121 |
788 | 122 static std::string GenerateUniqueIdentifier(ResourceType level); |
291
4d7469f72a0b
embedding of dicom dictionaries
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
285
diff
changeset
|
123 |
4d7469f72a0b
embedding of dicom dictionaries
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
285
diff
changeset
|
124 static bool SaveToMemoryBuffer(std::string& buffer, |
1004
a226e0959d8b
DicomInstanceToStore
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
991
diff
changeset
|
125 DcmDataset& dataSet); |
1360 | 126 |
1417
8e23f16a198d
fix issues 35 and 37
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1368
diff
changeset
|
127 static ValueRepresentation GetValueRepresentation(const DicomTag& tag); |
1689 | 128 |
129 static DcmElement* CreateElementForTag(const DicomTag& tag); | |
130 | |
131 static void FillElementWithString(DcmElement& element, | |
132 const DicomTag& tag, | |
1695 | 133 const std::string& utf8alue, // Encoded using UTF-8 |
1818
1065401501fb
ParsedDicomFile::CreateFromJson
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1765
diff
changeset
|
134 bool decodeDataUriScheme, |
1695 | 135 Encoding dicomEncoding); |
1689 | 136 |
1693
558b25228a23
creation of tag hierarchy from json
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1690
diff
changeset
|
137 static DcmElement* FromJson(const DicomTag& tag, |
1695 | 138 const Json::Value& element, // Encoding using UTF-8 |
1818
1065401501fb
ParsedDicomFile::CreateFromJson
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1765
diff
changeset
|
139 bool decodeDataUriScheme, |
1695 | 140 Encoding dicomEncoding); |
1765
57b9e6890482
New configuration option: "Dictionary" to declare custom DICOM tags
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1737
diff
changeset
|
141 |
57b9e6890482
New configuration option: "Dictionary" to declare custom DICOM tags
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1737
diff
changeset
|
142 static DcmEVR ParseValueRepresentation(const std::string& s); |
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
|
143 |
6c73df12ca51
New URI: "/instances/.../frames/.../raw" to access the raw frames (bypass image decoding)
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1900
diff
changeset
|
144 static DcmPixelSequence* GetPixelSequence(DcmDataset& dataset); |
0 | 145 }; |
146 } |