Mercurial > hg > orthanc
annotate OrthancFramework/Sources/DicomParsing/FromDcmtkBridge.cpp @ 4044:d25f4c0fa160 framework
splitting code into OrthancFramework and OrthancServer
author | Sebastien Jodogne <s.jodogne@gmail.com> |
---|---|
date | Wed, 10 Jun 2020 20:30:34 +0200 |
parents | Core/DicomParsing/FromDcmtkBridge.cpp@058b5ade8acd |
children | c02a2d9efbc2 |
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:
1147
diff
changeset
|
4 * Department, University Hospital of Liege, Belgium |
3640
94f4a18a79cc
upgrade to year 2020
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3594
diff
changeset
|
5 * Copyright (C) 2017-2020 Osimis S.A., Belgium |
0 | 6 * |
7 * This program is free software: you can redistribute it and/or | |
8 * modify it under the terms of the GNU General Public License as | |
9 * published by the Free Software Foundation, either version 3 of the | |
10 * License, or (at your option) any later version. | |
136 | 11 * |
12 * In addition, as a special exception, the copyright holders of this | |
13 * program give permission to link the code of its release with the | |
14 * OpenSSL project's "OpenSSL" library (or with modified versions of it | |
15 * that use the same license as the "OpenSSL" library), and distribute | |
16 * the linked executables. You must obey the GNU General Public License | |
17 * in all respects for all of the code used other than "OpenSSL". If you | |
18 * modify file(s) with this exception, you may extend this exception to | |
19 * your version of the file(s), but you are not obligated to do so. If | |
20 * you do not wish to do so, delete this exception statement from your | |
21 * version. If you delete this exception statement from all source files | |
22 * in the program, then also delete it here. | |
0 | 23 * |
24 * This program is distributed in the hope that it will be useful, but | |
25 * WITHOUT ANY WARRANTY; without even the implied warranty of | |
26 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |
27 * General Public License for more details. | |
28 * | |
29 * You should have received a copy of the GNU General Public License | |
30 * along with this program. If not, see <http://www.gnu.org/licenses/>. | |
31 **/ | |
32 | |
448
9d830dcc7730
missing copyright information
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
419
diff
changeset
|
33 |
2382
7284093111b0
big reorganization to cleanly separate framework vs. server
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2381
diff
changeset
|
34 #include "../PrecompiledHeaders.h" |
824
a811bdf8b8eb
precompiled headers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
799
diff
changeset
|
35 |
71 | 36 #ifndef NOMINMAX |
37 #define NOMINMAX | |
38 #endif | |
0 | 39 |
2512
4dcafa8d6633
SystemToolbox::GenerateUuid moved to Toolbox::GenerateUuid
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2499
diff
changeset
|
40 #if !defined(ORTHANC_SANDBOXED) |
4dcafa8d6633
SystemToolbox::GenerateUuid moved to Toolbox::GenerateUuid
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2499
diff
changeset
|
41 # error The macro ORTHANC_SANDBOXED must be defined |
4dcafa8d6633
SystemToolbox::GenerateUuid moved to Toolbox::GenerateUuid
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2499
diff
changeset
|
42 #endif |
4dcafa8d6633
SystemToolbox::GenerateUuid moved to Toolbox::GenerateUuid
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2499
diff
changeset
|
43 |
3117 | 44 #if !defined(DCMTK_VERSION_NUMBER) |
45 # error The macro DCMTK_VERSION_NUMBER must be defined | |
46 #endif | |
47 | |
0 | 48 #include "FromDcmtkBridge.h" |
2006
6301bbcbcaed
more generic support of value representations
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1998
diff
changeset
|
49 #include "ToDcmtkBridge.h" |
3712
2a170a8f1faf
replacing std::auto_ptr by std::unique_ptr
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3708
diff
changeset
|
50 #include "../Compatibility.h" |
2382
7284093111b0
big reorganization to cleanly separate framework vs. server
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2381
diff
changeset
|
51 #include "../Logging.h" |
7284093111b0
big reorganization to cleanly separate framework vs. server
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2381
diff
changeset
|
52 #include "../Toolbox.h" |
7284093111b0
big reorganization to cleanly separate framework vs. server
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2381
diff
changeset
|
53 #include "../OrthancException.h" |
0 | 54 |
2512
4dcafa8d6633
SystemToolbox::GenerateUuid moved to Toolbox::GenerateUuid
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2499
diff
changeset
|
55 #if ORTHANC_SANDBOXED == 0 |
4dcafa8d6633
SystemToolbox::GenerateUuid moved to Toolbox::GenerateUuid
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2499
diff
changeset
|
56 # include "../TemporaryFile.h" |
4dcafa8d6633
SystemToolbox::GenerateUuid moved to Toolbox::GenerateUuid
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2499
diff
changeset
|
57 #endif |
4dcafa8d6633
SystemToolbox::GenerateUuid moved to Toolbox::GenerateUuid
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2499
diff
changeset
|
58 |
306
326d5a4a5af3
modification of instances
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
305
diff
changeset
|
59 #include <list> |
71 | 60 #include <limits> |
61 | |
0 | 62 #include <boost/lexical_cast.hpp> |
1656 | 63 #include <boost/filesystem.hpp> |
1927
b60f27664b8f
simplification in FromDcmtkBridge
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1924
diff
changeset
|
64 #include <boost/algorithm/string/predicate.hpp> |
2554
ea63d9f90377
/tags now returns multiple numerical values in a \ separated string
am@osimis.io
parents:
2528
diff
changeset
|
65 #include <boost/algorithm/string/join.hpp> |
0 | 66 |
1927
b60f27664b8f
simplification in FromDcmtkBridge
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1924
diff
changeset
|
67 #include <dcmtk/dcmdata/dcdeftag.h> |
0 | 68 #include <dcmtk/dcmdata/dcdicent.h> |
69 #include <dcmtk/dcmdata/dcdict.h> | |
70 #include <dcmtk/dcmdata/dcfilefo.h> | |
3769
eb044cc49d51
compatibility with DCMTK 3.6.0
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3743
diff
changeset
|
71 #include <dcmtk/dcmdata/dcistrmb.h> |
1927
b60f27664b8f
simplification in FromDcmtkBridge
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1924
diff
changeset
|
72 #include <dcmtk/dcmdata/dcostrmb.h> |
b60f27664b8f
simplification in FromDcmtkBridge
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1924
diff
changeset
|
73 #include <dcmtk/dcmdata/dcpixel.h> |
302
238134081136
modification of dicom files
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
291
diff
changeset
|
74 #include <dcmtk/dcmdata/dcuid.h> |
3769
eb044cc49d51
compatibility with DCMTK 3.6.0
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3743
diff
changeset
|
75 #include <dcmtk/dcmdata/dcxfer.h> |
302
238134081136
modification of dicom files
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
291
diff
changeset
|
76 |
238134081136
modification of dicom files
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
291
diff
changeset
|
77 #include <dcmtk/dcmdata/dcvrae.h> |
238134081136
modification of dicom files
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
291
diff
changeset
|
78 #include <dcmtk/dcmdata/dcvras.h> |
1927
b60f27664b8f
simplification in FromDcmtkBridge
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1924
diff
changeset
|
79 #include <dcmtk/dcmdata/dcvrat.h> |
302
238134081136
modification of dicom files
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
291
diff
changeset
|
80 #include <dcmtk/dcmdata/dcvrcs.h> |
238134081136
modification of dicom files
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
291
diff
changeset
|
81 #include <dcmtk/dcmdata/dcvrda.h> |
238134081136
modification of dicom files
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
291
diff
changeset
|
82 #include <dcmtk/dcmdata/dcvrds.h> |
238134081136
modification of dicom files
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
291
diff
changeset
|
83 #include <dcmtk/dcmdata/dcvrdt.h> |
0 | 84 #include <dcmtk/dcmdata/dcvrfd.h> |
85 #include <dcmtk/dcmdata/dcvrfl.h> | |
302
238134081136
modification of dicom files
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
291
diff
changeset
|
86 #include <dcmtk/dcmdata/dcvris.h> |
238134081136
modification of dicom files
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
291
diff
changeset
|
87 #include <dcmtk/dcmdata/dcvrlo.h> |
238134081136
modification of dicom files
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
291
diff
changeset
|
88 #include <dcmtk/dcmdata/dcvrlt.h> |
238134081136
modification of dicom files
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
291
diff
changeset
|
89 #include <dcmtk/dcmdata/dcvrpn.h> |
238134081136
modification of dicom files
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
291
diff
changeset
|
90 #include <dcmtk/dcmdata/dcvrsh.h> |
0 | 91 #include <dcmtk/dcmdata/dcvrsl.h> |
92 #include <dcmtk/dcmdata/dcvrss.h> | |
302
238134081136
modification of dicom files
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
291
diff
changeset
|
93 #include <dcmtk/dcmdata/dcvrst.h> |
238134081136
modification of dicom files
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
291
diff
changeset
|
94 #include <dcmtk/dcmdata/dcvrtm.h> |
238134081136
modification of dicom files
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
291
diff
changeset
|
95 #include <dcmtk/dcmdata/dcvrui.h> |
0 | 96 #include <dcmtk/dcmdata/dcvrul.h> |
97 #include <dcmtk/dcmdata/dcvrus.h> | |
302
238134081136
modification of dicom files
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
291
diff
changeset
|
98 #include <dcmtk/dcmdata/dcvrut.h> |
0 | 99 |
3209
f6374c36a671
documentation of DICOMweb in SDK, compatibility with DCMTK 3.6.0
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3199
diff
changeset
|
100 #if DCMTK_VERSION_NUMBER >= 361 |
f6374c36a671
documentation of DICOMweb in SDK, compatibility with DCMTK 3.6.0
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3199
diff
changeset
|
101 # include <dcmtk/dcmdata/dcvruc.h> |
f6374c36a671
documentation of DICOMweb in SDK, compatibility with DCMTK 3.6.0
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3199
diff
changeset
|
102 # include <dcmtk/dcmdata/dcvrur.h> |
f6374c36a671
documentation of DICOMweb in SDK, compatibility with DCMTK 3.6.0
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3199
diff
changeset
|
103 #endif |
f6374c36a671
documentation of DICOMweb in SDK, compatibility with DCMTK 3.6.0
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3199
diff
changeset
|
104 |
2381
b8969010b534
uncoupling DCMTK primitives from Orthanc::Configuration
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2364
diff
changeset
|
105 #if DCMTK_USE_EMBEDDED_DICTIONARIES == 1 |
4032
058b5ade8acd
renaming embedded resources
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4030
diff
changeset
|
106 # include <OrthancFrameworkResources.h> |
2381
b8969010b534
uncoupling DCMTK primitives from Orthanc::Configuration
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2364
diff
changeset
|
107 #endif |
682
efc4928be6fb
Recover pixel data for more transfer syntaxes (notably JPEG)
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
677
diff
changeset
|
108 |
2381
b8969010b534
uncoupling DCMTK primitives from Orthanc::Configuration
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2364
diff
changeset
|
109 #if ORTHANC_ENABLE_DCMTK_JPEG == 1 |
b8969010b534
uncoupling DCMTK primitives from Orthanc::Configuration
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2364
diff
changeset
|
110 # include <dcmtk/dcmjpeg/djdecode.h> |
3727
090022f1b5e1
auto-generation of primitives to handle transfer syntaxes
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3712
diff
changeset
|
111 # if ORTHANC_ENABLE_DCMTK_TRANSCODING == 1 |
090022f1b5e1
auto-generation of primitives to handle transfer syntaxes
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3712
diff
changeset
|
112 # include <dcmtk/dcmjpeg/djencode.h> |
090022f1b5e1
auto-generation of primitives to handle transfer syntaxes
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3712
diff
changeset
|
113 # endif |
2381
b8969010b534
uncoupling DCMTK primitives from Orthanc::Configuration
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2364
diff
changeset
|
114 #endif |
b8969010b534
uncoupling DCMTK primitives from Orthanc::Configuration
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2364
diff
changeset
|
115 |
b8969010b534
uncoupling DCMTK primitives from Orthanc::Configuration
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2364
diff
changeset
|
116 #if ORTHANC_ENABLE_DCMTK_JPEG_LOSSLESS == 1 |
b8969010b534
uncoupling DCMTK primitives from Orthanc::Configuration
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2364
diff
changeset
|
117 # include <dcmtk/dcmjpls/djdecode.h> |
3727
090022f1b5e1
auto-generation of primitives to handle transfer syntaxes
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3712
diff
changeset
|
118 # if ORTHANC_ENABLE_DCMTK_TRANSCODING == 1 |
090022f1b5e1
auto-generation of primitives to handle transfer syntaxes
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3712
diff
changeset
|
119 # include <dcmtk/dcmjpls/djencode.h> |
090022f1b5e1
auto-generation of primitives to handle transfer syntaxes
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3712
diff
changeset
|
120 # endif |
1930 | 121 #endif |
122 | |
123 | |
3748
ca36e3f1112c
transcoding to uncompressed transfer syntaxes
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3743
diff
changeset
|
124 #include <dcmtk/dcmdata/dcrledrg.h> |
ca36e3f1112c
transcoding to uncompressed transfer syntaxes
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3743
diff
changeset
|
125 #if ORTHANC_ENABLE_DCMTK_TRANSCODING == 1 |
ca36e3f1112c
transcoding to uncompressed transfer syntaxes
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3743
diff
changeset
|
126 # include <dcmtk/dcmdata/dcrleerg.h> |
3765
4a25727401cd
first transcoding to jpeg 8bpp
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3748
diff
changeset
|
127 # include <dcmtk/dcmimage/diregist.h> // include to support color images |
3748
ca36e3f1112c
transcoding to uncompressed transfer syntaxes
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3743
diff
changeset
|
128 #endif |
ca36e3f1112c
transcoding to uncompressed transfer syntaxes
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3743
diff
changeset
|
129 |
ca36e3f1112c
transcoding to uncompressed transfer syntaxes
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3743
diff
changeset
|
130 |
62 | 131 namespace Orthanc |
0 | 132 { |
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
|
133 static bool IsBinaryTag(const DcmTag& key) |
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
|
134 { |
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
|
135 return (key.isUnknownVR() || |
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
|
136 key.getEVR() == EVR_OB || |
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
|
137 key.getEVR() == EVR_OW || |
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
|
138 key.getEVR() == EVR_UN || |
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
|
139 key.getEVR() == EVR_ox); |
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
|
140 } |
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
|
141 |
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
|
142 |
1656 | 143 #if DCMTK_USE_EMBEDDED_DICTIONARIES == 1 |
144 static void LoadEmbeddedDictionary(DcmDataDictionary& dictionary, | |
4032
058b5ade8acd
renaming embedded resources
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4030
diff
changeset
|
145 FrameworkResources::FileResourceId resource) |
1656 | 146 { |
2017 | 147 std::string content; |
4032
058b5ade8acd
renaming embedded resources
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4030
diff
changeset
|
148 FrameworkResources::GetFileResource(content, resource); |
1656 | 149 |
2513
97a74f0eac7a
loading DICOM dictionaries in sandboxed environments
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2512
diff
changeset
|
150 #if ORTHANC_SANDBOXED == 0 |
2143
fd5875662670
creation of namespace SystemToolbox
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2142
diff
changeset
|
151 TemporaryFile tmp; |
2017 | 152 tmp.Write(content); |
1656 | 153 |
154 if (!dictionary.loadDictionary(tmp.GetPath().c_str())) | |
155 { | |
2954
d924f9bb61cc
taking advantage of details in OrthancException
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2905
diff
changeset
|
156 throw OrthancException(ErrorCode_InternalError, |
d924f9bb61cc
taking advantage of details in OrthancException
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2905
diff
changeset
|
157 "Cannot read embedded dictionary. Under Windows, make sure that " |
d924f9bb61cc
taking advantage of details in OrthancException
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2905
diff
changeset
|
158 "your TEMP directory does not contain special characters."); |
1656 | 159 } |
2513
97a74f0eac7a
loading DICOM dictionaries in sandboxed environments
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2512
diff
changeset
|
160 #else |
97a74f0eac7a
loading DICOM dictionaries in sandboxed environments
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2512
diff
changeset
|
161 if (!dictionary.loadFromMemory(content)) |
97a74f0eac7a
loading DICOM dictionaries in sandboxed environments
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2512
diff
changeset
|
162 { |
2954
d924f9bb61cc
taking advantage of details in OrthancException
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2905
diff
changeset
|
163 throw OrthancException(ErrorCode_InternalError, |
d924f9bb61cc
taking advantage of details in OrthancException
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2905
diff
changeset
|
164 "Cannot read embedded dictionary. Under Windows, make sure that " |
d924f9bb61cc
taking advantage of details in OrthancException
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2905
diff
changeset
|
165 "your TEMP directory does not contain special characters."); |
2513
97a74f0eac7a
loading DICOM dictionaries in sandboxed environments
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2512
diff
changeset
|
166 } |
97a74f0eac7a
loading DICOM dictionaries in sandboxed environments
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2512
diff
changeset
|
167 #endif |
1656 | 168 } |
169 #endif | |
170 | |
171 | |
1657
5360cdba70d8
New function "OrthancPluginRegisterDictionaryTag()" to declare DICOM tags
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1656
diff
changeset
|
172 namespace |
5360cdba70d8
New function "OrthancPluginRegisterDictionaryTag()" to declare DICOM tags
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1656
diff
changeset
|
173 { |
4030
100fbe970762
DANGEROUS commit: removing HAS_EMBEDDED_RESOURCES
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4016
diff
changeset
|
174 class DictionaryLocker : public boost::noncopyable |
1657
5360cdba70d8
New function "OrthancPluginRegisterDictionaryTag()" to declare DICOM tags
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1656
diff
changeset
|
175 { |
5360cdba70d8
New function "OrthancPluginRegisterDictionaryTag()" to declare DICOM tags
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1656
diff
changeset
|
176 private: |
5360cdba70d8
New function "OrthancPluginRegisterDictionaryTag()" to declare DICOM tags
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1656
diff
changeset
|
177 DcmDataDictionary& dictionary_; |
5360cdba70d8
New function "OrthancPluginRegisterDictionaryTag()" to declare DICOM tags
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1656
diff
changeset
|
178 |
5360cdba70d8
New function "OrthancPluginRegisterDictionaryTag()" to declare DICOM tags
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1656
diff
changeset
|
179 public: |
5360cdba70d8
New function "OrthancPluginRegisterDictionaryTag()" to declare DICOM tags
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1656
diff
changeset
|
180 DictionaryLocker() : dictionary_(dcmDataDict.wrlock()) |
5360cdba70d8
New function "OrthancPluginRegisterDictionaryTag()" to declare DICOM tags
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1656
diff
changeset
|
181 { |
5360cdba70d8
New function "OrthancPluginRegisterDictionaryTag()" to declare DICOM tags
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1656
diff
changeset
|
182 } |
5360cdba70d8
New function "OrthancPluginRegisterDictionaryTag()" to declare DICOM tags
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1656
diff
changeset
|
183 |
5360cdba70d8
New function "OrthancPluginRegisterDictionaryTag()" to declare DICOM tags
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1656
diff
changeset
|
184 ~DictionaryLocker() |
5360cdba70d8
New function "OrthancPluginRegisterDictionaryTag()" to declare DICOM tags
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1656
diff
changeset
|
185 { |
3117 | 186 #if DCMTK_VERSION_NUMBER >= 364 |
187 dcmDataDict.wrunlock(); | |
188 #else | |
1657
5360cdba70d8
New function "OrthancPluginRegisterDictionaryTag()" to declare DICOM tags
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1656
diff
changeset
|
189 dcmDataDict.unlock(); |
3117 | 190 #endif |
1657
5360cdba70d8
New function "OrthancPluginRegisterDictionaryTag()" to declare DICOM tags
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1656
diff
changeset
|
191 } |
5360cdba70d8
New function "OrthancPluginRegisterDictionaryTag()" to declare DICOM tags
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1656
diff
changeset
|
192 |
5360cdba70d8
New function "OrthancPluginRegisterDictionaryTag()" to declare DICOM tags
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1656
diff
changeset
|
193 DcmDataDictionary& operator*() |
5360cdba70d8
New function "OrthancPluginRegisterDictionaryTag()" to declare DICOM tags
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1656
diff
changeset
|
194 { |
5360cdba70d8
New function "OrthancPluginRegisterDictionaryTag()" to declare DICOM tags
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1656
diff
changeset
|
195 return dictionary_; |
5360cdba70d8
New function "OrthancPluginRegisterDictionaryTag()" to declare DICOM tags
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1656
diff
changeset
|
196 } |
5360cdba70d8
New function "OrthancPluginRegisterDictionaryTag()" to declare DICOM tags
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1656
diff
changeset
|
197 |
5360cdba70d8
New function "OrthancPluginRegisterDictionaryTag()" to declare DICOM tags
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1656
diff
changeset
|
198 DcmDataDictionary* operator->() |
5360cdba70d8
New function "OrthancPluginRegisterDictionaryTag()" to declare DICOM tags
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1656
diff
changeset
|
199 { |
5360cdba70d8
New function "OrthancPluginRegisterDictionaryTag()" to declare DICOM tags
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1656
diff
changeset
|
200 return &dictionary_; |
5360cdba70d8
New function "OrthancPluginRegisterDictionaryTag()" to declare DICOM tags
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1656
diff
changeset
|
201 } |
5360cdba70d8
New function "OrthancPluginRegisterDictionaryTag()" to declare DICOM tags
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1656
diff
changeset
|
202 }; |
2554
ea63d9f90377
/tags now returns multiple numerical values in a \ separated string
am@osimis.io
parents:
2528
diff
changeset
|
203 |
ea63d9f90377
/tags now returns multiple numerical values in a \ separated string
am@osimis.io
parents:
2528
diff
changeset
|
204 |
3594
0654d0838de8
disable thread support in DCMTK if wasm/asm.js
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3577
diff
changeset
|
205 #define DCMTK_TO_CTYPE_CONVERTER(converter, cType, dcmtkType, getter) \ |
0654d0838de8
disable thread support in DCMTK if wasm/asm.js
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3577
diff
changeset
|
206 \ |
0654d0838de8
disable thread support in DCMTK if wasm/asm.js
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3577
diff
changeset
|
207 struct converter \ |
0654d0838de8
disable thread support in DCMTK if wasm/asm.js
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3577
diff
changeset
|
208 { \ |
0654d0838de8
disable thread support in DCMTK if wasm/asm.js
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3577
diff
changeset
|
209 typedef cType CType; \ |
0654d0838de8
disable thread support in DCMTK if wasm/asm.js
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3577
diff
changeset
|
210 \ |
0654d0838de8
disable thread support in DCMTK if wasm/asm.js
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3577
diff
changeset
|
211 static bool Apply(CType& result, \ |
0654d0838de8
disable thread support in DCMTK if wasm/asm.js
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3577
diff
changeset
|
212 DcmElement& element, \ |
0654d0838de8
disable thread support in DCMTK if wasm/asm.js
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3577
diff
changeset
|
213 size_t i) \ |
0654d0838de8
disable thread support in DCMTK if wasm/asm.js
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3577
diff
changeset
|
214 { \ |
2554
ea63d9f90377
/tags now returns multiple numerical values in a \ separated string
am@osimis.io
parents:
2528
diff
changeset
|
215 return dynamic_cast<dcmtkType&>(element).getter(result, i).good(); \ |
3594
0654d0838de8
disable thread support in DCMTK if wasm/asm.js
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3577
diff
changeset
|
216 } \ |
2554
ea63d9f90377
/tags now returns multiple numerical values in a \ separated string
am@osimis.io
parents:
2528
diff
changeset
|
217 }; |
ea63d9f90377
/tags now returns multiple numerical values in a \ separated string
am@osimis.io
parents:
2528
diff
changeset
|
218 |
ea63d9f90377
/tags now returns multiple numerical values in a \ separated string
am@osimis.io
parents:
2528
diff
changeset
|
219 DCMTK_TO_CTYPE_CONVERTER(DcmtkToSint32Converter, Sint32, DcmSignedLong, getSint32) |
ea63d9f90377
/tags now returns multiple numerical values in a \ separated string
am@osimis.io
parents:
2528
diff
changeset
|
220 DCMTK_TO_CTYPE_CONVERTER(DcmtkToSint16Converter, Sint16, DcmSignedShort, getSint16) |
ea63d9f90377
/tags now returns multiple numerical values in a \ separated string
am@osimis.io
parents:
2528
diff
changeset
|
221 DCMTK_TO_CTYPE_CONVERTER(DcmtkToUint32Converter, Uint32, DcmUnsignedLong, getUint32) |
ea63d9f90377
/tags now returns multiple numerical values in a \ separated string
am@osimis.io
parents:
2528
diff
changeset
|
222 DCMTK_TO_CTYPE_CONVERTER(DcmtkToUint16Converter, Uint16, DcmUnsignedShort, getUint16) |
ea63d9f90377
/tags now returns multiple numerical values in a \ separated string
am@osimis.io
parents:
2528
diff
changeset
|
223 DCMTK_TO_CTYPE_CONVERTER(DcmtkToFloat32Converter, Float32, DcmFloatingPointSingle, getFloat32) |
ea63d9f90377
/tags now returns multiple numerical values in a \ separated string
am@osimis.io
parents:
2528
diff
changeset
|
224 DCMTK_TO_CTYPE_CONVERTER(DcmtkToFloat64Converter, Float64, DcmFloatingPointDouble, getFloat64) |
ea63d9f90377
/tags now returns multiple numerical values in a \ separated string
am@osimis.io
parents:
2528
diff
changeset
|
225 |
ea63d9f90377
/tags now returns multiple numerical values in a \ separated string
am@osimis.io
parents:
2528
diff
changeset
|
226 |
ea63d9f90377
/tags now returns multiple numerical values in a \ separated string
am@osimis.io
parents:
2528
diff
changeset
|
227 template <typename F> |
ea63d9f90377
/tags now returns multiple numerical values in a \ separated string
am@osimis.io
parents:
2528
diff
changeset
|
228 static DicomValue* ApplyDcmtkToCTypeConverter(DcmElement& element) |
ea63d9f90377
/tags now returns multiple numerical values in a \ separated string
am@osimis.io
parents:
2528
diff
changeset
|
229 { |
ea63d9f90377
/tags now returns multiple numerical values in a \ separated string
am@osimis.io
parents:
2528
diff
changeset
|
230 F f; |
ea63d9f90377
/tags now returns multiple numerical values in a \ separated string
am@osimis.io
parents:
2528
diff
changeset
|
231 typename F::CType value; |
ea63d9f90377
/tags now returns multiple numerical values in a \ separated string
am@osimis.io
parents:
2528
diff
changeset
|
232 |
ea63d9f90377
/tags now returns multiple numerical values in a \ separated string
am@osimis.io
parents:
2528
diff
changeset
|
233 if (element.getLength() > sizeof(typename F::CType) |
ea63d9f90377
/tags now returns multiple numerical values in a \ separated string
am@osimis.io
parents:
2528
diff
changeset
|
234 && (element.getLength() % sizeof(typename F::CType)) == 0) |
ea63d9f90377
/tags now returns multiple numerical values in a \ separated string
am@osimis.io
parents:
2528
diff
changeset
|
235 { |
ea63d9f90377
/tags now returns multiple numerical values in a \ separated string
am@osimis.io
parents:
2528
diff
changeset
|
236 size_t count = element.getLength() / sizeof(typename F::CType); |
ea63d9f90377
/tags now returns multiple numerical values in a \ separated string
am@osimis.io
parents:
2528
diff
changeset
|
237 std::vector<std::string> strings; |
ea63d9f90377
/tags now returns multiple numerical values in a \ separated string
am@osimis.io
parents:
2528
diff
changeset
|
238 for (size_t i = 0; i < count; i++) { |
ea63d9f90377
/tags now returns multiple numerical values in a \ separated string
am@osimis.io
parents:
2528
diff
changeset
|
239 if (f.Apply(value, element, i)) { |
ea63d9f90377
/tags now returns multiple numerical values in a \ separated string
am@osimis.io
parents:
2528
diff
changeset
|
240 strings.push_back(boost::lexical_cast<std::string>(value)); |
ea63d9f90377
/tags now returns multiple numerical values in a \ separated string
am@osimis.io
parents:
2528
diff
changeset
|
241 } |
ea63d9f90377
/tags now returns multiple numerical values in a \ separated string
am@osimis.io
parents:
2528
diff
changeset
|
242 } |
ea63d9f90377
/tags now returns multiple numerical values in a \ separated string
am@osimis.io
parents:
2528
diff
changeset
|
243 return new DicomValue(boost::algorithm::join(strings, "\\"), false); |
ea63d9f90377
/tags now returns multiple numerical values in a \ separated string
am@osimis.io
parents:
2528
diff
changeset
|
244 } |
ea63d9f90377
/tags now returns multiple numerical values in a \ separated string
am@osimis.io
parents:
2528
diff
changeset
|
245 else if (f.Apply(value, element, 0)) { |
ea63d9f90377
/tags now returns multiple numerical values in a \ separated string
am@osimis.io
parents:
2528
diff
changeset
|
246 return new DicomValue(boost::lexical_cast<std::string>(value), false); |
ea63d9f90377
/tags now returns multiple numerical values in a \ separated string
am@osimis.io
parents:
2528
diff
changeset
|
247 } |
ea63d9f90377
/tags now returns multiple numerical values in a \ separated string
am@osimis.io
parents:
2528
diff
changeset
|
248 else { |
ea63d9f90377
/tags now returns multiple numerical values in a \ separated string
am@osimis.io
parents:
2528
diff
changeset
|
249 return new DicomValue; |
ea63d9f90377
/tags now returns multiple numerical values in a \ separated string
am@osimis.io
parents:
2528
diff
changeset
|
250 } |
ea63d9f90377
/tags now returns multiple numerical values in a \ separated string
am@osimis.io
parents:
2528
diff
changeset
|
251 } |
ea63d9f90377
/tags now returns multiple numerical values in a \ separated string
am@osimis.io
parents:
2528
diff
changeset
|
252 |
1657
5360cdba70d8
New function "OrthancPluginRegisterDictionaryTag()" to declare DICOM tags
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1656
diff
changeset
|
253 } |
5360cdba70d8
New function "OrthancPluginRegisterDictionaryTag()" to declare DICOM tags
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1656
diff
changeset
|
254 |
5360cdba70d8
New function "OrthancPluginRegisterDictionaryTag()" to declare DICOM tags
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1656
diff
changeset
|
255 |
2151
8cbb55089a1d
New configuration option: "LoadPrivateDictionary"
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2143
diff
changeset
|
256 void FromDcmtkBridge::InitializeDictionary(bool loadPrivateDictionary) |
1656 | 257 { |
2296 | 258 LOG(INFO) << "Using DCTMK version: " << DCMTK_VERSION_NUMBER; |
259 | |
1657
5360cdba70d8
New function "OrthancPluginRegisterDictionaryTag()" to declare DICOM tags
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1656
diff
changeset
|
260 { |
5360cdba70d8
New function "OrthancPluginRegisterDictionaryTag()" to declare DICOM tags
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1656
diff
changeset
|
261 DictionaryLocker locker; |
5360cdba70d8
New function "OrthancPluginRegisterDictionaryTag()" to declare DICOM tags
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1656
diff
changeset
|
262 |
5360cdba70d8
New function "OrthancPluginRegisterDictionaryTag()" to declare DICOM tags
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1656
diff
changeset
|
263 locker->clear(); |
1656 | 264 |
265 #if DCMTK_USE_EMBEDDED_DICTIONARIES == 1 | |
2528
832217e4e872
old warnings turned into info
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2522
diff
changeset
|
266 LOG(INFO) << "Loading the embedded dictionaries"; |
1657
5360cdba70d8
New function "OrthancPluginRegisterDictionaryTag()" to declare DICOM tags
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1656
diff
changeset
|
267 /** |
5360cdba70d8
New function "OrthancPluginRegisterDictionaryTag()" to declare DICOM tags
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1656
diff
changeset
|
268 * Do not load DICONDE dictionary, it breaks the other tags. The |
5360cdba70d8
New function "OrthancPluginRegisterDictionaryTag()" to declare DICOM tags
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1656
diff
changeset
|
269 * command "strace storescu 2>&1 |grep dic" shows that DICONDE |
5360cdba70d8
New function "OrthancPluginRegisterDictionaryTag()" to declare DICOM tags
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1656
diff
changeset
|
270 * dictionary is not loaded by storescu. |
5360cdba70d8
New function "OrthancPluginRegisterDictionaryTag()" to declare DICOM tags
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1656
diff
changeset
|
271 **/ |
4032
058b5ade8acd
renaming embedded resources
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4030
diff
changeset
|
272 //LoadEmbeddedDictionary(*locker, FrameworkResources::DICTIONARY_DICONDE); |
058b5ade8acd
renaming embedded resources
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4030
diff
changeset
|
273 |
058b5ade8acd
renaming embedded resources
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4030
diff
changeset
|
274 LoadEmbeddedDictionary(*locker, FrameworkResources::DICTIONARY_DICOM); |
2151
8cbb55089a1d
New configuration option: "LoadPrivateDictionary"
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2143
diff
changeset
|
275 |
8cbb55089a1d
New configuration option: "LoadPrivateDictionary"
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2143
diff
changeset
|
276 if (loadPrivateDictionary) |
8cbb55089a1d
New configuration option: "LoadPrivateDictionary"
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2143
diff
changeset
|
277 { |
2152
cbebc5d072b0
Use of DCMTK 3.6.1 dictionary of private tags in standalone builds
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2151
diff
changeset
|
278 LOG(INFO) << "Loading the embedded dictionary of private tags"; |
4032
058b5ade8acd
renaming embedded resources
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4030
diff
changeset
|
279 LoadEmbeddedDictionary(*locker, FrameworkResources::DICTIONARY_PRIVATE); |
2151
8cbb55089a1d
New configuration option: "LoadPrivateDictionary"
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2143
diff
changeset
|
280 } |
8cbb55089a1d
New configuration option: "LoadPrivateDictionary"
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2143
diff
changeset
|
281 else |
8cbb55089a1d
New configuration option: "LoadPrivateDictionary"
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2143
diff
changeset
|
282 { |
8cbb55089a1d
New configuration option: "LoadPrivateDictionary"
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2143
diff
changeset
|
283 LOG(INFO) << "The dictionary of private tags has not been loaded"; |
8cbb55089a1d
New configuration option: "LoadPrivateDictionary"
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2143
diff
changeset
|
284 } |
1656 | 285 |
3302
8ed445e94486
Fix issue #126 (Orthanc and DCMDICTPATH)
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3217
diff
changeset
|
286 #else |
8ed445e94486
Fix issue #126 (Orthanc and DCMDICTPATH)
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3217
diff
changeset
|
287 std::vector<std::string> dictionaries; |
8ed445e94486
Fix issue #126 (Orthanc and DCMDICTPATH)
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3217
diff
changeset
|
288 |
1657
5360cdba70d8
New function "OrthancPluginRegisterDictionaryTag()" to declare DICOM tags
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1656
diff
changeset
|
289 const char* env = std::getenv(DCM_DICT_ENVIRONMENT_VARIABLE); |
5360cdba70d8
New function "OrthancPluginRegisterDictionaryTag()" to declare DICOM tags
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1656
diff
changeset
|
290 if (env != NULL) |
5360cdba70d8
New function "OrthancPluginRegisterDictionaryTag()" to declare DICOM tags
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1656
diff
changeset
|
291 { |
3302
8ed445e94486
Fix issue #126 (Orthanc and DCMDICTPATH)
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3217
diff
changeset
|
292 // This mimics the behavior of DCMTK: |
8ed445e94486
Fix issue #126 (Orthanc and DCMDICTPATH)
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3217
diff
changeset
|
293 // https://support.dcmtk.org/docs/file_envvars.html |
8ed445e94486
Fix issue #126 (Orthanc and DCMDICTPATH)
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3217
diff
changeset
|
294 #if defined(_WIN32) |
8ed445e94486
Fix issue #126 (Orthanc and DCMDICTPATH)
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3217
diff
changeset
|
295 Toolbox::TokenizeString(dictionaries, std::string(env), ';'); |
8ed445e94486
Fix issue #126 (Orthanc and DCMDICTPATH)
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3217
diff
changeset
|
296 #else |
8ed445e94486
Fix issue #126 (Orthanc and DCMDICTPATH)
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3217
diff
changeset
|
297 Toolbox::TokenizeString(dictionaries, std::string(env), ':'); |
8ed445e94486
Fix issue #126 (Orthanc and DCMDICTPATH)
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3217
diff
changeset
|
298 #endif |
2151
8cbb55089a1d
New configuration option: "LoadPrivateDictionary"
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2143
diff
changeset
|
299 } |
8cbb55089a1d
New configuration option: "LoadPrivateDictionary"
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2143
diff
changeset
|
300 else |
8cbb55089a1d
New configuration option: "LoadPrivateDictionary"
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2143
diff
changeset
|
301 { |
3302
8ed445e94486
Fix issue #126 (Orthanc and DCMDICTPATH)
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3217
diff
changeset
|
302 boost::filesystem::path base = DCMTK_DICTIONARY_DIR; |
8ed445e94486
Fix issue #126 (Orthanc and DCMDICTPATH)
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3217
diff
changeset
|
303 dictionaries.push_back((base / "dicom.dic").string()); |
8ed445e94486
Fix issue #126 (Orthanc and DCMDICTPATH)
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3217
diff
changeset
|
304 dictionaries.push_back((base / "private.dic").string()); |
2151
8cbb55089a1d
New configuration option: "LoadPrivateDictionary"
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2143
diff
changeset
|
305 } |
1656 | 306 |
3302
8ed445e94486
Fix issue #126 (Orthanc and DCMDICTPATH)
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3217
diff
changeset
|
307 for (size_t i = 0; i < dictionaries.size(); i++) |
8ed445e94486
Fix issue #126 (Orthanc and DCMDICTPATH)
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3217
diff
changeset
|
308 { |
8ed445e94486
Fix issue #126 (Orthanc and DCMDICTPATH)
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3217
diff
changeset
|
309 LOG(WARNING) << "Loading external DICOM dictionary: \"" << dictionaries[i] << "\""; |
8ed445e94486
Fix issue #126 (Orthanc and DCMDICTPATH)
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3217
diff
changeset
|
310 |
8ed445e94486
Fix issue #126 (Orthanc and DCMDICTPATH)
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3217
diff
changeset
|
311 if (!locker->loadDictionary(dictionaries[i].c_str())) |
8ed445e94486
Fix issue #126 (Orthanc and DCMDICTPATH)
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3217
diff
changeset
|
312 { |
8ed445e94486
Fix issue #126 (Orthanc and DCMDICTPATH)
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3217
diff
changeset
|
313 throw OrthancException(ErrorCode_InexistentFile); |
8ed445e94486
Fix issue #126 (Orthanc and DCMDICTPATH)
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3217
diff
changeset
|
314 } |
8ed445e94486
Fix issue #126 (Orthanc and DCMDICTPATH)
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3217
diff
changeset
|
315 } |
8ed445e94486
Fix issue #126 (Orthanc and DCMDICTPATH)
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3217
diff
changeset
|
316 |
1656 | 317 #endif |
1657
5360cdba70d8
New function "OrthancPluginRegisterDictionaryTag()" to declare DICOM tags
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1656
diff
changeset
|
318 } |
1656 | 319 |
320 /* make sure data dictionary is loaded */ | |
321 if (!dcmDataDict.isDictionaryLoaded()) | |
322 { | |
2954
d924f9bb61cc
taking advantage of details in OrthancException
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2905
diff
changeset
|
323 throw OrthancException(ErrorCode_InternalError, |
d924f9bb61cc
taking advantage of details in OrthancException
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2905
diff
changeset
|
324 "No DICOM dictionary loaded, check environment variable: " + |
d924f9bb61cc
taking advantage of details in OrthancException
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2905
diff
changeset
|
325 std::string(DCM_DICT_ENVIRONMENT_VARIABLE)); |
1656 | 326 } |
327 | |
328 { | |
329 // Test the dictionary with a simple DICOM tag | |
330 DcmTag key(0x0010, 0x1030); // This is PatientWeight | |
331 if (key.getEVR() != EVR_DS) | |
332 { | |
2954
d924f9bb61cc
taking advantage of details in OrthancException
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2905
diff
changeset
|
333 throw OrthancException(ErrorCode_InternalError, |
d924f9bb61cc
taking advantage of details in OrthancException
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2905
diff
changeset
|
334 "The DICOM dictionary has not been correctly read"); |
1656 | 335 } |
336 } | |
337 } | |
338 | |
339 | |
1657
5360cdba70d8
New function "OrthancPluginRegisterDictionaryTag()" to declare DICOM tags
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1656
diff
changeset
|
340 void FromDcmtkBridge::RegisterDictionaryTag(const DicomTag& tag, |
2006
6301bbcbcaed
more generic support of value representations
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1998
diff
changeset
|
341 ValueRepresentation vr, |
1657
5360cdba70d8
New function "OrthancPluginRegisterDictionaryTag()" to declare DICOM tags
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1656
diff
changeset
|
342 const std::string& name, |
5360cdba70d8
New function "OrthancPluginRegisterDictionaryTag()" to declare DICOM tags
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1656
diff
changeset
|
343 unsigned int minMultiplicity, |
2115
a657f7772e69
Handling of private tags/creators in the "Dictionary" configuration option
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2076
diff
changeset
|
344 unsigned int maxMultiplicity, |
a657f7772e69
Handling of private tags/creators in the "Dictionary" configuration option
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2076
diff
changeset
|
345 const std::string& privateCreator) |
1657
5360cdba70d8
New function "OrthancPluginRegisterDictionaryTag()" to declare DICOM tags
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1656
diff
changeset
|
346 { |
5360cdba70d8
New function "OrthancPluginRegisterDictionaryTag()" to declare DICOM tags
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1656
diff
changeset
|
347 if (minMultiplicity < 1) |
5360cdba70d8
New function "OrthancPluginRegisterDictionaryTag()" to declare DICOM tags
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1656
diff
changeset
|
348 { |
5360cdba70d8
New function "OrthancPluginRegisterDictionaryTag()" to declare DICOM tags
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1656
diff
changeset
|
349 throw OrthancException(ErrorCode_ParameterOutOfRange); |
5360cdba70d8
New function "OrthancPluginRegisterDictionaryTag()" to declare DICOM tags
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1656
diff
changeset
|
350 } |
5360cdba70d8
New function "OrthancPluginRegisterDictionaryTag()" to declare DICOM tags
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1656
diff
changeset
|
351 |
1765
57b9e6890482
New configuration option: "Dictionary" to declare custom DICOM tags
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1739
diff
changeset
|
352 bool arbitrary = false; |
1657
5360cdba70d8
New function "OrthancPluginRegisterDictionaryTag()" to declare DICOM tags
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1656
diff
changeset
|
353 if (maxMultiplicity == 0) |
5360cdba70d8
New function "OrthancPluginRegisterDictionaryTag()" to declare DICOM tags
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1656
diff
changeset
|
354 { |
5360cdba70d8
New function "OrthancPluginRegisterDictionaryTag()" to declare DICOM tags
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1656
diff
changeset
|
355 maxMultiplicity = DcmVariableVM; |
1765
57b9e6890482
New configuration option: "Dictionary" to declare custom DICOM tags
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1739
diff
changeset
|
356 arbitrary = true; |
1657
5360cdba70d8
New function "OrthancPluginRegisterDictionaryTag()" to declare DICOM tags
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1656
diff
changeset
|
357 } |
5360cdba70d8
New function "OrthancPluginRegisterDictionaryTag()" to declare DICOM tags
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1656
diff
changeset
|
358 else if (maxMultiplicity < minMultiplicity) |
5360cdba70d8
New function "OrthancPluginRegisterDictionaryTag()" to declare DICOM tags
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1656
diff
changeset
|
359 { |
5360cdba70d8
New function "OrthancPluginRegisterDictionaryTag()" to declare DICOM tags
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1656
diff
changeset
|
360 throw OrthancException(ErrorCode_ParameterOutOfRange); |
5360cdba70d8
New function "OrthancPluginRegisterDictionaryTag()" to declare DICOM tags
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1656
diff
changeset
|
361 } |
5360cdba70d8
New function "OrthancPluginRegisterDictionaryTag()" to declare DICOM tags
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1656
diff
changeset
|
362 |
2006
6301bbcbcaed
more generic support of value representations
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1998
diff
changeset
|
363 DcmEVR evr = ToDcmtkBridge::Convert(vr); |
6301bbcbcaed
more generic support of value representations
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1998
diff
changeset
|
364 |
6301bbcbcaed
more generic support of value representations
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1998
diff
changeset
|
365 LOG(INFO) << "Registering tag in dictionary: " << tag << " " << (DcmVR(evr).getValidVRName()) << " " |
1765
57b9e6890482
New configuration option: "Dictionary" to declare custom DICOM tags
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1739
diff
changeset
|
366 << name << " (multiplicity: " << minMultiplicity << "-" |
57b9e6890482
New configuration option: "Dictionary" to declare custom DICOM tags
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1739
diff
changeset
|
367 << (arbitrary ? "n" : boost::lexical_cast<std::string>(maxMultiplicity)) << ")"; |
57b9e6890482
New configuration option: "Dictionary" to declare custom DICOM tags
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1739
diff
changeset
|
368 |
3712
2a170a8f1faf
replacing std::auto_ptr by std::unique_ptr
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3708
diff
changeset
|
369 std::unique_ptr<DcmDictEntry> entry; |
2115
a657f7772e69
Handling of private tags/creators in the "Dictionary" configuration option
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2076
diff
changeset
|
370 if (privateCreator.empty()) |
a657f7772e69
Handling of private tags/creators in the "Dictionary" configuration option
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2076
diff
changeset
|
371 { |
a657f7772e69
Handling of private tags/creators in the "Dictionary" configuration option
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2076
diff
changeset
|
372 if (tag.GetGroup() % 2 == 1) |
a657f7772e69
Handling of private tags/creators in the "Dictionary" configuration option
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2076
diff
changeset
|
373 { |
a657f7772e69
Handling of private tags/creators in the "Dictionary" configuration option
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2076
diff
changeset
|
374 char buf[128]; |
a657f7772e69
Handling of private tags/creators in the "Dictionary" configuration option
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2076
diff
changeset
|
375 sprintf(buf, "Warning: You are registering a private tag (%04x,%04x), " |
a657f7772e69
Handling of private tags/creators in the "Dictionary" configuration option
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2076
diff
changeset
|
376 "but no private creator was associated with it", |
a657f7772e69
Handling of private tags/creators in the "Dictionary" configuration option
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2076
diff
changeset
|
377 tag.GetGroup(), tag.GetElement()); |
a657f7772e69
Handling of private tags/creators in the "Dictionary" configuration option
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2076
diff
changeset
|
378 LOG(WARNING) << buf; |
a657f7772e69
Handling of private tags/creators in the "Dictionary" configuration option
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2076
diff
changeset
|
379 } |
a657f7772e69
Handling of private tags/creators in the "Dictionary" configuration option
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2076
diff
changeset
|
380 |
a657f7772e69
Handling of private tags/creators in the "Dictionary" configuration option
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2076
diff
changeset
|
381 entry.reset(new DcmDictEntry(tag.GetGroup(), |
a657f7772e69
Handling of private tags/creators in the "Dictionary" configuration option
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2076
diff
changeset
|
382 tag.GetElement(), |
a657f7772e69
Handling of private tags/creators in the "Dictionary" configuration option
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2076
diff
changeset
|
383 evr, name.c_str(), |
a657f7772e69
Handling of private tags/creators in the "Dictionary" configuration option
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2076
diff
changeset
|
384 static_cast<int>(minMultiplicity), |
a657f7772e69
Handling of private tags/creators in the "Dictionary" configuration option
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2076
diff
changeset
|
385 static_cast<int>(maxMultiplicity), |
a657f7772e69
Handling of private tags/creators in the "Dictionary" configuration option
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2076
diff
changeset
|
386 NULL /* version */, |
a657f7772e69
Handling of private tags/creators in the "Dictionary" configuration option
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2076
diff
changeset
|
387 OFTrue /* doCopyString */, |
a657f7772e69
Handling of private tags/creators in the "Dictionary" configuration option
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2076
diff
changeset
|
388 NULL /* private creator */)); |
a657f7772e69
Handling of private tags/creators in the "Dictionary" configuration option
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2076
diff
changeset
|
389 } |
a657f7772e69
Handling of private tags/creators in the "Dictionary" configuration option
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2076
diff
changeset
|
390 else |
a657f7772e69
Handling of private tags/creators in the "Dictionary" configuration option
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2076
diff
changeset
|
391 { |
a657f7772e69
Handling of private tags/creators in the "Dictionary" configuration option
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2076
diff
changeset
|
392 // "Private Data Elements have an odd Group Number that is not |
a657f7772e69
Handling of private tags/creators in the "Dictionary" configuration option
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2076
diff
changeset
|
393 // (0001,eeee), (0003,eeee), (0005,eeee), (0007,eeee), or |
a657f7772e69
Handling of private tags/creators in the "Dictionary" configuration option
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2076
diff
changeset
|
394 // (FFFF,eeee)." |
a657f7772e69
Handling of private tags/creators in the "Dictionary" configuration option
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2076
diff
changeset
|
395 if (tag.GetGroup() % 2 == 0 /* even */ || |
a657f7772e69
Handling of private tags/creators in the "Dictionary" configuration option
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2076
diff
changeset
|
396 tag.GetGroup() == 0x0001 || |
a657f7772e69
Handling of private tags/creators in the "Dictionary" configuration option
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2076
diff
changeset
|
397 tag.GetGroup() == 0x0003 || |
a657f7772e69
Handling of private tags/creators in the "Dictionary" configuration option
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2076
diff
changeset
|
398 tag.GetGroup() == 0x0005 || |
a657f7772e69
Handling of private tags/creators in the "Dictionary" configuration option
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2076
diff
changeset
|
399 tag.GetGroup() == 0x0007 || |
a657f7772e69
Handling of private tags/creators in the "Dictionary" configuration option
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2076
diff
changeset
|
400 tag.GetGroup() == 0xffff) |
a657f7772e69
Handling of private tags/creators in the "Dictionary" configuration option
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2076
diff
changeset
|
401 { |
a657f7772e69
Handling of private tags/creators in the "Dictionary" configuration option
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2076
diff
changeset
|
402 char buf[128]; |
a657f7772e69
Handling of private tags/creators in the "Dictionary" configuration option
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2076
diff
changeset
|
403 sprintf(buf, "Trying to register private tag (%04x,%04x), but it must have an odd group >= 0x0009", |
a657f7772e69
Handling of private tags/creators in the "Dictionary" configuration option
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2076
diff
changeset
|
404 tag.GetGroup(), tag.GetElement()); |
2954
d924f9bb61cc
taking advantage of details in OrthancException
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2905
diff
changeset
|
405 throw OrthancException(ErrorCode_ParameterOutOfRange, std::string(buf)); |
2115
a657f7772e69
Handling of private tags/creators in the "Dictionary" configuration option
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2076
diff
changeset
|
406 } |
a657f7772e69
Handling of private tags/creators in the "Dictionary" configuration option
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2076
diff
changeset
|
407 |
a657f7772e69
Handling of private tags/creators in the "Dictionary" configuration option
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2076
diff
changeset
|
408 entry.reset(new DcmDictEntry(tag.GetGroup(), |
a657f7772e69
Handling of private tags/creators in the "Dictionary" configuration option
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2076
diff
changeset
|
409 tag.GetElement(), |
a657f7772e69
Handling of private tags/creators in the "Dictionary" configuration option
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2076
diff
changeset
|
410 evr, name.c_str(), |
a657f7772e69
Handling of private tags/creators in the "Dictionary" configuration option
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2076
diff
changeset
|
411 static_cast<int>(minMultiplicity), |
a657f7772e69
Handling of private tags/creators in the "Dictionary" configuration option
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2076
diff
changeset
|
412 static_cast<int>(maxMultiplicity), |
a657f7772e69
Handling of private tags/creators in the "Dictionary" configuration option
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2076
diff
changeset
|
413 "private" /* version */, |
a657f7772e69
Handling of private tags/creators in the "Dictionary" configuration option
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2076
diff
changeset
|
414 OFTrue /* doCopyString */, |
a657f7772e69
Handling of private tags/creators in the "Dictionary" configuration option
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2076
diff
changeset
|
415 privateCreator.c_str())); |
a657f7772e69
Handling of private tags/creators in the "Dictionary" configuration option
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2076
diff
changeset
|
416 } |
1657
5360cdba70d8
New function "OrthancPluginRegisterDictionaryTag()" to declare DICOM tags
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1656
diff
changeset
|
417 |
5360cdba70d8
New function "OrthancPluginRegisterDictionaryTag()" to declare DICOM tags
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1656
diff
changeset
|
418 entry->setGroupRangeRestriction(DcmDictRange_Unspecified); |
5360cdba70d8
New function "OrthancPluginRegisterDictionaryTag()" to declare DICOM tags
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1656
diff
changeset
|
419 entry->setElementRangeRestriction(DcmDictRange_Unspecified); |
5360cdba70d8
New function "OrthancPluginRegisterDictionaryTag()" to declare DICOM tags
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1656
diff
changeset
|
420 |
5360cdba70d8
New function "OrthancPluginRegisterDictionaryTag()" to declare DICOM tags
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1656
diff
changeset
|
421 { |
5360cdba70d8
New function "OrthancPluginRegisterDictionaryTag()" to declare DICOM tags
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1656
diff
changeset
|
422 DictionaryLocker locker; |
2116
2fabd1073728
prevent registering two tags with the same symbolic name
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2115
diff
changeset
|
423 |
2fabd1073728
prevent registering two tags with the same symbolic name
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2115
diff
changeset
|
424 if (locker->findEntry(name.c_str())) |
2fabd1073728
prevent registering two tags with the same symbolic name
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2115
diff
changeset
|
425 { |
2954
d924f9bb61cc
taking advantage of details in OrthancException
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2905
diff
changeset
|
426 throw OrthancException(ErrorCode_AlreadyExistingTag, |
d924f9bb61cc
taking advantage of details in OrthancException
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2905
diff
changeset
|
427 "Cannot register two tags with the same symbolic name \"" + name + "\""); |
2116
2fabd1073728
prevent registering two tags with the same symbolic name
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2115
diff
changeset
|
428 } |
2fabd1073728
prevent registering two tags with the same symbolic name
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2115
diff
changeset
|
429 |
1657
5360cdba70d8
New function "OrthancPluginRegisterDictionaryTag()" to declare DICOM tags
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1656
diff
changeset
|
430 locker->addEntry(entry.release()); |
5360cdba70d8
New function "OrthancPluginRegisterDictionaryTag()" to declare DICOM tags
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1656
diff
changeset
|
431 } |
5360cdba70d8
New function "OrthancPluginRegisterDictionaryTag()" to declare DICOM tags
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1656
diff
changeset
|
432 } |
5360cdba70d8
New function "OrthancPluginRegisterDictionaryTag()" to declare DICOM tags
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1656
diff
changeset
|
433 |
5360cdba70d8
New function "OrthancPluginRegisterDictionaryTag()" to declare DICOM tags
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1656
diff
changeset
|
434 |
3217
cf8cbeb35f33
preliminary support of Korean character set
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3209
diff
changeset
|
435 Encoding FromDcmtkBridge::DetectEncoding(bool& hasCodeExtensions, |
cf8cbeb35f33
preliminary support of Korean character set
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3209
diff
changeset
|
436 DcmItem& dataset, |
1928
84c7eaeb5244
Configuration::GetDefaultEncoding
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1927
diff
changeset
|
437 Encoding defaultEncoding) |
956
2fd5a163776d
primitives for proper encoding handling
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
949
diff
changeset
|
438 { |
3217
cf8cbeb35f33
preliminary support of Korean character set
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3209
diff
changeset
|
439 // http://dicom.nema.org/medical/dicom/current/output/chtml/part03/sect_C.12.html#sect_C.12.1.1.2 |
957
63973b76a51f
detection of encoding
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
956
diff
changeset
|
440 |
63973b76a51f
detection of encoding
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
956
diff
changeset
|
441 OFString tmp; |
3217
cf8cbeb35f33
preliminary support of Korean character set
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3209
diff
changeset
|
442 if (dataset.findAndGetOFStringArray(DCM_SpecificCharacterSet, tmp).good()) |
957
63973b76a51f
detection of encoding
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
956
diff
changeset
|
443 { |
3217
cf8cbeb35f33
preliminary support of Korean character set
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3209
diff
changeset
|
444 std::vector<std::string> tokens; |
cf8cbeb35f33
preliminary support of Korean character set
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3209
diff
changeset
|
445 Toolbox::TokenizeString(tokens, std::string(tmp.c_str()), '\\'); |
cf8cbeb35f33
preliminary support of Korean character set
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3209
diff
changeset
|
446 |
cf8cbeb35f33
preliminary support of Korean character set
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3209
diff
changeset
|
447 hasCodeExtensions = (tokens.size() > 1); |
cf8cbeb35f33
preliminary support of Korean character set
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3209
diff
changeset
|
448 |
cf8cbeb35f33
preliminary support of Korean character set
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3209
diff
changeset
|
449 for (size_t i = 0; i < tokens.size(); i++) |
957
63973b76a51f
detection of encoding
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
956
diff
changeset
|
450 { |
3217
cf8cbeb35f33
preliminary support of Korean character set
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3209
diff
changeset
|
451 std::string characterSet = Toolbox::StripSpaces(tokens[i]); |
cf8cbeb35f33
preliminary support of Korean character set
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3209
diff
changeset
|
452 |
cf8cbeb35f33
preliminary support of Korean character set
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3209
diff
changeset
|
453 if (!characterSet.empty()) |
cf8cbeb35f33
preliminary support of Korean character set
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3209
diff
changeset
|
454 { |
cf8cbeb35f33
preliminary support of Korean character set
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3209
diff
changeset
|
455 Encoding encoding; |
cf8cbeb35f33
preliminary support of Korean character set
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3209
diff
changeset
|
456 |
cf8cbeb35f33
preliminary support of Korean character set
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3209
diff
changeset
|
457 if (GetDicomEncoding(encoding, characterSet.c_str())) |
cf8cbeb35f33
preliminary support of Korean character set
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3209
diff
changeset
|
458 { |
cf8cbeb35f33
preliminary support of Korean character set
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3209
diff
changeset
|
459 // The specific character set is supported by the Orthanc core |
cf8cbeb35f33
preliminary support of Korean character set
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3209
diff
changeset
|
460 return encoding; |
cf8cbeb35f33
preliminary support of Korean character set
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3209
diff
changeset
|
461 } |
cf8cbeb35f33
preliminary support of Korean character set
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3209
diff
changeset
|
462 else |
cf8cbeb35f33
preliminary support of Korean character set
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3209
diff
changeset
|
463 { |
cf8cbeb35f33
preliminary support of Korean character set
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3209
diff
changeset
|
464 LOG(WARNING) << "Value of Specific Character Set (0008,0005) is not supported: " << characterSet |
cf8cbeb35f33
preliminary support of Korean character set
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3209
diff
changeset
|
465 << ", fallback to ASCII (remove all special characters)"; |
cf8cbeb35f33
preliminary support of Korean character set
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3209
diff
changeset
|
466 return Encoding_Ascii; |
cf8cbeb35f33
preliminary support of Korean character set
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3209
diff
changeset
|
467 } |
cf8cbeb35f33
preliminary support of Korean character set
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3209
diff
changeset
|
468 } |
957
63973b76a51f
detection of encoding
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
956
diff
changeset
|
469 } |
63973b76a51f
detection of encoding
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
956
diff
changeset
|
470 } |
1090
e494ceb8d763
support more encodings
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1087
diff
changeset
|
471 else |
e494ceb8d763
support more encodings
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1087
diff
changeset
|
472 { |
3217
cf8cbeb35f33
preliminary support of Korean character set
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3209
diff
changeset
|
473 hasCodeExtensions = false; |
1090
e494ceb8d763
support more encodings
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1087
diff
changeset
|
474 } |
3217
cf8cbeb35f33
preliminary support of Korean character set
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3209
diff
changeset
|
475 |
cf8cbeb35f33
preliminary support of Korean character set
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3209
diff
changeset
|
476 // No specific character set tag: Use the default encoding |
cf8cbeb35f33
preliminary support of Korean character set
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3209
diff
changeset
|
477 return defaultEncoding; |
956
2fd5a163776d
primitives for proper encoding handling
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
949
diff
changeset
|
478 } |
2fd5a163776d
primitives for proper encoding handling
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
949
diff
changeset
|
479 |
2fd5a163776d
primitives for proper encoding handling
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
949
diff
changeset
|
480 |
2125 | 481 void FromDcmtkBridge::ExtractDicomSummary(DicomMap& target, |
482 DcmItem& dataset, | |
483 unsigned int maxStringLength, | |
3577
33cfcc74d1b1
argument "ignoreTagLength" to ParsedDicomFile::ExtractDicomSummary()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3448
diff
changeset
|
484 Encoding defaultEncoding, |
33cfcc74d1b1
argument "ignoreTagLength" to ParsedDicomFile::ExtractDicomSummary()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3448
diff
changeset
|
485 const std::set<DicomTag>& ignoreTagLength) |
0 | 486 { |
3217
cf8cbeb35f33
preliminary support of Korean character set
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3209
diff
changeset
|
487 bool hasCodeExtensions; |
cf8cbeb35f33
preliminary support of Korean character set
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3209
diff
changeset
|
488 Encoding encoding = DetectEncoding(hasCodeExtensions, dataset, defaultEncoding); |
956
2fd5a163776d
primitives for proper encoding handling
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
949
diff
changeset
|
489 |
0 | 490 target.Clear(); |
491 for (unsigned long i = 0; i < dataset.card(); i++) | |
492 { | |
493 DcmElement* element = dataset.getElement(i); | |
494 if (element && element->isLeaf()) | |
495 { | |
3651
46cb00e4adbb
DicomMap::DumpMainDicomTags() and DicomMap::ParseMainDicomTags()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3640
diff
changeset
|
496 target.SetValueInternal(element->getTag().getGTag(), |
46cb00e4adbb
DicomMap::DumpMainDicomTags() and DicomMap::ParseMainDicomTags()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3640
diff
changeset
|
497 element->getTag().getETag(), |
46cb00e4adbb
DicomMap::DumpMainDicomTags() and DicomMap::ParseMainDicomTags()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3640
diff
changeset
|
498 ConvertLeafElement(*element, DicomToJsonFlags_Default, |
46cb00e4adbb
DicomMap::DumpMainDicomTags() and DicomMap::ParseMainDicomTags()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3640
diff
changeset
|
499 maxStringLength, encoding, hasCodeExtensions, ignoreTagLength)); |
0 | 500 } |
501 } | |
502 } | |
503 | |
504 | |
991
2f76b92addd4
keep private tags during anonymization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
957
diff
changeset
|
505 DicomTag FromDcmtkBridge::Convert(const DcmTag& tag) |
2f76b92addd4
keep private tags during anonymization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
957
diff
changeset
|
506 { |
2f76b92addd4
keep private tags during anonymization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
957
diff
changeset
|
507 return DicomTag(tag.getGTag(), tag.getETag()); |
2f76b92addd4
keep private tags during anonymization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
957
diff
changeset
|
508 } |
2f76b92addd4
keep private tags during anonymization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
957
diff
changeset
|
509 |
2f76b92addd4
keep private tags during anonymization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
957
diff
changeset
|
510 |
0 | 511 DicomTag FromDcmtkBridge::GetTag(const DcmElement& element) |
512 { | |
513 return DicomTag(element.getGTag(), element.getETag()); | |
514 } | |
515 | |
516 | |
956
2fd5a163776d
primitives for proper encoding handling
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
949
diff
changeset
|
517 DicomValue* FromDcmtkBridge::ConvertLeafElement(DcmElement& element, |
1736
b953c6eef28d
ToJson: IncludePrivateTags and IncludeUnknownTags
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1735
diff
changeset
|
518 DicomToJsonFlags flags, |
1929
cda5b0ab4ce5
ORTHANC_MAXIMUM_TAG_LENGTH made explicit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1928
diff
changeset
|
519 unsigned int maxStringLength, |
2409
e4045b3c9772
ignore-length argument if retrieving DICOM tags
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2382
diff
changeset
|
520 Encoding encoding, |
3217
cf8cbeb35f33
preliminary support of Korean character set
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3209
diff
changeset
|
521 bool hasCodeExtensions, |
2409
e4045b3c9772
ignore-length argument if retrieving DICOM tags
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2382
diff
changeset
|
522 const std::set<DicomTag>& ignoreTagLength) |
0 | 523 { |
524 if (!element.isLeaf()) | |
525 { | |
1582
bd1889029cbb
encoding of exceptions
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1557
diff
changeset
|
526 // This function is only applicable to leaf elements |
bd1889029cbb
encoding of exceptions
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1557
diff
changeset
|
527 throw OrthancException(ErrorCode_BadParameterType); |
0 | 528 } |
529 | |
1818
1065401501fb
ParsedDicomFile::CreateFromJson
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1792
diff
changeset
|
530 char *c = NULL; |
1065401501fb
ParsedDicomFile::CreateFromJson
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1792
diff
changeset
|
531 if (element.isaString() && |
1065401501fb
ParsedDicomFile::CreateFromJson
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1792
diff
changeset
|
532 element.getString(c).good()) |
0 | 533 { |
1818
1065401501fb
ParsedDicomFile::CreateFromJson
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1792
diff
changeset
|
534 if (c == NULL) // This case corresponds to the empty string |
0 | 535 { |
1818
1065401501fb
ParsedDicomFile::CreateFromJson
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1792
diff
changeset
|
536 return new DicomValue("", false); |
0 | 537 } |
538 else | |
539 { | |
1818
1065401501fb
ParsedDicomFile::CreateFromJson
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1792
diff
changeset
|
540 std::string s(c); |
3217
cf8cbeb35f33
preliminary support of Korean character set
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3209
diff
changeset
|
541 std::string utf8 = Toolbox::ConvertToUtf8(s, encoding, hasCodeExtensions); |
1854
e2c3d752ee1a
prevent too long tags to be inserted
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1831
diff
changeset
|
542 |
1929
cda5b0ab4ce5
ORTHANC_MAXIMUM_TAG_LENGTH made explicit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1928
diff
changeset
|
543 if (maxStringLength != 0 && |
2409
e4045b3c9772
ignore-length argument if retrieving DICOM tags
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2382
diff
changeset
|
544 utf8.size() > maxStringLength && |
e4045b3c9772
ignore-length argument if retrieving DICOM tags
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2382
diff
changeset
|
545 ignoreTagLength.find(GetTag(element)) == ignoreTagLength.end()) |
1854
e2c3d752ee1a
prevent too long tags to be inserted
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1831
diff
changeset
|
546 { |
2129
0c09d1af22f3
"/tools/invalidate-tags" to invalidate the JSON summary of all the DICOM files
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2126
diff
changeset
|
547 return new DicomValue; // Too long, create a NULL value |
1854
e2c3d752ee1a
prevent too long tags to be inserted
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1831
diff
changeset
|
548 } |
e2c3d752ee1a
prevent too long tags to be inserted
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1831
diff
changeset
|
549 else |
e2c3d752ee1a
prevent too long tags to be inserted
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1831
diff
changeset
|
550 { |
e2c3d752ee1a
prevent too long tags to be inserted
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1831
diff
changeset
|
551 return new DicomValue(utf8, false); |
e2c3d752ee1a
prevent too long tags to be inserted
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1831
diff
changeset
|
552 } |
0 | 553 } |
554 } | |
555 | |
2129
0c09d1af22f3
"/tools/invalidate-tags" to invalidate the JSON summary of all the DICOM files
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2126
diff
changeset
|
556 |
0c09d1af22f3
"/tools/invalidate-tags" to invalidate the JSON summary of all the DICOM files
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2126
diff
changeset
|
557 if (element.getVR() == EVR_UN) |
0c09d1af22f3
"/tools/invalidate-tags" to invalidate the JSON summary of all the DICOM files
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2126
diff
changeset
|
558 { |
0c09d1af22f3
"/tools/invalidate-tags" to invalidate the JSON summary of all the DICOM files
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2126
diff
changeset
|
559 // Unknown value representation: Lookup in the dictionary. This |
0c09d1af22f3
"/tools/invalidate-tags" to invalidate the JSON summary of all the DICOM files
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2126
diff
changeset
|
560 // is notably the case for private tags registered with the |
0c09d1af22f3
"/tools/invalidate-tags" to invalidate the JSON summary of all the DICOM files
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2126
diff
changeset
|
561 // "Dictionary" configuration option. |
0c09d1af22f3
"/tools/invalidate-tags" to invalidate the JSON summary of all the DICOM files
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2126
diff
changeset
|
562 DictionaryLocker locker; |
0c09d1af22f3
"/tools/invalidate-tags" to invalidate the JSON summary of all the DICOM files
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2126
diff
changeset
|
563 |
0c09d1af22f3
"/tools/invalidate-tags" to invalidate the JSON summary of all the DICOM files
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2126
diff
changeset
|
564 const DcmDictEntry* entry = locker->findEntry(element.getTag().getXTag(), |
0c09d1af22f3
"/tools/invalidate-tags" to invalidate the JSON summary of all the DICOM files
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2126
diff
changeset
|
565 element.getTag().getPrivateCreator()); |
0c09d1af22f3
"/tools/invalidate-tags" to invalidate the JSON summary of all the DICOM files
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2126
diff
changeset
|
566 if (entry != NULL && |
0c09d1af22f3
"/tools/invalidate-tags" to invalidate the JSON summary of all the DICOM files
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2126
diff
changeset
|
567 entry->getVR().isaString()) |
0c09d1af22f3
"/tools/invalidate-tags" to invalidate the JSON summary of all the DICOM files
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2126
diff
changeset
|
568 { |
0c09d1af22f3
"/tools/invalidate-tags" to invalidate the JSON summary of all the DICOM files
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2126
diff
changeset
|
569 Uint8* data = NULL; |
0c09d1af22f3
"/tools/invalidate-tags" to invalidate the JSON summary of all the DICOM files
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2126
diff
changeset
|
570 |
0c09d1af22f3
"/tools/invalidate-tags" to invalidate the JSON summary of all the DICOM files
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2126
diff
changeset
|
571 // At (*), we do not try and convert to UTF-8, as nothing says |
0c09d1af22f3
"/tools/invalidate-tags" to invalidate the JSON summary of all the DICOM files
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2126
diff
changeset
|
572 // the encoding of the private tag is the same as that of the |
0c09d1af22f3
"/tools/invalidate-tags" to invalidate the JSON summary of all the DICOM files
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2126
diff
changeset
|
573 // remaining of the DICOM dataset. Only go for ASCII strings. |
0c09d1af22f3
"/tools/invalidate-tags" to invalidate the JSON summary of all the DICOM files
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2126
diff
changeset
|
574 |
0c09d1af22f3
"/tools/invalidate-tags" to invalidate the JSON summary of all the DICOM files
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2126
diff
changeset
|
575 if (element.getUint8Array(data) == EC_Normal && |
0c09d1af22f3
"/tools/invalidate-tags" to invalidate the JSON summary of all the DICOM files
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2126
diff
changeset
|
576 Toolbox::IsAsciiString(data, element.getLength())) // (*) |
0c09d1af22f3
"/tools/invalidate-tags" to invalidate the JSON summary of all the DICOM files
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2126
diff
changeset
|
577 { |
0c09d1af22f3
"/tools/invalidate-tags" to invalidate the JSON summary of all the DICOM files
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2126
diff
changeset
|
578 if (data == NULL) |
0c09d1af22f3
"/tools/invalidate-tags" to invalidate the JSON summary of all the DICOM files
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2126
diff
changeset
|
579 { |
0c09d1af22f3
"/tools/invalidate-tags" to invalidate the JSON summary of all the DICOM files
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2126
diff
changeset
|
580 return new DicomValue("", false); // Empty string |
0c09d1af22f3
"/tools/invalidate-tags" to invalidate the JSON summary of all the DICOM files
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2126
diff
changeset
|
581 } |
0c09d1af22f3
"/tools/invalidate-tags" to invalidate the JSON summary of all the DICOM files
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2126
diff
changeset
|
582 else if (maxStringLength != 0 && |
2409
e4045b3c9772
ignore-length argument if retrieving DICOM tags
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2382
diff
changeset
|
583 element.getLength() > maxStringLength && |
e4045b3c9772
ignore-length argument if retrieving DICOM tags
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2382
diff
changeset
|
584 ignoreTagLength.find(GetTag(element)) == ignoreTagLength.end()) |
2129
0c09d1af22f3
"/tools/invalidate-tags" to invalidate the JSON summary of all the DICOM files
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2126
diff
changeset
|
585 { |
0c09d1af22f3
"/tools/invalidate-tags" to invalidate the JSON summary of all the DICOM files
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2126
diff
changeset
|
586 return new DicomValue; // Too long, create a NULL value |
0c09d1af22f3
"/tools/invalidate-tags" to invalidate the JSON summary of all the DICOM files
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2126
diff
changeset
|
587 } |
0c09d1af22f3
"/tools/invalidate-tags" to invalidate the JSON summary of all the DICOM files
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2126
diff
changeset
|
588 else |
0c09d1af22f3
"/tools/invalidate-tags" to invalidate the JSON summary of all the DICOM files
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2126
diff
changeset
|
589 { |
0c09d1af22f3
"/tools/invalidate-tags" to invalidate the JSON summary of all the DICOM files
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2126
diff
changeset
|
590 std::string s(reinterpret_cast<const char*>(data), element.getLength()); |
0c09d1af22f3
"/tools/invalidate-tags" to invalidate the JSON summary of all the DICOM files
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2126
diff
changeset
|
591 return new DicomValue(s, false); |
0c09d1af22f3
"/tools/invalidate-tags" to invalidate the JSON summary of all the DICOM files
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2126
diff
changeset
|
592 } |
0c09d1af22f3
"/tools/invalidate-tags" to invalidate the JSON summary of all the DICOM files
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2126
diff
changeset
|
593 } |
0c09d1af22f3
"/tools/invalidate-tags" to invalidate the JSON summary of all the DICOM files
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2126
diff
changeset
|
594 } |
0c09d1af22f3
"/tools/invalidate-tags" to invalidate the JSON summary of all the DICOM files
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2126
diff
changeset
|
595 } |
0c09d1af22f3
"/tools/invalidate-tags" to invalidate the JSON summary of all the DICOM files
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2126
diff
changeset
|
596 |
2409
e4045b3c9772
ignore-length argument if retrieving DICOM tags
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2382
diff
changeset
|
597 |
0 | 598 try |
599 { | |
600 // http://support.dcmtk.org/docs/dcvr_8h-source.html | |
601 switch (element.getVR()) | |
602 { | |
603 | |
604 /** | |
1738
15a788a63846
DicomToJsonFlags_IncludeBinary
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1737
diff
changeset
|
605 * Deal with binary data (including PixelData). |
0 | 606 **/ |
306
326d5a4a5af3
modification of instances
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
305
diff
changeset
|
607 |
302
238134081136
modification of dicom files
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
291
diff
changeset
|
608 case EVR_OB: // other byte |
238134081136
modification of dicom files
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
291
diff
changeset
|
609 case EVR_OF: // other float |
238134081136
modification of dicom files
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
291
diff
changeset
|
610 case EVR_OW: // other word |
238134081136
modification of dicom files
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
291
diff
changeset
|
611 case EVR_UN: // unknown value representation |
1739
df331354cea2
include binary in ToJson
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1738
diff
changeset
|
612 case EVR_ox: // OB or OW depending on context |
306
326d5a4a5af3
modification of instances
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
305
diff
changeset
|
613 case EVR_DS: // decimal string |
326d5a4a5af3
modification of instances
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
305
diff
changeset
|
614 case EVR_IS: // integer string |
326d5a4a5af3
modification of instances
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
305
diff
changeset
|
615 case EVR_AS: // age string |
326d5a4a5af3
modification of instances
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
305
diff
changeset
|
616 case EVR_DA: // date string |
326d5a4a5af3
modification of instances
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
305
diff
changeset
|
617 case EVR_DT: // date time string |
326d5a4a5af3
modification of instances
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
305
diff
changeset
|
618 case EVR_TM: // time string |
302
238134081136
modification of dicom files
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
291
diff
changeset
|
619 case EVR_AE: // application entity title |
238134081136
modification of dicom files
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
291
diff
changeset
|
620 case EVR_CS: // code string |
238134081136
modification of dicom files
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
291
diff
changeset
|
621 case EVR_SH: // short string |
238134081136
modification of dicom files
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
291
diff
changeset
|
622 case EVR_LO: // long string |
238134081136
modification of dicom files
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
291
diff
changeset
|
623 case EVR_ST: // short text |
238134081136
modification of dicom files
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
291
diff
changeset
|
624 case EVR_LT: // long text |
238134081136
modification of dicom files
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
291
diff
changeset
|
625 case EVR_UT: // unlimited text |
238134081136
modification of dicom files
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
291
diff
changeset
|
626 case EVR_PN: // person name |
238134081136
modification of dicom files
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
291
diff
changeset
|
627 case EVR_UI: // unique identifier |
1818
1065401501fb
ParsedDicomFile::CreateFromJson
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1792
diff
changeset
|
628 case EVR_UNKNOWN: // used internally for elements with unknown VR (encoded with 4-byte length field in explicit VR) |
1065401501fb
ParsedDicomFile::CreateFromJson
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1792
diff
changeset
|
629 case EVR_UNKNOWN2B: // used internally for elements with unknown VR with 2-byte length field in explicit VR |
1065401501fb
ParsedDicomFile::CreateFromJson
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1792
diff
changeset
|
630 { |
1065401501fb
ParsedDicomFile::CreateFromJson
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1792
diff
changeset
|
631 if (!(flags & DicomToJsonFlags_ConvertBinaryToNull)) |
1065401501fb
ParsedDicomFile::CreateFromJson
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1792
diff
changeset
|
632 { |
1065401501fb
ParsedDicomFile::CreateFromJson
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1792
diff
changeset
|
633 Uint8* data = NULL; |
1065401501fb
ParsedDicomFile::CreateFromJson
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1792
diff
changeset
|
634 if (element.getUint8Array(data) == EC_Normal) |
1065401501fb
ParsedDicomFile::CreateFromJson
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1792
diff
changeset
|
635 { |
1065401501fb
ParsedDicomFile::CreateFromJson
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1792
diff
changeset
|
636 return new DicomValue(reinterpret_cast<const char*>(data), element.getLength(), true); |
1065401501fb
ParsedDicomFile::CreateFromJson
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1792
diff
changeset
|
637 } |
1065401501fb
ParsedDicomFile::CreateFromJson
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1792
diff
changeset
|
638 } |
0 | 639 |
1818
1065401501fb
ParsedDicomFile::CreateFromJson
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1792
diff
changeset
|
640 return new DicomValue; |
1065401501fb
ParsedDicomFile::CreateFromJson
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1792
diff
changeset
|
641 } |
1065401501fb
ParsedDicomFile::CreateFromJson
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1792
diff
changeset
|
642 |
1065401501fb
ParsedDicomFile::CreateFromJson
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1792
diff
changeset
|
643 /** |
2115
a657f7772e69
Handling of private tags/creators in the "Dictionary" configuration option
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2076
diff
changeset
|
644 * Numeric types |
1818
1065401501fb
ParsedDicomFile::CreateFromJson
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1792
diff
changeset
|
645 **/ |
0 | 646 |
302
238134081136
modification of dicom files
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
291
diff
changeset
|
647 case EVR_SL: // signed long |
238134081136
modification of dicom files
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
291
diff
changeset
|
648 { |
2554
ea63d9f90377
/tags now returns multiple numerical values in a \ separated string
am@osimis.io
parents:
2528
diff
changeset
|
649 return ApplyDcmtkToCTypeConverter<DcmtkToSint32Converter>(element); |
302
238134081136
modification of dicom files
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
291
diff
changeset
|
650 } |
238134081136
modification of dicom files
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
291
diff
changeset
|
651 |
238134081136
modification of dicom files
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
291
diff
changeset
|
652 case EVR_SS: // signed short |
238134081136
modification of dicom files
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
291
diff
changeset
|
653 { |
2554
ea63d9f90377
/tags now returns multiple numerical values in a \ separated string
am@osimis.io
parents:
2528
diff
changeset
|
654 return ApplyDcmtkToCTypeConverter<DcmtkToSint16Converter>(element); |
302
238134081136
modification of dicom files
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
291
diff
changeset
|
655 } |
238134081136
modification of dicom files
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
291
diff
changeset
|
656 |
238134081136
modification of dicom files
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
291
diff
changeset
|
657 case EVR_UL: // unsigned long |
238134081136
modification of dicom files
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
291
diff
changeset
|
658 { |
2554
ea63d9f90377
/tags now returns multiple numerical values in a \ separated string
am@osimis.io
parents:
2528
diff
changeset
|
659 return ApplyDcmtkToCTypeConverter<DcmtkToUint32Converter>(element); |
302
238134081136
modification of dicom files
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
291
diff
changeset
|
660 } |
238134081136
modification of dicom files
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
291
diff
changeset
|
661 |
238134081136
modification of dicom files
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
291
diff
changeset
|
662 case EVR_US: // unsigned short |
238134081136
modification of dicom files
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
291
diff
changeset
|
663 { |
2554
ea63d9f90377
/tags now returns multiple numerical values in a \ separated string
am@osimis.io
parents:
2528
diff
changeset
|
664 return ApplyDcmtkToCTypeConverter<DcmtkToUint16Converter>(element); |
302
238134081136
modification of dicom files
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
291
diff
changeset
|
665 } |
238134081136
modification of dicom files
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
291
diff
changeset
|
666 |
238134081136
modification of dicom files
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
291
diff
changeset
|
667 case EVR_FL: // float single-precision |
238134081136
modification of dicom files
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
291
diff
changeset
|
668 { |
2554
ea63d9f90377
/tags now returns multiple numerical values in a \ separated string
am@osimis.io
parents:
2528
diff
changeset
|
669 return ApplyDcmtkToCTypeConverter<DcmtkToFloat32Converter>(element); |
302
238134081136
modification of dicom files
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
291
diff
changeset
|
670 } |
238134081136
modification of dicom files
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
291
diff
changeset
|
671 |
238134081136
modification of dicom files
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
291
diff
changeset
|
672 case EVR_FD: // float double-precision |
238134081136
modification of dicom files
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
291
diff
changeset
|
673 { |
2554
ea63d9f90377
/tags now returns multiple numerical values in a \ separated string
am@osimis.io
parents:
2528
diff
changeset
|
674 return ApplyDcmtkToCTypeConverter<DcmtkToFloat64Converter>(element); |
1131 | 675 } |
676 | |
677 | |
678 /** | |
679 * Attribute tag. | |
680 **/ | |
681 | |
682 case EVR_AT: | |
683 { | |
1147 | 684 DcmTagKey tag; |
685 if (dynamic_cast<DcmAttributeTag&>(element).getTagVal(tag, 0).good()) | |
686 { | |
687 DicomTag t(tag.getGroup(), tag.getElement()); | |
1737
ec66a16aa398
removal of DicomStringValue and DicomNullValue
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1736
diff
changeset
|
688 return new DicomValue(t.Format(), false); |
1147 | 689 } |
1131 | 690 else |
1147 | 691 { |
1737
ec66a16aa398
removal of DicomStringValue and DicomNullValue
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1736
diff
changeset
|
692 return new DicomValue; |
1147 | 693 } |
302
238134081136
modification of dicom files
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
291
diff
changeset
|
694 } |
0 | 695 |
696 | |
697 /** | |
302
238134081136
modification of dicom files
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
291
diff
changeset
|
698 * Sequence types, should never occur at this point because of |
238134081136
modification of dicom files
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
291
diff
changeset
|
699 * "element.isLeaf()". |
238134081136
modification of dicom files
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
291
diff
changeset
|
700 **/ |
0 | 701 |
302
238134081136
modification of dicom files
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
291
diff
changeset
|
702 case EVR_SQ: // sequence of items |
1737
ec66a16aa398
removal of DicomStringValue and DicomNullValue
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1736
diff
changeset
|
703 return new DicomValue; |
0 | 704 |
705 | |
302
238134081136
modification of dicom files
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
291
diff
changeset
|
706 /** |
238134081136
modification of dicom files
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
291
diff
changeset
|
707 * Internal to DCMTK. |
238134081136
modification of dicom files
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
291
diff
changeset
|
708 **/ |
0 | 709 |
302
238134081136
modification of dicom files
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
291
diff
changeset
|
710 case EVR_xs: // SS or US depending on context |
238134081136
modification of dicom files
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
291
diff
changeset
|
711 case EVR_lt: // US, SS or OW depending on context, used for LUT Data (thus the name) |
238134081136
modification of dicom files
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
291
diff
changeset
|
712 case EVR_na: // na="not applicable", for data which has no VR |
238134081136
modification of dicom files
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
291
diff
changeset
|
713 case EVR_up: // up="unsigned pointer", used internally for DICOMDIR suppor |
238134081136
modification of dicom files
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
291
diff
changeset
|
714 case EVR_item: // used internally for items |
238134081136
modification of dicom files
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
291
diff
changeset
|
715 case EVR_metainfo: // used internally for meta info datasets |
238134081136
modification of dicom files
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
291
diff
changeset
|
716 case EVR_dataset: // used internally for datasets |
238134081136
modification of dicom files
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
291
diff
changeset
|
717 case EVR_fileFormat: // used internally for DICOM files |
238134081136
modification of dicom files
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
291
diff
changeset
|
718 case EVR_dicomDir: // used internally for DICOMDIR objects |
238134081136
modification of dicom files
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
291
diff
changeset
|
719 case EVR_dirRecord: // used internally for DICOMDIR records |
238134081136
modification of dicom files
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
291
diff
changeset
|
720 case EVR_pixelSQ: // used internally for pixel sequences in a compressed image |
238134081136
modification of dicom files
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
291
diff
changeset
|
721 case EVR_pixelItem: // used internally for pixel items in a compressed image |
238134081136
modification of dicom files
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
291
diff
changeset
|
722 case EVR_PixelData: // used internally for uncompressed pixeld data |
238134081136
modification of dicom files
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
291
diff
changeset
|
723 case EVR_OverlayData: // used internally for overlay data |
1737
ec66a16aa398
removal of DicomStringValue and DicomNullValue
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1736
diff
changeset
|
724 return new DicomValue; |
0 | 725 |
726 | |
302
238134081136
modification of dicom files
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
291
diff
changeset
|
727 /** |
238134081136
modification of dicom files
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
291
diff
changeset
|
728 * Default case. |
238134081136
modification of dicom files
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
291
diff
changeset
|
729 **/ |
0 | 730 |
302
238134081136
modification of dicom files
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
291
diff
changeset
|
731 default: |
1737
ec66a16aa398
removal of DicomStringValue and DicomNullValue
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1736
diff
changeset
|
732 return new DicomValue; |
0 | 733 } |
734 } | |
2499
83b8b6743531
ITagVisitor - for anonymization relationships
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2470
diff
changeset
|
735 catch (boost::bad_lexical_cast&) |
0 | 736 { |
1737
ec66a16aa398
removal of DicomStringValue and DicomNullValue
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1736
diff
changeset
|
737 return new DicomValue; |
0 | 738 } |
2499
83b8b6743531
ITagVisitor - for anonymization relationships
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2470
diff
changeset
|
739 catch (std::bad_cast&) |
306
326d5a4a5af3
modification of instances
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
305
diff
changeset
|
740 { |
1737
ec66a16aa398
removal of DicomStringValue and DicomNullValue
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1736
diff
changeset
|
741 return new DicomValue; |
306
326d5a4a5af3
modification of instances
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
305
diff
changeset
|
742 } |
0 | 743 } |
744 | |
745 | |
1687 | 746 static Json::Value& PrepareNode(Json::Value& parent, |
747 DcmElement& element, | |
748 DicomToJsonFormat format) | |
0 | 749 { |
1687 | 750 assert(parent.type() == Json::objectValue); |
0 | 751 |
35
f6d12037f886
full json vs. simplified json
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2
diff
changeset
|
752 DicomTag tag(FromDcmtkBridge::GetTag(element)); |
305
86bb79522f19
name of the private tags
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
304
diff
changeset
|
753 const std::string formattedTag = tag.Format(); |
86bb79522f19
name of the private tags
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
304
diff
changeset
|
754 |
1688
27d70e9ee2e4
DicomToJsonFormat enumeration
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1687
diff
changeset
|
755 if (format == DicomToJsonFormat_Short) |
27d70e9ee2e4
DicomToJsonFormat enumeration
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1687
diff
changeset
|
756 { |
27d70e9ee2e4
DicomToJsonFormat enumeration
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1687
diff
changeset
|
757 parent[formattedTag] = Json::nullValue; |
27d70e9ee2e4
DicomToJsonFormat enumeration
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1687
diff
changeset
|
758 return parent[formattedTag]; |
27d70e9ee2e4
DicomToJsonFormat enumeration
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1687
diff
changeset
|
759 } |
27d70e9ee2e4
DicomToJsonFormat enumeration
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1687
diff
changeset
|
760 |
27d70e9ee2e4
DicomToJsonFormat enumeration
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1687
diff
changeset
|
761 // This code gives access to the name of the private tags |
2115
a657f7772e69
Handling of private tags/creators in the "Dictionary" configuration option
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2076
diff
changeset
|
762 std::string tagName = FromDcmtkBridge::GetTagName(element); |
1688
27d70e9ee2e4
DicomToJsonFormat enumeration
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1687
diff
changeset
|
763 |
27d70e9ee2e4
DicomToJsonFormat enumeration
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1687
diff
changeset
|
764 switch (format) |
0 | 765 { |
1860
c7d70f659190
DicomToJsonFormat_Simple -> DicomToJsonFormat_Human
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1854
diff
changeset
|
766 case DicomToJsonFormat_Human: |
1688
27d70e9ee2e4
DicomToJsonFormat enumeration
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1687
diff
changeset
|
767 parent[tagName] = Json::nullValue; |
27d70e9ee2e4
DicomToJsonFormat enumeration
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1687
diff
changeset
|
768 return parent[tagName]; |
27d70e9ee2e4
DicomToJsonFormat enumeration
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1687
diff
changeset
|
769 |
27d70e9ee2e4
DicomToJsonFormat enumeration
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1687
diff
changeset
|
770 case DicomToJsonFormat_Full: |
27d70e9ee2e4
DicomToJsonFormat enumeration
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1687
diff
changeset
|
771 { |
27d70e9ee2e4
DicomToJsonFormat enumeration
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1687
diff
changeset
|
772 parent[formattedTag] = Json::objectValue; |
27d70e9ee2e4
DicomToJsonFormat enumeration
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1687
diff
changeset
|
773 Json::Value& node = parent[formattedTag]; |
27d70e9ee2e4
DicomToJsonFormat enumeration
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1687
diff
changeset
|
774 |
27d70e9ee2e4
DicomToJsonFormat enumeration
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1687
diff
changeset
|
775 if (element.isLeaf()) |
27d70e9ee2e4
DicomToJsonFormat enumeration
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1687
diff
changeset
|
776 { |
27d70e9ee2e4
DicomToJsonFormat enumeration
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1687
diff
changeset
|
777 node["Name"] = tagName; |
35
f6d12037f886
full json vs. simplified json
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2
diff
changeset
|
778 |
2076 | 779 if (element.getTag().getPrivateCreator() != NULL) |
1688
27d70e9ee2e4
DicomToJsonFormat enumeration
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1687
diff
changeset
|
780 { |
2076 | 781 node["PrivateCreator"] = element.getTag().getPrivateCreator(); |
1688
27d70e9ee2e4
DicomToJsonFormat enumeration
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1687
diff
changeset
|
782 } |
27d70e9ee2e4
DicomToJsonFormat enumeration
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1687
diff
changeset
|
783 |
27d70e9ee2e4
DicomToJsonFormat enumeration
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1687
diff
changeset
|
784 return node; |
27d70e9ee2e4
DicomToJsonFormat enumeration
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1687
diff
changeset
|
785 } |
27d70e9ee2e4
DicomToJsonFormat enumeration
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1687
diff
changeset
|
786 else |
27d70e9ee2e4
DicomToJsonFormat enumeration
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1687
diff
changeset
|
787 { |
27d70e9ee2e4
DicomToJsonFormat enumeration
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1687
diff
changeset
|
788 node["Name"] = tagName; |
27d70e9ee2e4
DicomToJsonFormat enumeration
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1687
diff
changeset
|
789 node["Type"] = "Sequence"; |
27d70e9ee2e4
DicomToJsonFormat enumeration
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1687
diff
changeset
|
790 node["Value"] = Json::nullValue; |
27d70e9ee2e4
DicomToJsonFormat enumeration
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1687
diff
changeset
|
791 return node["Value"]; |
27d70e9ee2e4
DicomToJsonFormat enumeration
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1687
diff
changeset
|
792 } |
306
326d5a4a5af3
modification of instances
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
305
diff
changeset
|
793 } |
326d5a4a5af3
modification of instances
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
305
diff
changeset
|
794 |
1688
27d70e9ee2e4
DicomToJsonFormat enumeration
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1687
diff
changeset
|
795 default: |
27d70e9ee2e4
DicomToJsonFormat enumeration
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1687
diff
changeset
|
796 throw OrthancException(ErrorCode_ParameterOutOfRange); |
1687 | 797 } |
798 } | |
799 | |
800 | |
801 static void LeafValueToJson(Json::Value& target, | |
802 const DicomValue& value, | |
803 DicomToJsonFormat format, | |
1738
15a788a63846
DicomToJsonFlags_IncludeBinary
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1737
diff
changeset
|
804 DicomToJsonFlags flags, |
1688
27d70e9ee2e4
DicomToJsonFormat enumeration
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1687
diff
changeset
|
805 unsigned int maxStringLength) |
1687 | 806 { |
1738
15a788a63846
DicomToJsonFlags_IncludeBinary
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1737
diff
changeset
|
807 Json::Value* targetValue = NULL; |
15a788a63846
DicomToJsonFlags_IncludeBinary
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1737
diff
changeset
|
808 Json::Value* targetType = NULL; |
15a788a63846
DicomToJsonFlags_IncludeBinary
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1737
diff
changeset
|
809 |
1688
27d70e9ee2e4
DicomToJsonFormat enumeration
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1687
diff
changeset
|
810 switch (format) |
1687 | 811 { |
1688
27d70e9ee2e4
DicomToJsonFormat enumeration
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1687
diff
changeset
|
812 case DicomToJsonFormat_Short: |
1860
c7d70f659190
DicomToJsonFormat_Simple -> DicomToJsonFormat_Human
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1854
diff
changeset
|
813 case DicomToJsonFormat_Human: |
1688
27d70e9ee2e4
DicomToJsonFormat enumeration
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1687
diff
changeset
|
814 { |
27d70e9ee2e4
DicomToJsonFormat enumeration
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1687
diff
changeset
|
815 assert(target.type() == Json::nullValue); |
1738
15a788a63846
DicomToJsonFlags_IncludeBinary
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1737
diff
changeset
|
816 targetValue = ⌖ |
1688
27d70e9ee2e4
DicomToJsonFormat enumeration
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1687
diff
changeset
|
817 break; |
27d70e9ee2e4
DicomToJsonFormat enumeration
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1687
diff
changeset
|
818 } |
27d70e9ee2e4
DicomToJsonFormat enumeration
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1687
diff
changeset
|
819 |
27d70e9ee2e4
DicomToJsonFormat enumeration
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1687
diff
changeset
|
820 case DicomToJsonFormat_Full: |
0 | 821 { |
1688
27d70e9ee2e4
DicomToJsonFormat enumeration
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1687
diff
changeset
|
822 assert(target.type() == Json::objectValue); |
1738
15a788a63846
DicomToJsonFlags_IncludeBinary
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1737
diff
changeset
|
823 target["Value"] = Json::nullValue; |
15a788a63846
DicomToJsonFlags_IncludeBinary
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1737
diff
changeset
|
824 target["Type"] = Json::nullValue; |
15a788a63846
DicomToJsonFlags_IncludeBinary
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1737
diff
changeset
|
825 targetType = &target["Type"]; |
15a788a63846
DicomToJsonFlags_IncludeBinary
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1737
diff
changeset
|
826 targetValue = &target["Value"]; |
1688
27d70e9ee2e4
DicomToJsonFormat enumeration
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1687
diff
changeset
|
827 break; |
0 | 828 } |
1688
27d70e9ee2e4
DicomToJsonFormat enumeration
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1687
diff
changeset
|
829 |
27d70e9ee2e4
DicomToJsonFormat enumeration
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1687
diff
changeset
|
830 default: |
27d70e9ee2e4
DicomToJsonFormat enumeration
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1687
diff
changeset
|
831 throw OrthancException(ErrorCode_ParameterOutOfRange); |
1687 | 832 } |
1738
15a788a63846
DicomToJsonFlags_IncludeBinary
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1737
diff
changeset
|
833 |
15a788a63846
DicomToJsonFlags_IncludeBinary
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1737
diff
changeset
|
834 assert(targetValue != NULL); |
15a788a63846
DicomToJsonFlags_IncludeBinary
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1737
diff
changeset
|
835 assert(targetValue->type() == Json::nullValue); |
15a788a63846
DicomToJsonFlags_IncludeBinary
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1737
diff
changeset
|
836 assert(targetType == NULL || targetType->type() == Json::nullValue); |
15a788a63846
DicomToJsonFlags_IncludeBinary
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1737
diff
changeset
|
837 |
15a788a63846
DicomToJsonFlags_IncludeBinary
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1737
diff
changeset
|
838 if (value.IsNull()) |
15a788a63846
DicomToJsonFlags_IncludeBinary
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1737
diff
changeset
|
839 { |
15a788a63846
DicomToJsonFlags_IncludeBinary
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1737
diff
changeset
|
840 if (targetType != NULL) |
15a788a63846
DicomToJsonFlags_IncludeBinary
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1737
diff
changeset
|
841 { |
15a788a63846
DicomToJsonFlags_IncludeBinary
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1737
diff
changeset
|
842 *targetType = "Null"; |
15a788a63846
DicomToJsonFlags_IncludeBinary
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1737
diff
changeset
|
843 } |
15a788a63846
DicomToJsonFlags_IncludeBinary
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1737
diff
changeset
|
844 } |
15a788a63846
DicomToJsonFlags_IncludeBinary
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1737
diff
changeset
|
845 else if (value.IsBinary()) |
15a788a63846
DicomToJsonFlags_IncludeBinary
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1737
diff
changeset
|
846 { |
15a788a63846
DicomToJsonFlags_IncludeBinary
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1737
diff
changeset
|
847 if (flags & DicomToJsonFlags_ConvertBinaryToAscii) |
15a788a63846
DicomToJsonFlags_IncludeBinary
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1737
diff
changeset
|
848 { |
15a788a63846
DicomToJsonFlags_IncludeBinary
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1737
diff
changeset
|
849 *targetValue = Toolbox::ConvertToAscii(value.GetContent()); |
15a788a63846
DicomToJsonFlags_IncludeBinary
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1737
diff
changeset
|
850 } |
15a788a63846
DicomToJsonFlags_IncludeBinary
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1737
diff
changeset
|
851 else |
15a788a63846
DicomToJsonFlags_IncludeBinary
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1737
diff
changeset
|
852 { |
15a788a63846
DicomToJsonFlags_IncludeBinary
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1737
diff
changeset
|
853 std::string s; |
15a788a63846
DicomToJsonFlags_IncludeBinary
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1737
diff
changeset
|
854 value.FormatDataUriScheme(s); |
15a788a63846
DicomToJsonFlags_IncludeBinary
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1737
diff
changeset
|
855 *targetValue = s; |
15a788a63846
DicomToJsonFlags_IncludeBinary
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1737
diff
changeset
|
856 } |
15a788a63846
DicomToJsonFlags_IncludeBinary
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1737
diff
changeset
|
857 |
15a788a63846
DicomToJsonFlags_IncludeBinary
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1737
diff
changeset
|
858 if (targetType != NULL) |
15a788a63846
DicomToJsonFlags_IncludeBinary
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1737
diff
changeset
|
859 { |
15a788a63846
DicomToJsonFlags_IncludeBinary
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1737
diff
changeset
|
860 *targetType = "Binary"; |
15a788a63846
DicomToJsonFlags_IncludeBinary
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1737
diff
changeset
|
861 } |
15a788a63846
DicomToJsonFlags_IncludeBinary
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1737
diff
changeset
|
862 } |
15a788a63846
DicomToJsonFlags_IncludeBinary
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1737
diff
changeset
|
863 else if (maxStringLength == 0 || |
15a788a63846
DicomToJsonFlags_IncludeBinary
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1737
diff
changeset
|
864 value.GetContent().size() <= maxStringLength) |
15a788a63846
DicomToJsonFlags_IncludeBinary
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1737
diff
changeset
|
865 { |
15a788a63846
DicomToJsonFlags_IncludeBinary
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1737
diff
changeset
|
866 *targetValue = value.GetContent(); |
15a788a63846
DicomToJsonFlags_IncludeBinary
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1737
diff
changeset
|
867 |
15a788a63846
DicomToJsonFlags_IncludeBinary
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1737
diff
changeset
|
868 if (targetType != NULL) |
15a788a63846
DicomToJsonFlags_IncludeBinary
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1737
diff
changeset
|
869 { |
15a788a63846
DicomToJsonFlags_IncludeBinary
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1737
diff
changeset
|
870 *targetType = "String"; |
15a788a63846
DicomToJsonFlags_IncludeBinary
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1737
diff
changeset
|
871 } |
15a788a63846
DicomToJsonFlags_IncludeBinary
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1737
diff
changeset
|
872 } |
15a788a63846
DicomToJsonFlags_IncludeBinary
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1737
diff
changeset
|
873 else |
15a788a63846
DicomToJsonFlags_IncludeBinary
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1737
diff
changeset
|
874 { |
15a788a63846
DicomToJsonFlags_IncludeBinary
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1737
diff
changeset
|
875 if (targetType != NULL) |
15a788a63846
DicomToJsonFlags_IncludeBinary
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1737
diff
changeset
|
876 { |
15a788a63846
DicomToJsonFlags_IncludeBinary
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1737
diff
changeset
|
877 *targetType = "TooLong"; |
15a788a63846
DicomToJsonFlags_IncludeBinary
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1737
diff
changeset
|
878 } |
15a788a63846
DicomToJsonFlags_IncludeBinary
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1737
diff
changeset
|
879 } |
1687 | 880 } |
35
f6d12037f886
full json vs. simplified json
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2
diff
changeset
|
881 |
1687 | 882 |
2126 | 883 void FromDcmtkBridge::ElementToJson(Json::Value& parent, |
884 DcmElement& element, | |
885 DicomToJsonFormat format, | |
886 DicomToJsonFlags flags, | |
887 unsigned int maxStringLength, | |
2409
e4045b3c9772
ignore-length argument if retrieving DICOM tags
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2382
diff
changeset
|
888 Encoding encoding, |
3217
cf8cbeb35f33
preliminary support of Korean character set
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3209
diff
changeset
|
889 bool hasCodeExtensions, |
2409
e4045b3c9772
ignore-length argument if retrieving DICOM tags
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2382
diff
changeset
|
890 const std::set<DicomTag>& ignoreTagLength) |
1687 | 891 { |
1691 | 892 if (parent.type() == Json::nullValue) |
893 { | |
894 parent = Json::objectValue; | |
895 } | |
896 | |
897 assert(parent.type() == Json::objectValue); | |
1687 | 898 Json::Value& target = PrepareNode(parent, element, format); |
899 | |
900 if (element.isLeaf()) | |
901 { | |
2129
0c09d1af22f3
"/tools/invalidate-tags" to invalidate the JSON summary of all the DICOM files
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2126
diff
changeset
|
902 // The "0" below lets "LeafValueToJson()" take care of "TooLong" values |
3712
2a170a8f1faf
replacing std::auto_ptr by std::unique_ptr
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3708
diff
changeset
|
903 std::unique_ptr<DicomValue> v(FromDcmtkBridge::ConvertLeafElement |
3217
cf8cbeb35f33
preliminary support of Korean character set
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3209
diff
changeset
|
904 (element, flags, 0, encoding, hasCodeExtensions, ignoreTagLength)); |
2409
e4045b3c9772
ignore-length argument if retrieving DICOM tags
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2382
diff
changeset
|
905 |
e4045b3c9772
ignore-length argument if retrieving DICOM tags
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2382
diff
changeset
|
906 if (ignoreTagLength.find(GetTag(element)) == ignoreTagLength.end()) |
e4045b3c9772
ignore-length argument if retrieving DICOM tags
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2382
diff
changeset
|
907 { |
e4045b3c9772
ignore-length argument if retrieving DICOM tags
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2382
diff
changeset
|
908 LeafValueToJson(target, *v, format, flags, maxStringLength); |
e4045b3c9772
ignore-length argument if retrieving DICOM tags
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2382
diff
changeset
|
909 } |
e4045b3c9772
ignore-length argument if retrieving DICOM tags
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2382
diff
changeset
|
910 else |
e4045b3c9772
ignore-length argument if retrieving DICOM tags
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2382
diff
changeset
|
911 { |
e4045b3c9772
ignore-length argument if retrieving DICOM tags
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2382
diff
changeset
|
912 LeafValueToJson(target, *v, format, flags, 0); |
e4045b3c9772
ignore-length argument if retrieving DICOM tags
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2382
diff
changeset
|
913 } |
0 | 914 } |
915 else | |
916 { | |
1688
27d70e9ee2e4
DicomToJsonFormat enumeration
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1687
diff
changeset
|
917 assert(target.type() == Json::nullValue); |
27d70e9ee2e4
DicomToJsonFormat enumeration
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1687
diff
changeset
|
918 target = Json::arrayValue; |
0 | 919 |
920 // "All subclasses of DcmElement except for DcmSequenceOfItems | |
921 // are leaf nodes, while DcmSequenceOfItems, DcmItem, DcmDataset | |
1687 | 922 // etc. are not." The following dynamic_cast is thus OK. |
0 | 923 DcmSequenceOfItems& sequence = dynamic_cast<DcmSequenceOfItems&>(element); |
924 | |
925 for (unsigned long i = 0; i < sequence.card(); i++) | |
926 { | |
927 DcmItem* child = sequence.getItem(i); | |
1687 | 928 Json::Value& v = target.append(Json::objectValue); |
3217
cf8cbeb35f33
preliminary support of Korean character set
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3209
diff
changeset
|
929 DatasetToJson(v, *child, format, flags, maxStringLength, encoding, hasCodeExtensions, ignoreTagLength); |
1687 | 930 } |
0 | 931 } |
932 } | |
933 | |
934 | |
2126 | 935 void FromDcmtkBridge::DatasetToJson(Json::Value& parent, |
936 DcmItem& item, | |
937 DicomToJsonFormat format, | |
938 DicomToJsonFlags flags, | |
939 unsigned int maxStringLength, | |
2409
e4045b3c9772
ignore-length argument if retrieving DICOM tags
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2382
diff
changeset
|
940 Encoding encoding, |
3217
cf8cbeb35f33
preliminary support of Korean character set
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3209
diff
changeset
|
941 bool hasCodeExtensions, |
2409
e4045b3c9772
ignore-length argument if retrieving DICOM tags
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2382
diff
changeset
|
942 const std::set<DicomTag>& ignoreTagLength) |
1686 | 943 { |
1688
27d70e9ee2e4
DicomToJsonFormat enumeration
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1687
diff
changeset
|
944 assert(parent.type() == Json::objectValue); |
1686 | 945 |
946 for (unsigned long i = 0; i < item.card(); i++) | |
947 { | |
948 DcmElement* element = item.getElement(i); | |
1735
a001f6226c7c
primitives for flags in dicom-to-json conversions
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1695
diff
changeset
|
949 if (element == NULL) |
a001f6226c7c
primitives for flags in dicom-to-json conversions
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1695
diff
changeset
|
950 { |
a001f6226c7c
primitives for flags in dicom-to-json conversions
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1695
diff
changeset
|
951 throw OrthancException(ErrorCode_InternalError); |
a001f6226c7c
primitives for flags in dicom-to-json conversions
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1695
diff
changeset
|
952 } |
a001f6226c7c
primitives for flags in dicom-to-json conversions
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1695
diff
changeset
|
953 |
1818
1065401501fb
ParsedDicomFile::CreateFromJson
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1792
diff
changeset
|
954 DicomTag tag(FromDcmtkBridge::Convert(element->getTag())); |
1065401501fb
ParsedDicomFile::CreateFromJson
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1792
diff
changeset
|
955 |
1065401501fb
ParsedDicomFile::CreateFromJson
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1792
diff
changeset
|
956 /*element->getTag().isPrivate()*/ |
1065401501fb
ParsedDicomFile::CreateFromJson
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1792
diff
changeset
|
957 if (tag.IsPrivate() && |
1065401501fb
ParsedDicomFile::CreateFromJson
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1792
diff
changeset
|
958 !(flags & DicomToJsonFlags_IncludePrivateTags)) |
1736
b953c6eef28d
ToJson: IncludePrivateTags and IncludeUnknownTags
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1735
diff
changeset
|
959 { |
b953c6eef28d
ToJson: IncludePrivateTags and IncludeUnknownTags
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1735
diff
changeset
|
960 continue; |
b953c6eef28d
ToJson: IncludePrivateTags and IncludeUnknownTags
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1735
diff
changeset
|
961 } |
b953c6eef28d
ToJson: IncludePrivateTags and IncludeUnknownTags
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1735
diff
changeset
|
962 |
b953c6eef28d
ToJson: IncludePrivateTags and IncludeUnknownTags
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1735
diff
changeset
|
963 if (!(flags & DicomToJsonFlags_IncludeUnknownTags)) |
1735
a001f6226c7c
primitives for flags in dicom-to-json conversions
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1695
diff
changeset
|
964 { |
1736
b953c6eef28d
ToJson: IncludePrivateTags and IncludeUnknownTags
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1735
diff
changeset
|
965 DictionaryLocker locker; |
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
|
966 if (locker->findEntry(element->getTag(), element->getTag().getPrivateCreator()) == NULL) |
1736
b953c6eef28d
ToJson: IncludePrivateTags and IncludeUnknownTags
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1735
diff
changeset
|
967 { |
b953c6eef28d
ToJson: IncludePrivateTags and IncludeUnknownTags
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1735
diff
changeset
|
968 continue; |
b953c6eef28d
ToJson: IncludePrivateTags and IncludeUnknownTags
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1735
diff
changeset
|
969 } |
1735
a001f6226c7c
primitives for flags in dicom-to-json conversions
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1695
diff
changeset
|
970 } |
1736
b953c6eef28d
ToJson: IncludePrivateTags and IncludeUnknownTags
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1735
diff
changeset
|
971 |
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
|
972 if (IsBinaryTag(element->getTag())) |
1739
df331354cea2
include binary in ToJson
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1738
diff
changeset
|
973 { |
df331354cea2
include binary in ToJson
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1738
diff
changeset
|
974 // This is a binary tag |
df331354cea2
include binary in ToJson
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1738
diff
changeset
|
975 if ((tag == DICOM_TAG_PIXEL_DATA && !(flags & DicomToJsonFlags_IncludePixelData)) || |
df331354cea2
include binary in ToJson
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1738
diff
changeset
|
976 (tag != DICOM_TAG_PIXEL_DATA && !(flags & DicomToJsonFlags_IncludeBinary))) |
df331354cea2
include binary in ToJson
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1738
diff
changeset
|
977 { |
df331354cea2
include binary in ToJson
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1738
diff
changeset
|
978 continue; |
df331354cea2
include binary in ToJson
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1738
diff
changeset
|
979 } |
df331354cea2
include binary in ToJson
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1738
diff
changeset
|
980 } |
df331354cea2
include binary in ToJson
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1738
diff
changeset
|
981 |
2409
e4045b3c9772
ignore-length argument if retrieving DICOM tags
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2382
diff
changeset
|
982 FromDcmtkBridge::ElementToJson(parent, *element, format, flags, |
3217
cf8cbeb35f33
preliminary support of Korean character set
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3209
diff
changeset
|
983 maxStringLength, encoding, hasCodeExtensions, ignoreTagLength); |
1686 | 984 } |
985 } | |
986 | |
987 | |
2126 | 988 void FromDcmtkBridge::ExtractDicomAsJson(Json::Value& target, |
989 DcmDataset& dataset, | |
990 DicomToJsonFormat format, | |
991 DicomToJsonFlags flags, | |
2131 | 992 unsigned int maxStringLength, |
2409
e4045b3c9772
ignore-length argument if retrieving DICOM tags
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2382
diff
changeset
|
993 Encoding defaultEncoding, |
e4045b3c9772
ignore-length argument if retrieving DICOM tags
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2382
diff
changeset
|
994 const std::set<DicomTag>& ignoreTagLength) |
0 | 995 { |
3217
cf8cbeb35f33
preliminary support of Korean character set
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3209
diff
changeset
|
996 bool hasCodeExtensions; |
cf8cbeb35f33
preliminary support of Korean character set
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3209
diff
changeset
|
997 Encoding encoding = DetectEncoding(hasCodeExtensions, dataset, defaultEncoding); |
2126 | 998 |
1688
27d70e9ee2e4
DicomToJsonFormat enumeration
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1687
diff
changeset
|
999 target = Json::objectValue; |
3217
cf8cbeb35f33
preliminary support of Korean character set
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3209
diff
changeset
|
1000 DatasetToJson(target, dataset, format, flags, maxStringLength, encoding, hasCodeExtensions, ignoreTagLength); |
0 | 1001 } |
1002 | |
1003 | |
2126 | 1004 void FromDcmtkBridge::ExtractHeaderAsJson(Json::Value& target, |
1005 DcmMetaInfo& dataset, | |
1006 DicomToJsonFormat format, | |
1007 DicomToJsonFlags flags, | |
1008 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
|
1009 { |
2409
e4045b3c9772
ignore-length argument if retrieving DICOM tags
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2382
diff
changeset
|
1010 std::set<DicomTag> ignoreTagLength; |
1831
3ae2ff249675
"/instances/.../header" to get the meta information (header) of the DICOM instance
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1818
diff
changeset
|
1011 target = Json::objectValue; |
3217
cf8cbeb35f33
preliminary support of Korean character set
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3209
diff
changeset
|
1012 DatasetToJson(target, dataset, format, flags, maxStringLength, Encoding_Ascii, false, ignoreTagLength); |
1831
3ae2ff249675
"/instances/.../header" to get the meta information (header) of the DICOM instance
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1818
diff
changeset
|
1013 } |
3ae2ff249675
"/instances/.../header" to get the meta information (header) of the DICOM instance
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1818
diff
changeset
|
1014 |
3ae2ff249675
"/instances/.../header" to get the meta information (header) of the DICOM instance
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1818
diff
changeset
|
1015 |
2115
a657f7772e69
Handling of private tags/creators in the "Dictionary" configuration option
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2076
diff
changeset
|
1016 |
a657f7772e69
Handling of private tags/creators in the "Dictionary" configuration option
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2076
diff
changeset
|
1017 static std::string GetTagNameInternal(DcmTag& tag) |
0 | 1018 { |
291
4d7469f72a0b
embedding of dicom dictionaries
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
285
diff
changeset
|
1019 { |
2115
a657f7772e69
Handling of private tags/creators in the "Dictionary" configuration option
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2076
diff
changeset
|
1020 // Some patches for important tags because of different DICOM |
a657f7772e69
Handling of private tags/creators in the "Dictionary" configuration option
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2076
diff
changeset
|
1021 // dictionaries between DCMTK versions |
a657f7772e69
Handling of private tags/creators in the "Dictionary" configuration option
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2076
diff
changeset
|
1022 DicomTag tmp(tag.getGroup(), tag.getElement()); |
a657f7772e69
Handling of private tags/creators in the "Dictionary" configuration option
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2076
diff
changeset
|
1023 std::string n = tmp.GetMainTagsName(); |
a657f7772e69
Handling of private tags/creators in the "Dictionary" configuration option
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2076
diff
changeset
|
1024 if (n.size() != 0) |
a657f7772e69
Handling of private tags/creators in the "Dictionary" configuration option
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2076
diff
changeset
|
1025 { |
a657f7772e69
Handling of private tags/creators in the "Dictionary" configuration option
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2076
diff
changeset
|
1026 return n; |
a657f7772e69
Handling of private tags/creators in the "Dictionary" configuration option
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2076
diff
changeset
|
1027 } |
a657f7772e69
Handling of private tags/creators in the "Dictionary" configuration option
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2076
diff
changeset
|
1028 // End of patches |
291
4d7469f72a0b
embedding of dicom dictionaries
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
285
diff
changeset
|
1029 } |
106 | 1030 |
305
86bb79522f19
name of the private tags
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
304
diff
changeset
|
1031 #if 0 |
2115
a657f7772e69
Handling of private tags/creators in the "Dictionary" configuration option
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2076
diff
changeset
|
1032 // This version explicitly calls the dictionary |
0 | 1033 const DcmDataDictionary& dict = dcmDataDict.rdlock(); |
1034 const DcmDictEntry* entry = dict.findEntry(tag, NULL); | |
1035 | |
306
326d5a4a5af3
modification of instances
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
305
diff
changeset
|
1036 std::string s(DcmTag_ERROR_TagName); |
0 | 1037 if (entry != NULL) |
1038 { | |
1039 s = std::string(entry->getTagName()); | |
1040 } | |
1041 | |
1042 dcmDataDict.unlock(); | |
1043 return s; | |
305
86bb79522f19
name of the private tags
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
304
diff
changeset
|
1044 #else |
86bb79522f19
name of the private tags
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
304
diff
changeset
|
1045 const char* name = tag.getTagName(); |
86bb79522f19
name of the private tags
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
304
diff
changeset
|
1046 if (name == NULL) |
86bb79522f19
name of the private tags
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
304
diff
changeset
|
1047 { |
306
326d5a4a5af3
modification of instances
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
305
diff
changeset
|
1048 return DcmTag_ERROR_TagName; |
305
86bb79522f19
name of the private tags
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
304
diff
changeset
|
1049 } |
86bb79522f19
name of the private tags
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
304
diff
changeset
|
1050 else |
86bb79522f19
name of the private tags
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
304
diff
changeset
|
1051 { |
86bb79522f19
name of the private tags
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
304
diff
changeset
|
1052 return std::string(name); |
86bb79522f19
name of the private tags
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
304
diff
changeset
|
1053 } |
86bb79522f19
name of the private tags
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
304
diff
changeset
|
1054 #endif |
0 | 1055 } |
1056 | |
1057 | |
2115
a657f7772e69
Handling of private tags/creators in the "Dictionary" configuration option
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2076
diff
changeset
|
1058 std::string FromDcmtkBridge::GetTagName(const DicomTag& t, |
a657f7772e69
Handling of private tags/creators in the "Dictionary" configuration option
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2076
diff
changeset
|
1059 const std::string& privateCreator) |
a657f7772e69
Handling of private tags/creators in the "Dictionary" configuration option
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2076
diff
changeset
|
1060 { |
a657f7772e69
Handling of private tags/creators in the "Dictionary" configuration option
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2076
diff
changeset
|
1061 DcmTag tag(t.GetGroup(), t.GetElement()); |
a657f7772e69
Handling of private tags/creators in the "Dictionary" configuration option
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2076
diff
changeset
|
1062 |
a657f7772e69
Handling of private tags/creators in the "Dictionary" configuration option
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2076
diff
changeset
|
1063 if (!privateCreator.empty()) |
a657f7772e69
Handling of private tags/creators in the "Dictionary" configuration option
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2076
diff
changeset
|
1064 { |
a657f7772e69
Handling of private tags/creators in the "Dictionary" configuration option
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2076
diff
changeset
|
1065 tag.setPrivateCreator(privateCreator.c_str()); |
a657f7772e69
Handling of private tags/creators in the "Dictionary" configuration option
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2076
diff
changeset
|
1066 } |
a657f7772e69
Handling of private tags/creators in the "Dictionary" configuration option
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2076
diff
changeset
|
1067 |
a657f7772e69
Handling of private tags/creators in the "Dictionary" configuration option
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2076
diff
changeset
|
1068 return GetTagNameInternal(tag); |
a657f7772e69
Handling of private tags/creators in the "Dictionary" configuration option
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2076
diff
changeset
|
1069 } |
a657f7772e69
Handling of private tags/creators in the "Dictionary" configuration option
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2076
diff
changeset
|
1070 |
a657f7772e69
Handling of private tags/creators in the "Dictionary" configuration option
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2076
diff
changeset
|
1071 |
a657f7772e69
Handling of private tags/creators in the "Dictionary" configuration option
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2076
diff
changeset
|
1072 std::string FromDcmtkBridge::GetTagName(const DcmElement& element) |
a657f7772e69
Handling of private tags/creators in the "Dictionary" configuration option
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2076
diff
changeset
|
1073 { |
a657f7772e69
Handling of private tags/creators in the "Dictionary" configuration option
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2076
diff
changeset
|
1074 // Copy the tag to ensure const-correctness of DcmElement. Note |
a657f7772e69
Handling of private tags/creators in the "Dictionary" configuration option
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2076
diff
changeset
|
1075 // that the private creator information is also copied. |
a657f7772e69
Handling of private tags/creators in the "Dictionary" configuration option
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2076
diff
changeset
|
1076 DcmTag tag(element.getTag()); |
a657f7772e69
Handling of private tags/creators in the "Dictionary" configuration option
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2076
diff
changeset
|
1077 |
a657f7772e69
Handling of private tags/creators in the "Dictionary" configuration option
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2076
diff
changeset
|
1078 return GetTagNameInternal(tag); |
a657f7772e69
Handling of private tags/creators in the "Dictionary" configuration option
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2076
diff
changeset
|
1079 } |
a657f7772e69
Handling of private tags/creators in the "Dictionary" configuration option
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2076
diff
changeset
|
1080 |
a657f7772e69
Handling of private tags/creators in the "Dictionary" configuration option
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2076
diff
changeset
|
1081 |
a657f7772e69
Handling of private tags/creators in the "Dictionary" configuration option
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2076
diff
changeset
|
1082 |
304 | 1083 DicomTag FromDcmtkBridge::ParseTag(const char* name) |
0 | 1084 { |
2662
47d812308d63
serialization of DicomModification
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2554
diff
changeset
|
1085 DicomTag parsed(0, 0); |
47d812308d63
serialization of DicomModification
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2554
diff
changeset
|
1086 if (DicomTag::ParseHexadecimal(parsed, name)) |
304 | 1087 { |
2662
47d812308d63
serialization of DicomModification
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2554
diff
changeset
|
1088 return parsed; |
1861
a7bea843a7bc
"OrthancPluginLookupDictionary()" to get information about some DICOM tag
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1860
diff
changeset
|
1089 } |
a7bea843a7bc
"OrthancPluginLookupDictionary()" to get information about some DICOM tag
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1860
diff
changeset
|
1090 |
305
86bb79522f19
name of the private tags
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
304
diff
changeset
|
1091 #if 0 |
0 | 1092 const DcmDataDictionary& dict = dcmDataDict.rdlock(); |
1093 const DcmDictEntry* entry = dict.findEntry(name); | |
1094 | |
1095 if (entry == NULL) | |
1096 { | |
1097 dcmDataDict.unlock(); | |
1582
bd1889029cbb
encoding of exceptions
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1557
diff
changeset
|
1098 throw OrthancException(ErrorCode_UnknownDicomTag); |
0 | 1099 } |
1100 else | |
1101 { | |
1102 DcmTagKey key = entry->getKey(); | |
1103 DicomTag tag(key.getGroup(), key.getElement()); | |
1104 dcmDataDict.unlock(); | |
1105 return tag; | |
1106 } | |
305
86bb79522f19
name of the private tags
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
304
diff
changeset
|
1107 #else |
86bb79522f19
name of the private tags
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
304
diff
changeset
|
1108 DcmTag tag; |
86bb79522f19
name of the private tags
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
304
diff
changeset
|
1109 if (DcmTag::findTagFromName(name, tag).good()) |
86bb79522f19
name of the private tags
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
304
diff
changeset
|
1110 { |
86bb79522f19
name of the private tags
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
304
diff
changeset
|
1111 return DicomTag(tag.getGTag(), tag.getETag()); |
86bb79522f19
name of the private tags
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
304
diff
changeset
|
1112 } |
86bb79522f19
name of the private tags
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
304
diff
changeset
|
1113 else |
86bb79522f19
name of the private tags
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
304
diff
changeset
|
1114 { |
2470 | 1115 LOG(INFO) << "Unknown DICOM tag: \"" << name << "\""; |
1582
bd1889029cbb
encoding of exceptions
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1557
diff
changeset
|
1116 throw OrthancException(ErrorCode_UnknownDicomTag); |
305
86bb79522f19
name of the private tags
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
304
diff
changeset
|
1117 } |
86bb79522f19
name of the private tags
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
304
diff
changeset
|
1118 #endif |
0 | 1119 } |
1120 | |
1121 | |
1655
e40fd0d925c5
/tools/create-dicom can create tags with unknown VR
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1612
diff
changeset
|
1122 bool FromDcmtkBridge::IsUnknownTag(const DicomTag& tag) |
e40fd0d925c5
/tools/create-dicom can create tags with unknown VR
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1612
diff
changeset
|
1123 { |
e40fd0d925c5
/tools/create-dicom can create tags with unknown VR
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1612
diff
changeset
|
1124 DcmTag tmp(tag.GetGroup(), tag.GetElement()); |
e40fd0d925c5
/tools/create-dicom can create tags with unknown VR
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1612
diff
changeset
|
1125 return tmp.isUnknownVR(); |
e40fd0d925c5
/tools/create-dicom can create tags with unknown VR
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1612
diff
changeset
|
1126 } |
e40fd0d925c5
/tools/create-dicom can create tags with unknown VR
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1612
diff
changeset
|
1127 |
e40fd0d925c5
/tools/create-dicom can create tags with unknown VR
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1612
diff
changeset
|
1128 |
0 | 1129 void FromDcmtkBridge::ToJson(Json::Value& result, |
1368 | 1130 const DicomMap& values, |
1131 bool simplify) | |
0 | 1132 { |
1133 if (result.type() != Json::objectValue) | |
1134 { | |
62 | 1135 throw OrthancException(ErrorCode_BadParameterType); |
0 | 1136 } |
1137 | |
1138 result.clear(); | |
1139 | |
3651
46cb00e4adbb
DicomMap::DumpMainDicomTags() and DicomMap::ParseMainDicomTags()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3640
diff
changeset
|
1140 for (DicomMap::Content::const_iterator |
46cb00e4adbb
DicomMap::DumpMainDicomTags() and DicomMap::ParseMainDicomTags()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3640
diff
changeset
|
1141 it = values.content_.begin(); it != values.content_.end(); ++it) |
0 | 1142 { |
2115
a657f7772e69
Handling of private tags/creators in the "Dictionary" configuration option
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2076
diff
changeset
|
1143 // TODO Inject PrivateCreator if some is available in the DicomMap? |
a657f7772e69
Handling of private tags/creators in the "Dictionary" configuration option
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2076
diff
changeset
|
1144 const std::string tagName = GetTagName(it->first, ""); |
a657f7772e69
Handling of private tags/creators in the "Dictionary" configuration option
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2076
diff
changeset
|
1145 |
1368 | 1146 if (simplify) |
1147 { | |
1737
ec66a16aa398
removal of DicomStringValue and DicomNullValue
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1736
diff
changeset
|
1148 if (it->second->IsNull()) |
ec66a16aa398
removal of DicomStringValue and DicomNullValue
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1736
diff
changeset
|
1149 { |
2115
a657f7772e69
Handling of private tags/creators in the "Dictionary" configuration option
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2076
diff
changeset
|
1150 result[tagName] = Json::nullValue; |
1737
ec66a16aa398
removal of DicomStringValue and DicomNullValue
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1736
diff
changeset
|
1151 } |
ec66a16aa398
removal of DicomStringValue and DicomNullValue
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1736
diff
changeset
|
1152 else |
ec66a16aa398
removal of DicomStringValue and DicomNullValue
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1736
diff
changeset
|
1153 { |
ec66a16aa398
removal of DicomStringValue and DicomNullValue
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1736
diff
changeset
|
1154 // TODO IsBinary |
2115
a657f7772e69
Handling of private tags/creators in the "Dictionary" configuration option
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2076
diff
changeset
|
1155 result[tagName] = it->second->GetContent(); |
1737
ec66a16aa398
removal of DicomStringValue and DicomNullValue
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1736
diff
changeset
|
1156 } |
1368 | 1157 } |
1158 else | |
1159 { | |
1160 Json::Value value = Json::objectValue; | |
1161 | |
2115
a657f7772e69
Handling of private tags/creators in the "Dictionary" configuration option
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2076
diff
changeset
|
1162 value["Name"] = tagName; |
1368 | 1163 |
1164 if (it->second->IsNull()) | |
1165 { | |
1166 value["Type"] = "Null"; | |
1167 value["Value"] = Json::nullValue; | |
1168 } | |
1169 else | |
1170 { | |
1737
ec66a16aa398
removal of DicomStringValue and DicomNullValue
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1736
diff
changeset
|
1171 // TODO IsBinary |
1368 | 1172 value["Type"] = "String"; |
1737
ec66a16aa398
removal of DicomStringValue and DicomNullValue
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1736
diff
changeset
|
1173 value["Value"] = it->second->GetContent(); |
1368 | 1174 } |
1175 | |
1176 result[it->first.Format()] = value; | |
1177 } | |
0 | 1178 } |
1179 } | |
176 | 1180 |
1181 | |
788 | 1182 std::string FromDcmtkBridge::GenerateUniqueIdentifier(ResourceType level) |
176 | 1183 { |
1184 char uid[100]; | |
1185 | |
1186 switch (level) | |
1187 { | |
788 | 1188 case ResourceType_Patient: |
311 | 1189 // The "PatientID" field is of type LO (Long String), 64 |
1190 // Bytes Maximum. An UUID is of length 36, thus it can be used | |
1191 // as a random PatientID. | |
2512
4dcafa8d6633
SystemToolbox::GenerateUuid moved to Toolbox::GenerateUuid
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2499
diff
changeset
|
1192 return Toolbox::GenerateUuid(); |
306
326d5a4a5af3
modification of instances
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
305
diff
changeset
|
1193 |
788 | 1194 case ResourceType_Instance: |
302
238134081136
modification of dicom files
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
291
diff
changeset
|
1195 return dcmGenerateUniqueIdentifier(uid, SITE_INSTANCE_UID_ROOT); |
176 | 1196 |
788 | 1197 case ResourceType_Series: |
302
238134081136
modification of dicom files
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
291
diff
changeset
|
1198 return dcmGenerateUniqueIdentifier(uid, SITE_SERIES_UID_ROOT); |
176 | 1199 |
788 | 1200 case ResourceType_Study: |
302
238134081136
modification of dicom files
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
291
diff
changeset
|
1201 return dcmGenerateUniqueIdentifier(uid, SITE_STUDY_UID_ROOT); |
176 | 1202 |
302
238134081136
modification of dicom files
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
291
diff
changeset
|
1203 default: |
238134081136
modification of dicom files
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
291
diff
changeset
|
1204 throw OrthancException(ErrorCode_ParameterOutOfRange); |
176 | 1205 } |
1206 } | |
1207 | |
3748
ca36e3f1112c
transcoding to uncompressed transfer syntaxes
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3743
diff
changeset
|
1208 |
3872
b40dfa6dc8da
working on a simpler abstraction for transcoding
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3811
diff
changeset
|
1209 |
3748
ca36e3f1112c
transcoding to uncompressed transfer syntaxes
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3743
diff
changeset
|
1210 static bool SaveToMemoryBufferInternal(std::string& buffer, |
ca36e3f1112c
transcoding to uncompressed transfer syntaxes
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3743
diff
changeset
|
1211 DcmFileFormat& dicom, |
ca36e3f1112c
transcoding to uncompressed transfer syntaxes
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3743
diff
changeset
|
1212 E_TransferSyntax xfer) |
ca36e3f1112c
transcoding to uncompressed transfer syntaxes
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3743
diff
changeset
|
1213 { |
ca36e3f1112c
transcoding to uncompressed transfer syntaxes
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3743
diff
changeset
|
1214 E_EncodingType encodingType = /*opt_sequenceType*/ EET_ExplicitLength; |
ca36e3f1112c
transcoding to uncompressed transfer syntaxes
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3743
diff
changeset
|
1215 |
ca36e3f1112c
transcoding to uncompressed transfer syntaxes
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3743
diff
changeset
|
1216 // Create a memory buffer with the proper size |
ca36e3f1112c
transcoding to uncompressed transfer syntaxes
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3743
diff
changeset
|
1217 { |
ca36e3f1112c
transcoding to uncompressed transfer syntaxes
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3743
diff
changeset
|
1218 const uint32_t estimatedSize = dicom.calcElementLength(xfer, encodingType); // (*) |
ca36e3f1112c
transcoding to uncompressed transfer syntaxes
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3743
diff
changeset
|
1219 buffer.resize(estimatedSize); |
ca36e3f1112c
transcoding to uncompressed transfer syntaxes
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3743
diff
changeset
|
1220 } |
ca36e3f1112c
transcoding to uncompressed transfer syntaxes
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3743
diff
changeset
|
1221 |
ca36e3f1112c
transcoding to uncompressed transfer syntaxes
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3743
diff
changeset
|
1222 DcmOutputBufferStream ob(&buffer[0], buffer.size()); |
ca36e3f1112c
transcoding to uncompressed transfer syntaxes
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3743
diff
changeset
|
1223 |
ca36e3f1112c
transcoding to uncompressed transfer syntaxes
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3743
diff
changeset
|
1224 // Fill the memory buffer with the meta-header and the dataset |
ca36e3f1112c
transcoding to uncompressed transfer syntaxes
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3743
diff
changeset
|
1225 dicom.transferInit(); |
ca36e3f1112c
transcoding to uncompressed transfer syntaxes
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3743
diff
changeset
|
1226 OFCondition c = dicom.write(ob, xfer, encodingType, NULL, |
ca36e3f1112c
transcoding to uncompressed transfer syntaxes
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3743
diff
changeset
|
1227 /*opt_groupLength*/ EGL_recalcGL, |
3765
4a25727401cd
first transcoding to jpeg 8bpp
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3748
diff
changeset
|
1228 /*opt_paddingType*/ EPD_noChange, |
4a25727401cd
first transcoding to jpeg 8bpp
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3748
diff
changeset
|
1229 /*padlen*/ 0, /*subPadlen*/ 0, /*instanceLength*/ 0, |
4a25727401cd
first transcoding to jpeg 8bpp
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3748
diff
changeset
|
1230 EWM_updateMeta /* creates new SOP instance UID on lossy */); |
3748
ca36e3f1112c
transcoding to uncompressed transfer syntaxes
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3743
diff
changeset
|
1231 dicom.transferEnd(); |
ca36e3f1112c
transcoding to uncompressed transfer syntaxes
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3743
diff
changeset
|
1232 |
ca36e3f1112c
transcoding to uncompressed transfer syntaxes
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3743
diff
changeset
|
1233 if (c.good()) |
ca36e3f1112c
transcoding to uncompressed transfer syntaxes
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3743
diff
changeset
|
1234 { |
ca36e3f1112c
transcoding to uncompressed transfer syntaxes
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3743
diff
changeset
|
1235 // The DICOM file is successfully written, truncate the target |
ca36e3f1112c
transcoding to uncompressed transfer syntaxes
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3743
diff
changeset
|
1236 // buffer if its size was overestimated by (*) |
ca36e3f1112c
transcoding to uncompressed transfer syntaxes
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3743
diff
changeset
|
1237 ob.flush(); |
ca36e3f1112c
transcoding to uncompressed transfer syntaxes
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3743
diff
changeset
|
1238 |
ca36e3f1112c
transcoding to uncompressed transfer syntaxes
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3743
diff
changeset
|
1239 size_t effectiveSize = static_cast<size_t>(ob.tell()); |
ca36e3f1112c
transcoding to uncompressed transfer syntaxes
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3743
diff
changeset
|
1240 if (effectiveSize < buffer.size()) |
ca36e3f1112c
transcoding to uncompressed transfer syntaxes
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3743
diff
changeset
|
1241 { |
ca36e3f1112c
transcoding to uncompressed transfer syntaxes
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3743
diff
changeset
|
1242 buffer.resize(effectiveSize); |
ca36e3f1112c
transcoding to uncompressed transfer syntaxes
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3743
diff
changeset
|
1243 } |
ca36e3f1112c
transcoding to uncompressed transfer syntaxes
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3743
diff
changeset
|
1244 |
ca36e3f1112c
transcoding to uncompressed transfer syntaxes
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3743
diff
changeset
|
1245 return true; |
ca36e3f1112c
transcoding to uncompressed transfer syntaxes
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3743
diff
changeset
|
1246 } |
ca36e3f1112c
transcoding to uncompressed transfer syntaxes
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3743
diff
changeset
|
1247 else |
ca36e3f1112c
transcoding to uncompressed transfer syntaxes
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3743
diff
changeset
|
1248 { |
ca36e3f1112c
transcoding to uncompressed transfer syntaxes
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3743
diff
changeset
|
1249 // Error |
ca36e3f1112c
transcoding to uncompressed transfer syntaxes
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3743
diff
changeset
|
1250 buffer.clear(); |
ca36e3f1112c
transcoding to uncompressed transfer syntaxes
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3743
diff
changeset
|
1251 return false; |
ca36e3f1112c
transcoding to uncompressed transfer syntaxes
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3743
diff
changeset
|
1252 } |
ca36e3f1112c
transcoding to uncompressed transfer syntaxes
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3743
diff
changeset
|
1253 } |
ca36e3f1112c
transcoding to uncompressed transfer syntaxes
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3743
diff
changeset
|
1254 |
ca36e3f1112c
transcoding to uncompressed transfer syntaxes
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3743
diff
changeset
|
1255 |
291
4d7469f72a0b
embedding of dicom dictionaries
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
285
diff
changeset
|
1256 bool FromDcmtkBridge::SaveToMemoryBuffer(std::string& buffer, |
1004
a226e0959d8b
DicomInstanceToStore
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
991
diff
changeset
|
1257 DcmDataset& dataSet) |
291
4d7469f72a0b
embedding of dicom dictionaries
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
285
diff
changeset
|
1258 { |
4d7469f72a0b
embedding of dicom dictionaries
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
285
diff
changeset
|
1259 // Determine the transfer syntax which shall be used to write the |
3811
890af7156f19
fix transcoding to jpeg baseline
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3772
diff
changeset
|
1260 // information to the file. If not possible, switch to the Little |
890af7156f19
fix transcoding to jpeg baseline
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3772
diff
changeset
|
1261 // Endian syntax, with explicit length. |
291
4d7469f72a0b
embedding of dicom dictionaries
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
285
diff
changeset
|
1262 |
4d7469f72a0b
embedding of dicom dictionaries
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
285
diff
changeset
|
1263 // http://support.dcmtk.org/docs/dcxfer_8h-source.html |
661
d233b5090105
accept more transfer syntaxes for C-Store SCP, write meta-header when receiving files
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
656
diff
changeset
|
1264 |
d233b5090105
accept more transfer syntaxes for C-Store SCP, write meta-header when receiving files
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
656
diff
changeset
|
1265 |
d233b5090105
accept more transfer syntaxes for C-Store SCP, write meta-header when receiving files
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
656
diff
changeset
|
1266 /** |
d233b5090105
accept more transfer syntaxes for C-Store SCP, write meta-header when receiving files
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
656
diff
changeset
|
1267 * Note that up to Orthanc 0.7.1 (inclusive), the |
d233b5090105
accept more transfer syntaxes for C-Store SCP, write meta-header when receiving files
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
656
diff
changeset
|
1268 * "EXS_LittleEndianExplicit" was always used to save the DICOM |
d233b5090105
accept more transfer syntaxes for C-Store SCP, write meta-header when receiving files
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
656
diff
changeset
|
1269 * dataset into memory. We now keep the original transfer syntax |
d233b5090105
accept more transfer syntaxes for C-Store SCP, write meta-header when receiving files
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
656
diff
changeset
|
1270 * (if available). |
d233b5090105
accept more transfer syntaxes for C-Store SCP, write meta-header when receiving files
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
656
diff
changeset
|
1271 **/ |
3883
795c9ca5eb91
DANGEROUS changeset: replaced "getOriginalXfer()" by "getCurrentXfer()" throughout Orthanc
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3882
diff
changeset
|
1272 E_TransferSyntax xfer = dataSet.getCurrentXfer(); |
661
d233b5090105
accept more transfer syntaxes for C-Store SCP, write meta-header when receiving files
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
656
diff
changeset
|
1273 if (xfer == EXS_Unknown) |
d233b5090105
accept more transfer syntaxes for C-Store SCP, write meta-header when receiving files
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
656
diff
changeset
|
1274 { |
d233b5090105
accept more transfer syntaxes for C-Store SCP, write meta-header when receiving files
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
656
diff
changeset
|
1275 // No information about the original transfer syntax: This is |
d233b5090105
accept more transfer syntaxes for C-Store SCP, write meta-header when receiving files
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
656
diff
changeset
|
1276 // most probably a DICOM dataset that was read from memory. |
d233b5090105
accept more transfer syntaxes for C-Store SCP, write meta-header when receiving files
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
656
diff
changeset
|
1277 xfer = EXS_LittleEndianExplicit; |
d233b5090105
accept more transfer syntaxes for C-Store SCP, write meta-header when receiving files
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
656
diff
changeset
|
1278 } |
d233b5090105
accept more transfer syntaxes for C-Store SCP, write meta-header when receiving files
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
656
diff
changeset
|
1279 |
d233b5090105
accept more transfer syntaxes for C-Store SCP, write meta-header when receiving files
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
656
diff
changeset
|
1280 // Create the meta-header information |
1004
a226e0959d8b
DicomInstanceToStore
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
991
diff
changeset
|
1281 DcmFileFormat ff(&dataSet); |
661
d233b5090105
accept more transfer syntaxes for C-Store SCP, write meta-header when receiving files
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
656
diff
changeset
|
1282 ff.validateMetaInfo(xfer); |
1316
1c8dfedefefe
Fix anonymization generating non-portable DICOM files
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1307
diff
changeset
|
1283 ff.removeInvalidGroups(); |
291
4d7469f72a0b
embedding of dicom dictionaries
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
285
diff
changeset
|
1284 |
3748
ca36e3f1112c
transcoding to uncompressed transfer syntaxes
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3743
diff
changeset
|
1285 return SaveToMemoryBufferInternal(buffer, ff, xfer); |
ca36e3f1112c
transcoding to uncompressed transfer syntaxes
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3743
diff
changeset
|
1286 } |
ca36e3f1112c
transcoding to uncompressed transfer syntaxes
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3743
diff
changeset
|
1287 |
ca36e3f1112c
transcoding to uncompressed transfer syntaxes
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3743
diff
changeset
|
1288 |
3872
b40dfa6dc8da
working on a simpler abstraction for transcoding
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3811
diff
changeset
|
1289 bool FromDcmtkBridge::Transcode(DcmFileFormat& dicom, |
3748
ca36e3f1112c
transcoding to uncompressed transfer syntaxes
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3743
diff
changeset
|
1290 DicomTransferSyntax syntax, |
ca36e3f1112c
transcoding to uncompressed transfer syntaxes
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3743
diff
changeset
|
1291 const DcmRepresentationParameter* representation) |
ca36e3f1112c
transcoding to uncompressed transfer syntaxes
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3743
diff
changeset
|
1292 { |
ca36e3f1112c
transcoding to uncompressed transfer syntaxes
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3743
diff
changeset
|
1293 E_TransferSyntax xfer; |
ca36e3f1112c
transcoding to uncompressed transfer syntaxes
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3743
diff
changeset
|
1294 if (!LookupDcmtkTransferSyntax(xfer, syntax)) |
ca36e3f1112c
transcoding to uncompressed transfer syntaxes
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3743
diff
changeset
|
1295 { |
ca36e3f1112c
transcoding to uncompressed transfer syntaxes
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3743
diff
changeset
|
1296 throw OrthancException(ErrorCode_InternalError); |
ca36e3f1112c
transcoding to uncompressed transfer syntaxes
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3743
diff
changeset
|
1297 } |
ca36e3f1112c
transcoding to uncompressed transfer syntaxes
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3743
diff
changeset
|
1298 else |
3885
e23026566536
removed unused functions
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3883
diff
changeset
|
1299 { |
e23026566536
removed unused functions
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3883
diff
changeset
|
1300 DicomTransferSyntax sourceSyntax; |
e23026566536
removed unused functions
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3883
diff
changeset
|
1301 bool known = LookupOrthancTransferSyntax(sourceSyntax, dicom); |
3922
74eeadf5d51d
fix access to compressed frames after transcoding
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3896
diff
changeset
|
1302 |
74eeadf5d51d
fix access to compressed frames after transcoding
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3896
diff
changeset
|
1303 if (!dicom.chooseRepresentation(xfer, representation).good() || |
74eeadf5d51d
fix access to compressed frames after transcoding
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3896
diff
changeset
|
1304 !dicom.canWriteXfer(xfer) || |
3811
890af7156f19
fix transcoding to jpeg baseline
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3772
diff
changeset
|
1305 !dicom.validateMetaInfo(xfer, EWM_updateMeta).good()) |
890af7156f19
fix transcoding to jpeg baseline
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3772
diff
changeset
|
1306 { |
890af7156f19
fix transcoding to jpeg baseline
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3772
diff
changeset
|
1307 return false; |
890af7156f19
fix transcoding to jpeg baseline
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3772
diff
changeset
|
1308 } |
3872
b40dfa6dc8da
working on a simpler abstraction for transcoding
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3811
diff
changeset
|
1309 else |
b40dfa6dc8da
working on a simpler abstraction for transcoding
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3811
diff
changeset
|
1310 { |
b40dfa6dc8da
working on a simpler abstraction for transcoding
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3811
diff
changeset
|
1311 dicom.removeInvalidGroups(); |
3883
795c9ca5eb91
DANGEROUS changeset: replaced "getOriginalXfer()" by "getCurrentXfer()" throughout Orthanc
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3882
diff
changeset
|
1312 |
3885
e23026566536
removed unused functions
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3883
diff
changeset
|
1313 if (known) |
3883
795c9ca5eb91
DANGEROUS changeset: replaced "getOriginalXfer()" by "getCurrentXfer()" throughout Orthanc
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3882
diff
changeset
|
1314 { |
795c9ca5eb91
DANGEROUS changeset: replaced "getOriginalXfer()" by "getCurrentXfer()" throughout Orthanc
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3882
diff
changeset
|
1315 LOG(INFO) << "Transcoded an image from transfer syntax " |
795c9ca5eb91
DANGEROUS changeset: replaced "getOriginalXfer()" by "getCurrentXfer()" throughout Orthanc
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3882
diff
changeset
|
1316 << GetTransferSyntaxUid(sourceSyntax) << " to " |
795c9ca5eb91
DANGEROUS changeset: replaced "getOriginalXfer()" by "getCurrentXfer()" throughout Orthanc
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3882
diff
changeset
|
1317 << GetTransferSyntaxUid(syntax); |
795c9ca5eb91
DANGEROUS changeset: replaced "getOriginalXfer()" by "getCurrentXfer()" throughout Orthanc
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3882
diff
changeset
|
1318 } |
795c9ca5eb91
DANGEROUS changeset: replaced "getOriginalXfer()" by "getCurrentXfer()" throughout Orthanc
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3882
diff
changeset
|
1319 else |
795c9ca5eb91
DANGEROUS changeset: replaced "getOriginalXfer()" by "getCurrentXfer()" throughout Orthanc
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3882
diff
changeset
|
1320 { |
795c9ca5eb91
DANGEROUS changeset: replaced "getOriginalXfer()" by "getCurrentXfer()" throughout Orthanc
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3882
diff
changeset
|
1321 LOG(INFO) << "Transcoded an image from unknown transfer syntax to " |
795c9ca5eb91
DANGEROUS changeset: replaced "getOriginalXfer()" by "getCurrentXfer()" throughout Orthanc
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3882
diff
changeset
|
1322 << GetTransferSyntaxUid(syntax); |
795c9ca5eb91
DANGEROUS changeset: replaced "getOriginalXfer()" by "getCurrentXfer()" throughout Orthanc
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3882
diff
changeset
|
1323 } |
795c9ca5eb91
DANGEROUS changeset: replaced "getOriginalXfer()" by "getCurrentXfer()" throughout Orthanc
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3882
diff
changeset
|
1324 |
3872
b40dfa6dc8da
working on a simpler abstraction for transcoding
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3811
diff
changeset
|
1325 return true; |
b40dfa6dc8da
working on a simpler abstraction for transcoding
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3811
diff
changeset
|
1326 } |
291
4d7469f72a0b
embedding of dicom dictionaries
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
285
diff
changeset
|
1327 } |
4d7469f72a0b
embedding of dicom dictionaries
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
285
diff
changeset
|
1328 } |
1360 | 1329 |
1330 | |
2006
6301bbcbcaed
more generic support of value representations
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1998
diff
changeset
|
1331 ValueRepresentation FromDcmtkBridge::LookupValueRepresentation(const DicomTag& tag) |
1360 | 1332 { |
1333 DcmTag t(tag.GetGroup(), tag.GetElement()); | |
2006
6301bbcbcaed
more generic support of value representations
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1998
diff
changeset
|
1334 return Convert(t.getEVR()); |
6301bbcbcaed
more generic support of value representations
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1998
diff
changeset
|
1335 } |
6301bbcbcaed
more generic support of value representations
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1998
diff
changeset
|
1336 |
6301bbcbcaed
more generic support of value representations
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1998
diff
changeset
|
1337 ValueRepresentation FromDcmtkBridge::Convert(const DcmEVR vr) |
6301bbcbcaed
more generic support of value representations
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1998
diff
changeset
|
1338 { |
6301bbcbcaed
more generic support of value representations
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1998
diff
changeset
|
1339 switch (vr) |
1417
8e23f16a198d
fix issues 35 and 37
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1368
diff
changeset
|
1340 { |
2006
6301bbcbcaed
more generic support of value representations
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1998
diff
changeset
|
1341 case EVR_AE: |
6301bbcbcaed
more generic support of value representations
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1998
diff
changeset
|
1342 return ValueRepresentation_ApplicationEntity; |
6301bbcbcaed
more generic support of value representations
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1998
diff
changeset
|
1343 |
6301bbcbcaed
more generic support of value representations
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1998
diff
changeset
|
1344 case EVR_AS: |
6301bbcbcaed
more generic support of value representations
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1998
diff
changeset
|
1345 return ValueRepresentation_AgeString; |
6301bbcbcaed
more generic support of value representations
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1998
diff
changeset
|
1346 |
6301bbcbcaed
more generic support of value representations
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1998
diff
changeset
|
1347 case EVR_AT: |
6301bbcbcaed
more generic support of value representations
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1998
diff
changeset
|
1348 return ValueRepresentation_AttributeTag; |
6301bbcbcaed
more generic support of value representations
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1998
diff
changeset
|
1349 |
6301bbcbcaed
more generic support of value representations
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1998
diff
changeset
|
1350 case EVR_CS: |
6301bbcbcaed
more generic support of value representations
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1998
diff
changeset
|
1351 return ValueRepresentation_CodeString; |
1417
8e23f16a198d
fix issues 35 and 37
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1368
diff
changeset
|
1352 |
8e23f16a198d
fix issues 35 and 37
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1368
diff
changeset
|
1353 case EVR_DA: |
8e23f16a198d
fix issues 35 and 37
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1368
diff
changeset
|
1354 return ValueRepresentation_Date; |
8e23f16a198d
fix issues 35 and 37
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1368
diff
changeset
|
1355 |
2006
6301bbcbcaed
more generic support of value representations
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1998
diff
changeset
|
1356 case EVR_DS: |
6301bbcbcaed
more generic support of value representations
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1998
diff
changeset
|
1357 return ValueRepresentation_DecimalString; |
6301bbcbcaed
more generic support of value representations
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1998
diff
changeset
|
1358 |
1417
8e23f16a198d
fix issues 35 and 37
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1368
diff
changeset
|
1359 case EVR_DT: |
8e23f16a198d
fix issues 35 and 37
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1368
diff
changeset
|
1360 return ValueRepresentation_DateTime; |
8e23f16a198d
fix issues 35 and 37
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1368
diff
changeset
|
1361 |
2006
6301bbcbcaed
more generic support of value representations
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1998
diff
changeset
|
1362 case EVR_FL: |
6301bbcbcaed
more generic support of value representations
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1998
diff
changeset
|
1363 return ValueRepresentation_FloatingPointSingle; |
6301bbcbcaed
more generic support of value representations
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1998
diff
changeset
|
1364 |
6301bbcbcaed
more generic support of value representations
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1998
diff
changeset
|
1365 case EVR_FD: |
6301bbcbcaed
more generic support of value representations
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1998
diff
changeset
|
1366 return ValueRepresentation_FloatingPointDouble; |
6301bbcbcaed
more generic support of value representations
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1998
diff
changeset
|
1367 |
6301bbcbcaed
more generic support of value representations
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1998
diff
changeset
|
1368 case EVR_IS: |
6301bbcbcaed
more generic support of value representations
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1998
diff
changeset
|
1369 return ValueRepresentation_IntegerString; |
6301bbcbcaed
more generic support of value representations
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1998
diff
changeset
|
1370 |
6301bbcbcaed
more generic support of value representations
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1998
diff
changeset
|
1371 case EVR_LO: |
6301bbcbcaed
more generic support of value representations
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1998
diff
changeset
|
1372 return ValueRepresentation_LongString; |
6301bbcbcaed
more generic support of value representations
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1998
diff
changeset
|
1373 |
6301bbcbcaed
more generic support of value representations
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1998
diff
changeset
|
1374 case EVR_LT: |
6301bbcbcaed
more generic support of value representations
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1998
diff
changeset
|
1375 return ValueRepresentation_LongText; |
6301bbcbcaed
more generic support of value representations
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1998
diff
changeset
|
1376 |
6301bbcbcaed
more generic support of value representations
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1998
diff
changeset
|
1377 case EVR_OB: |
6301bbcbcaed
more generic support of value representations
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1998
diff
changeset
|
1378 return ValueRepresentation_OtherByte; |
6301bbcbcaed
more generic support of value representations
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1998
diff
changeset
|
1379 |
3199
9316f341e40f
unit testing json for dicomweb
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3198
diff
changeset
|
1380 #if DCMTK_VERSION_NUMBER >= 361 |
3198
7724ed267b5c
unit testing dicomweb conversion
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3195
diff
changeset
|
1381 case EVR_OD: |
7724ed267b5c
unit testing dicomweb conversion
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3195
diff
changeset
|
1382 return ValueRepresentation_OtherDouble; |
7724ed267b5c
unit testing dicomweb conversion
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3195
diff
changeset
|
1383 #endif |
2006
6301bbcbcaed
more generic support of value representations
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1998
diff
changeset
|
1384 |
6301bbcbcaed
more generic support of value representations
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1998
diff
changeset
|
1385 case EVR_OF: |
6301bbcbcaed
more generic support of value representations
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1998
diff
changeset
|
1386 return ValueRepresentation_OtherFloat; |
6301bbcbcaed
more generic support of value representations
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1998
diff
changeset
|
1387 |
3198
7724ed267b5c
unit testing dicomweb conversion
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3195
diff
changeset
|
1388 #if DCMTK_VERSION_NUMBER >= 362 |
7724ed267b5c
unit testing dicomweb conversion
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3195
diff
changeset
|
1389 case EVR_OL: |
7724ed267b5c
unit testing dicomweb conversion
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3195
diff
changeset
|
1390 return ValueRepresentation_OtherLong; |
7724ed267b5c
unit testing dicomweb conversion
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3195
diff
changeset
|
1391 #endif |
2006
6301bbcbcaed
more generic support of value representations
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1998
diff
changeset
|
1392 |
6301bbcbcaed
more generic support of value representations
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1998
diff
changeset
|
1393 case EVR_OW: |
6301bbcbcaed
more generic support of value representations
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1998
diff
changeset
|
1394 return ValueRepresentation_OtherWord; |
6301bbcbcaed
more generic support of value representations
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1998
diff
changeset
|
1395 |
6301bbcbcaed
more generic support of value representations
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1998
diff
changeset
|
1396 case EVR_PN: |
2007
655489d9165d
DicomMap::ParseDicomMetaInformation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2006
diff
changeset
|
1397 return ValueRepresentation_PersonName; |
2006
6301bbcbcaed
more generic support of value representations
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1998
diff
changeset
|
1398 |
6301bbcbcaed
more generic support of value representations
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1998
diff
changeset
|
1399 case EVR_SH: |
6301bbcbcaed
more generic support of value representations
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1998
diff
changeset
|
1400 return ValueRepresentation_ShortString; |
6301bbcbcaed
more generic support of value representations
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1998
diff
changeset
|
1401 |
6301bbcbcaed
more generic support of value representations
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1998
diff
changeset
|
1402 case EVR_SL: |
6301bbcbcaed
more generic support of value representations
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1998
diff
changeset
|
1403 return ValueRepresentation_SignedLong; |
6301bbcbcaed
more generic support of value representations
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1998
diff
changeset
|
1404 |
6301bbcbcaed
more generic support of value representations
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1998
diff
changeset
|
1405 case EVR_SQ: |
6301bbcbcaed
more generic support of value representations
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1998
diff
changeset
|
1406 return ValueRepresentation_Sequence; |
6301bbcbcaed
more generic support of value representations
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1998
diff
changeset
|
1407 |
6301bbcbcaed
more generic support of value representations
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1998
diff
changeset
|
1408 case EVR_SS: |
6301bbcbcaed
more generic support of value representations
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1998
diff
changeset
|
1409 return ValueRepresentation_SignedShort; |
6301bbcbcaed
more generic support of value representations
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1998
diff
changeset
|
1410 |
6301bbcbcaed
more generic support of value representations
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1998
diff
changeset
|
1411 case EVR_ST: |
6301bbcbcaed
more generic support of value representations
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1998
diff
changeset
|
1412 return ValueRepresentation_ShortText; |
6301bbcbcaed
more generic support of value representations
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1998
diff
changeset
|
1413 |
1417
8e23f16a198d
fix issues 35 and 37
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1368
diff
changeset
|
1414 case EVR_TM: |
8e23f16a198d
fix issues 35 and 37
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1368
diff
changeset
|
1415 return ValueRepresentation_Time; |
8e23f16a198d
fix issues 35 and 37
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1368
diff
changeset
|
1416 |
3199
9316f341e40f
unit testing json for dicomweb
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3198
diff
changeset
|
1417 #if DCMTK_VERSION_NUMBER >= 361 |
3198
7724ed267b5c
unit testing dicomweb conversion
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3195
diff
changeset
|
1418 case EVR_UC: |
7724ed267b5c
unit testing dicomweb conversion
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3195
diff
changeset
|
1419 return ValueRepresentation_UnlimitedCharacters; |
7724ed267b5c
unit testing dicomweb conversion
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3195
diff
changeset
|
1420 #endif |
2006
6301bbcbcaed
more generic support of value representations
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1998
diff
changeset
|
1421 |
6301bbcbcaed
more generic support of value representations
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1998
diff
changeset
|
1422 case EVR_UI: |
6301bbcbcaed
more generic support of value representations
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1998
diff
changeset
|
1423 return ValueRepresentation_UniqueIdentifier; |
6301bbcbcaed
more generic support of value representations
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1998
diff
changeset
|
1424 |
6301bbcbcaed
more generic support of value representations
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1998
diff
changeset
|
1425 case EVR_UL: |
6301bbcbcaed
more generic support of value representations
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1998
diff
changeset
|
1426 return ValueRepresentation_UnsignedLong; |
6301bbcbcaed
more generic support of value representations
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1998
diff
changeset
|
1427 |
6301bbcbcaed
more generic support of value representations
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1998
diff
changeset
|
1428 case EVR_UN: |
6301bbcbcaed
more generic support of value representations
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1998
diff
changeset
|
1429 return ValueRepresentation_Unknown; |
6301bbcbcaed
more generic support of value representations
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1998
diff
changeset
|
1430 |
3199
9316f341e40f
unit testing json for dicomweb
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3198
diff
changeset
|
1431 #if DCMTK_VERSION_NUMBER >= 361 |
3198
7724ed267b5c
unit testing dicomweb conversion
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3195
diff
changeset
|
1432 case EVR_UR: |
7724ed267b5c
unit testing dicomweb conversion
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3195
diff
changeset
|
1433 return ValueRepresentation_UniversalResource; |
7724ed267b5c
unit testing dicomweb conversion
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3195
diff
changeset
|
1434 #endif |
2006
6301bbcbcaed
more generic support of value representations
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1998
diff
changeset
|
1435 |
6301bbcbcaed
more generic support of value representations
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1998
diff
changeset
|
1436 case EVR_US: |
6301bbcbcaed
more generic support of value representations
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1998
diff
changeset
|
1437 return ValueRepresentation_UnsignedShort; |
6301bbcbcaed
more generic support of value representations
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1998
diff
changeset
|
1438 |
6301bbcbcaed
more generic support of value representations
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1998
diff
changeset
|
1439 case EVR_UT: |
6301bbcbcaed
more generic support of value representations
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1998
diff
changeset
|
1440 return ValueRepresentation_UnlimitedText; |
1792 | 1441 |
1417
8e23f16a198d
fix issues 35 and 37
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1368
diff
changeset
|
1442 default: |
2006
6301bbcbcaed
more generic support of value representations
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1998
diff
changeset
|
1443 return ValueRepresentation_NotSupported; |
1417
8e23f16a198d
fix issues 35 and 37
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1368
diff
changeset
|
1444 } |
1360 | 1445 } |
1446 | |
1689 | 1447 |
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
|
1448 DcmElement* FromDcmtkBridge::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
|
1449 const std::string& privateCreator) |
1693
558b25228a23
creation of tag hierarchy from json
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1691
diff
changeset
|
1450 { |
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
|
1451 if (tag.IsPrivate() && |
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
|
1452 privateCreator.empty()) |
1693
558b25228a23
creation of tag hierarchy from json
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1691
diff
changeset
|
1453 { |
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
|
1454 // This solves issue 140 (Modifying private tags with REST API |
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
|
1455 // changes VR from LO to UN) |
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
|
1456 // https://bitbucket.org/sjodogne/orthanc/issues/140 |
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
|
1457 LOG(WARNING) << "Private creator should not be empty while creating a private tag: " << tag.Format(); |
1693
558b25228a23
creation of tag hierarchy from json
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1691
diff
changeset
|
1458 } |
1689 | 1459 |
3692
fd302ec6a502
fix for ubuntu 16.04
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3691
diff
changeset
|
1460 #if DCMTK_VERSION_NUMBER >= 362 |
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
|
1461 DcmTag key(tag.GetGroup(), tag.GetElement()); |
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
|
1462 if (tag.IsPrivate()) |
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
|
1463 { |
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
|
1464 return DcmItem::newDicomElement(key, privateCreator.c_str()); |
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
|
1465 } |
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
|
1466 else |
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
|
1467 { |
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
|
1468 return DcmItem::newDicomElement(key, NULL); |
1689 | 1469 } |
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
|
1470 |
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
|
1471 #else |
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
|
1472 DcmTag key(tag.GetGroup(), tag.GetElement()); |
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
|
1473 if (tag.IsPrivate()) |
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
|
1474 { |
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
|
1475 // https://forum.dcmtk.org/viewtopic.php?t=4527 |
3708 | 1476 LOG(WARNING) << "You are using DCMTK <= 3.6.1: All the private tags " |
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
|
1477 "are considered as having a binary value representation"; |
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
|
1478 key.setPrivateCreator(privateCreator.c_str()); |
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
|
1479 return new DcmOtherByteOtherWord(key); |
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
|
1480 } |
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
|
1481 else |
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
|
1482 { |
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
|
1483 return newDicomElement(key); |
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
|
1484 } |
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
|
1485 #endif |
1689 | 1486 } |
1487 | |
1488 | |
1489 | |
1490 void FromDcmtkBridge::FillElementWithString(DcmElement& element, | |
1695 | 1491 const std::string& utf8Value, |
1818
1065401501fb
ParsedDicomFile::CreateFromJson
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1792
diff
changeset
|
1492 bool decodeDataUriScheme, |
1695 | 1493 Encoding dicomEncoding) |
1689 | 1494 { |
1495 std::string binary; | |
1695 | 1496 const std::string* decoded = &utf8Value; |
1689 | 1497 |
1818
1065401501fb
ParsedDicomFile::CreateFromJson
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1792
diff
changeset
|
1498 if (decodeDataUriScheme && |
2905
ae20fccdd867
refactoring mime types
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2831
diff
changeset
|
1499 boost::starts_with(utf8Value, URI_SCHEME_PREFIX_BINARY)) |
1689 | 1500 { |
1501 std::string mime; | |
1981
4b545a8b1f95
return code in Toolbox::DecodeDataUriScheme
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1976
diff
changeset
|
1502 if (!Toolbox::DecodeDataUriScheme(mime, binary, utf8Value)) |
4b545a8b1f95
return code in Toolbox::DecodeDataUriScheme
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1976
diff
changeset
|
1503 { |
4b545a8b1f95
return code in Toolbox::DecodeDataUriScheme
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1976
diff
changeset
|
1504 throw OrthancException(ErrorCode_BadFileFormat); |
4b545a8b1f95
return code in Toolbox::DecodeDataUriScheme
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1976
diff
changeset
|
1505 } |
4b545a8b1f95
return code in Toolbox::DecodeDataUriScheme
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1976
diff
changeset
|
1506 |
1695 | 1507 decoded = &binary; |
1508 } | |
1509 else if (dicomEncoding != Encoding_Utf8) | |
1510 { | |
1511 binary = Toolbox::ConvertFromUtf8(utf8Value, dicomEncoding); | |
1689 | 1512 decoded = &binary; |
1513 } | |
1514 | |
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
|
1515 if (IsBinaryTag(element.getTag())) |
1689 | 1516 { |
3199
9316f341e40f
unit testing json for dicomweb
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3198
diff
changeset
|
1517 bool ok; |
9316f341e40f
unit testing json for dicomweb
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3198
diff
changeset
|
1518 |
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
|
1519 switch (element.getTag().getEVR()) |
3199
9316f341e40f
unit testing json for dicomweb
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3198
diff
changeset
|
1520 { |
9316f341e40f
unit testing json for dicomweb
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3198
diff
changeset
|
1521 case EVR_OW: |
9316f341e40f
unit testing json for dicomweb
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3198
diff
changeset
|
1522 if (decoded->size() % sizeof(Uint16) != 0) |
9316f341e40f
unit testing json for dicomweb
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3198
diff
changeset
|
1523 { |
9316f341e40f
unit testing json for dicomweb
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3198
diff
changeset
|
1524 LOG(ERROR) << "A tag with OW VR must have an even number of bytes"; |
9316f341e40f
unit testing json for dicomweb
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3198
diff
changeset
|
1525 ok = false; |
9316f341e40f
unit testing json for dicomweb
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3198
diff
changeset
|
1526 } |
9316f341e40f
unit testing json for dicomweb
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3198
diff
changeset
|
1527 else |
9316f341e40f
unit testing json for dicomweb
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3198
diff
changeset
|
1528 { |
9316f341e40f
unit testing json for dicomweb
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3198
diff
changeset
|
1529 ok = element.putUint16Array((const Uint16*) decoded->c_str(), decoded->size() / sizeof(Uint16)).good(); |
9316f341e40f
unit testing json for dicomweb
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3198
diff
changeset
|
1530 } |
9316f341e40f
unit testing json for dicomweb
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3198
diff
changeset
|
1531 |
9316f341e40f
unit testing json for dicomweb
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3198
diff
changeset
|
1532 break; |
9316f341e40f
unit testing json for dicomweb
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3198
diff
changeset
|
1533 |
9316f341e40f
unit testing json for dicomweb
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3198
diff
changeset
|
1534 default: |
9316f341e40f
unit testing json for dicomweb
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3198
diff
changeset
|
1535 ok = element.putUint8Array((const Uint8*) decoded->c_str(), decoded->size()).good(); |
9316f341e40f
unit testing json for dicomweb
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3198
diff
changeset
|
1536 break; |
9316f341e40f
unit testing json for dicomweb
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3198
diff
changeset
|
1537 } |
9316f341e40f
unit testing json for dicomweb
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3198
diff
changeset
|
1538 |
9316f341e40f
unit testing json for dicomweb
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3198
diff
changeset
|
1539 if (ok) |
1689 | 1540 { |
1541 return; | |
1542 } | |
1543 else | |
1544 { | |
1545 throw OrthancException(ErrorCode_InternalError); | |
1546 } | |
1547 } | |
1548 | |
1549 bool ok = false; | |
1550 | |
1551 try | |
1552 { | |
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
|
1553 switch (element.getTag().getEVR()) |
1689 | 1554 { |
1555 // http://support.dcmtk.org/docs/dcvr_8h-source.html | |
1556 | |
1557 /** | |
1558 * TODO. | |
1559 **/ | |
1560 | |
1561 case EVR_OB: // other byte | |
1562 case EVR_OW: // other word | |
1563 case EVR_AT: // attribute tag | |
1564 throw OrthancException(ErrorCode_NotImplemented); | |
1565 | |
1566 case EVR_UN: // unknown value representation | |
1567 throw OrthancException(ErrorCode_ParameterOutOfRange); | |
1568 | |
1569 | |
1570 /** | |
1571 * String types. | |
1572 **/ | |
1573 | |
1574 case EVR_DS: // decimal string | |
1575 case EVR_IS: // integer string | |
1576 case EVR_AS: // age string | |
1577 case EVR_DA: // date string | |
1578 case EVR_DT: // date time string | |
1579 case EVR_TM: // time string | |
1580 case EVR_AE: // application entity title | |
1581 case EVR_CS: // code string | |
1582 case EVR_SH: // short string | |
1583 case EVR_LO: // long string | |
1584 case EVR_ST: // short text | |
1585 case EVR_LT: // long text | |
1586 case EVR_UT: // unlimited text | |
1587 case EVR_PN: // person name | |
1588 case EVR_UI: // unique identifier | |
3209
f6374c36a671
documentation of DICOMweb in SDK, compatibility with DCMTK 3.6.0
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3199
diff
changeset
|
1589 #if DCMTK_VERSION_NUMBER >= 361 |
3199
9316f341e40f
unit testing json for dicomweb
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3198
diff
changeset
|
1590 case EVR_UC: // unlimited characters |
9316f341e40f
unit testing json for dicomweb
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3198
diff
changeset
|
1591 case EVR_UR: // URI/URL |
3209
f6374c36a671
documentation of DICOMweb in SDK, compatibility with DCMTK 3.6.0
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3199
diff
changeset
|
1592 #endif |
1689 | 1593 { |
1594 ok = element.putString(decoded->c_str()).good(); | |
1595 break; | |
1596 } | |
1597 | |
1598 | |
1599 /** | |
1600 * Numerical types | |
1601 **/ | |
1602 | |
1603 case EVR_SL: // signed long | |
1604 { | |
1605 ok = element.putSint32(boost::lexical_cast<Sint32>(*decoded)).good(); | |
1606 break; | |
1607 } | |
1608 | |
1609 case EVR_SS: // signed short | |
1610 { | |
1611 ok = element.putSint16(boost::lexical_cast<Sint16>(*decoded)).good(); | |
1612 break; | |
1613 } | |
1614 | |
1615 case EVR_UL: // unsigned long | |
3692
fd302ec6a502
fix for ubuntu 16.04
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3691
diff
changeset
|
1616 #if DCMTK_VERSION_NUMBER >= 362 |
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
|
1617 case EVR_OL: // other long (requires byte-swapping) |
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
|
1618 #endif |
1689 | 1619 { |
1620 ok = element.putUint32(boost::lexical_cast<Uint32>(*decoded)).good(); | |
1621 break; | |
1622 } | |
1623 | |
1624 case EVR_US: // unsigned short | |
1625 { | |
1626 ok = element.putUint16(boost::lexical_cast<Uint16>(*decoded)).good(); | |
1627 break; | |
1628 } | |
1629 | |
1630 case EVR_FL: // float single-precision | |
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
|
1631 case EVR_OF: // other float (requires byte swapping) |
1689 | 1632 { |
1633 ok = element.putFloat32(boost::lexical_cast<float>(*decoded)).good(); | |
1634 break; | |
1635 } | |
1636 | |
1637 case EVR_FD: // float double-precision | |
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
|
1638 #if DCMTK_VERSION_NUMBER >= 361 |
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
|
1639 case EVR_OD: // other double (requires byte-swapping) |
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
|
1640 #endif |
1689 | 1641 { |
1642 ok = element.putFloat64(boost::lexical_cast<double>(*decoded)).good(); | |
1643 break; | |
1644 } | |
1645 | |
1646 | |
1647 /** | |
1648 * Sequence types, should never occur at this point. | |
1649 **/ | |
1650 | |
1651 case EVR_SQ: // sequence of items | |
1652 { | |
1653 ok = false; | |
1654 break; | |
1655 } | |
1656 | |
1657 | |
1658 /** | |
1659 * Internal to DCMTK. | |
1660 **/ | |
1661 | |
1662 case EVR_ox: // OB or OW depending on context | |
1663 case EVR_xs: // SS or US depending on context | |
1664 case EVR_lt: // US, SS or OW depending on context, used for LUT Data (thus the name) | |
1665 case EVR_na: // na="not applicable", for data which has no VR | |
1666 case EVR_up: // up="unsigned pointer", used internally for DICOMDIR suppor | |
1667 case EVR_item: // used internally for items | |
1668 case EVR_metainfo: // used internally for meta info datasets | |
1669 case EVR_dataset: // used internally for datasets | |
1670 case EVR_fileFormat: // used internally for DICOM files | |
1671 case EVR_dicomDir: // used internally for DICOMDIR objects | |
1672 case EVR_dirRecord: // used internally for DICOMDIR records | |
1673 case EVR_pixelSQ: // used internally for pixel sequences in a compressed image | |
1674 case EVR_pixelItem: // used internally for pixel items in a compressed image | |
1675 case EVR_UNKNOWN: // used internally for elements with unknown VR (encoded with 4-byte length field in explicit VR) | |
1676 case EVR_PixelData: // used internally for uncompressed pixeld data | |
1677 case EVR_OverlayData: // used internally for overlay data | |
1678 case EVR_UNKNOWN2B: // used internally for elements with unknown VR with 2-byte length field in explicit VR | |
1679 default: | |
1680 break; | |
1681 } | |
1682 } | |
1683 catch (boost::bad_lexical_cast&) | |
1684 { | |
1685 ok = false; | |
1686 } | |
1687 | |
1688 if (!ok) | |
1689 { | |
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
|
1690 DicomTag tag(element.getTag().getGroup(), element.getTag().getElement()); |
2954
d924f9bb61cc
taking advantage of details in OrthancException
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2905
diff
changeset
|
1691 throw OrthancException(ErrorCode_BadFileFormat, |
d924f9bb61cc
taking advantage of details in OrthancException
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2905
diff
changeset
|
1692 "While creating a DICOM instance, tag (" + tag.Format() + |
d924f9bb61cc
taking advantage of details in OrthancException
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2905
diff
changeset
|
1693 ") has out-of-range value: \"" + (*decoded) + "\""); |
1689 | 1694 } |
1695 } | |
1696 | |
1697 | |
1693
558b25228a23
creation of tag hierarchy from json
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1691
diff
changeset
|
1698 DcmElement* FromDcmtkBridge::FromJson(const DicomTag& tag, |
558b25228a23
creation of tag hierarchy from json
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1691
diff
changeset
|
1699 const Json::Value& value, |
1818
1065401501fb
ParsedDicomFile::CreateFromJson
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1792
diff
changeset
|
1700 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
|
1701 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
|
1702 const std::string& privateCreator) |
1689 | 1703 { |
3712
2a170a8f1faf
replacing std::auto_ptr by std::unique_ptr
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3708
diff
changeset
|
1704 std::unique_ptr<DcmElement> element; |
1689 | 1705 |
1690 | 1706 switch (value.type()) |
1689 | 1707 { |
1690 | 1708 case Json::stringValue: |
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
|
1709 element.reset(CreateElementForTag(tag, privateCreator)); |
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
|
1710 FillElementWithString(*element, value.asString(), decodeDataUriScheme, dicomEncoding); |
1690 | 1711 break; |
1712 | |
2216
9a8fab016145
sample worklist plugin fine-tuning the C-Find query
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2209
diff
changeset
|
1713 case Json::nullValue: |
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
|
1714 element.reset(CreateElementForTag(tag, privateCreator)); |
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
|
1715 FillElementWithString(*element, "", decodeDataUriScheme, dicomEncoding); |
2216
9a8fab016145
sample worklist plugin fine-tuning the C-Find query
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2209
diff
changeset
|
1716 break; |
9a8fab016145
sample worklist plugin fine-tuning the C-Find query
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2209
diff
changeset
|
1717 |
1690 | 1718 case Json::arrayValue: |
1719 { | |
4007
884b55ce01f6
Private tags returned by C-FIND SCP
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3922
diff
changeset
|
1720 const char* p = NULL; |
4016
c675d77b82ab
fix creation of sequence in private tag
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4007
diff
changeset
|
1721 if (tag.IsPrivate() && |
c675d77b82ab
fix creation of sequence in private tag
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4007
diff
changeset
|
1722 !privateCreator.empty()) |
4007
884b55ce01f6
Private tags returned by C-FIND SCP
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3922
diff
changeset
|
1723 { |
884b55ce01f6
Private tags returned by C-FIND SCP
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3922
diff
changeset
|
1724 p = privateCreator.c_str(); |
884b55ce01f6
Private tags returned by C-FIND SCP
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3922
diff
changeset
|
1725 } |
884b55ce01f6
Private tags returned by C-FIND SCP
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3922
diff
changeset
|
1726 |
884b55ce01f6
Private tags returned by C-FIND SCP
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3922
diff
changeset
|
1727 DcmTag key(tag.GetGroup(), tag.GetElement(), p); |
1690 | 1728 if (key.getEVR() != EVR_SQ) |
1729 { | |
4007
884b55ce01f6
Private tags returned by C-FIND SCP
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3922
diff
changeset
|
1730 throw OrthancException(ErrorCode_BadParameterType, |
884b55ce01f6
Private tags returned by C-FIND SCP
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3922
diff
changeset
|
1731 "Bad Parameter type for tag " + tag.Format()); |
1690 | 1732 } |
1733 | |
2287
9f3414878c02
Fix Debian #865606 (orthanc FTBFS with libdcmtk-dev 3.6.1~20170228-2)
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2275
diff
changeset
|
1734 DcmSequenceOfItems* sequence = new DcmSequenceOfItems(key); |
1690 | 1735 element.reset(sequence); |
1736 | |
1737 for (Json::Value::ArrayIndex i = 0; i < value.size(); i++) | |
1738 { | |
3712
2a170a8f1faf
replacing std::auto_ptr by std::unique_ptr
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3708
diff
changeset
|
1739 std::unique_ptr<DcmItem> item(new DcmItem); |
1690 | 1740 |
2830 | 1741 switch (value[i].type()) |
1690 | 1742 { |
2830 | 1743 case Json::objectValue: |
1744 { | |
1745 Json::Value::Members members = value[i].getMemberNames(); | |
1746 for (Json::Value::ArrayIndex j = 0; j < members.size(); j++) | |
1747 { | |
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
|
1748 item->insert(FromJson(ParseTag(members[j]), value[i][members[j]], decodeDataUriScheme, dicomEncoding, privateCreator)); |
2830 | 1749 } |
2831 | 1750 break; |
2830 | 1751 } |
1752 | |
1753 case Json::arrayValue: | |
2831 | 1754 { |
2830 | 1755 // Lua cannot disambiguate between an empty dictionary |
1756 // and an empty array | |
1757 if (value[i].size() != 0) | |
1758 { | |
1759 throw OrthancException(ErrorCode_BadParameterType); | |
1760 } | |
1761 break; | |
2831 | 1762 } |
2830 | 1763 |
1764 default: | |
1765 throw OrthancException(ErrorCode_BadParameterType); | |
1690 | 1766 } |
1767 | |
1768 sequence->append(item.release()); | |
1769 } | |
1770 | |
1771 break; | |
1772 } | |
1773 | |
1774 default: | |
3895 | 1775 throw OrthancException(ErrorCode_BadParameterType, "Bad Parameter type for tag " + tag.Format()); |
1689 | 1776 } |
1777 | |
1778 return element.release(); | |
1779 } | |
1765
57b9e6890482
New configuration option: "Dictionary" to declare custom DICOM tags
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1739
diff
changeset
|
1780 |
57b9e6890482
New configuration option: "Dictionary" to declare custom DICOM tags
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1739
diff
changeset
|
1781 |
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
|
1782 DcmPixelSequence* FromDcmtkBridge::GetPixelSequence(DcmDataset& dataset) |
6c73df12ca51
New URI: "/instances/.../frames/.../raw" to access the raw frames (bypass image decoding)
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1900
diff
changeset
|
1783 { |
6c73df12ca51
New URI: "/instances/.../frames/.../raw" to access the raw frames (bypass image decoding)
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1900
diff
changeset
|
1784 DcmElement *element = NULL; |
1927
b60f27664b8f
simplification in FromDcmtkBridge
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1924
diff
changeset
|
1785 if (!dataset.findAndGetElement(DCM_PixelData, element).good()) |
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
|
1786 { |
6c73df12ca51
New URI: "/instances/.../frames/.../raw" to access the raw frames (bypass image decoding)
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1900
diff
changeset
|
1787 throw OrthancException(ErrorCode_BadFileFormat); |
6c73df12ca51
New URI: "/instances/.../frames/.../raw" to access the raw frames (bypass image decoding)
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1900
diff
changeset
|
1788 } |
6c73df12ca51
New URI: "/instances/.../frames/.../raw" to access the raw frames (bypass image decoding)
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1900
diff
changeset
|
1789 |
6c73df12ca51
New URI: "/instances/.../frames/.../raw" to access the raw frames (bypass image decoding)
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1900
diff
changeset
|
1790 DcmPixelData& pixelData = dynamic_cast<DcmPixelData&>(*element); |
3922
74eeadf5d51d
fix access to compressed frames after transcoding
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3896
diff
changeset
|
1791 |
74eeadf5d51d
fix access to compressed frames after transcoding
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3896
diff
changeset
|
1792 E_TransferSyntax repType; |
74eeadf5d51d
fix access to compressed frames after transcoding
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3896
diff
changeset
|
1793 const DcmRepresentationParameter *repParam = NULL; |
74eeadf5d51d
fix access to compressed frames after transcoding
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3896
diff
changeset
|
1794 pixelData.getCurrentRepresentationKey(repType, repParam); |
74eeadf5d51d
fix access to compressed frames after transcoding
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3896
diff
changeset
|
1795 |
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
|
1796 DcmPixelSequence* pixelSequence = NULL; |
3922
74eeadf5d51d
fix access to compressed frames after transcoding
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3896
diff
changeset
|
1797 if (!pixelData.getEncapsulatedRepresentation(repType, repParam, pixelSequence).good()) |
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
|
1798 { |
6c73df12ca51
New URI: "/instances/.../frames/.../raw" to access the raw frames (bypass image decoding)
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1900
diff
changeset
|
1799 return NULL; |
6c73df12ca51
New URI: "/instances/.../frames/.../raw" to access the raw frames (bypass image decoding)
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1900
diff
changeset
|
1800 } |
6c73df12ca51
New URI: "/instances/.../frames/.../raw" to access the raw frames (bypass image decoding)
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1900
diff
changeset
|
1801 else |
6c73df12ca51
New URI: "/instances/.../frames/.../raw" to access the raw frames (bypass image decoding)
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1900
diff
changeset
|
1802 { |
6c73df12ca51
New URI: "/instances/.../frames/.../raw" to access the raw frames (bypass image decoding)
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1900
diff
changeset
|
1803 return pixelSequence; |
6c73df12ca51
New URI: "/instances/.../frames/.../raw" to access the raw frames (bypass image decoding)
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1900
diff
changeset
|
1804 } |
6c73df12ca51
New URI: "/instances/.../frames/.../raw" to access the raw frames (bypass image decoding)
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1900
diff
changeset
|
1805 } |
1934
72a2fd7fed8b
FromDcmtkBridge::FromJson
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1930
diff
changeset
|
1806 |
72a2fd7fed8b
FromDcmtkBridge::FromJson
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1930
diff
changeset
|
1807 |
72a2fd7fed8b
FromDcmtkBridge::FromJson
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1930
diff
changeset
|
1808 Encoding FromDcmtkBridge::ExtractEncoding(const Json::Value& json, |
72a2fd7fed8b
FromDcmtkBridge::FromJson
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1930
diff
changeset
|
1809 Encoding defaultEncoding) |
72a2fd7fed8b
FromDcmtkBridge::FromJson
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1930
diff
changeset
|
1810 { |
72a2fd7fed8b
FromDcmtkBridge::FromJson
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1930
diff
changeset
|
1811 if (json.type() != Json::objectValue) |
72a2fd7fed8b
FromDcmtkBridge::FromJson
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1930
diff
changeset
|
1812 { |
72a2fd7fed8b
FromDcmtkBridge::FromJson
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1930
diff
changeset
|
1813 throw OrthancException(ErrorCode_BadParameterType); |
72a2fd7fed8b
FromDcmtkBridge::FromJson
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1930
diff
changeset
|
1814 } |
72a2fd7fed8b
FromDcmtkBridge::FromJson
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1930
diff
changeset
|
1815 |
72a2fd7fed8b
FromDcmtkBridge::FromJson
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1930
diff
changeset
|
1816 Encoding encoding = defaultEncoding; |
72a2fd7fed8b
FromDcmtkBridge::FromJson
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1930
diff
changeset
|
1817 |
72a2fd7fed8b
FromDcmtkBridge::FromJson
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1930
diff
changeset
|
1818 const Json::Value::Members tags = json.getMemberNames(); |
72a2fd7fed8b
FromDcmtkBridge::FromJson
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1930
diff
changeset
|
1819 |
72a2fd7fed8b
FromDcmtkBridge::FromJson
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1930
diff
changeset
|
1820 // Look for SpecificCharacterSet (0008,0005) in the JSON file |
72a2fd7fed8b
FromDcmtkBridge::FromJson
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1930
diff
changeset
|
1821 for (size_t i = 0; i < tags.size(); i++) |
72a2fd7fed8b
FromDcmtkBridge::FromJson
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1930
diff
changeset
|
1822 { |
72a2fd7fed8b
FromDcmtkBridge::FromJson
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1930
diff
changeset
|
1823 DicomTag tag = FromDcmtkBridge::ParseTag(tags[i]); |
72a2fd7fed8b
FromDcmtkBridge::FromJson
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1930
diff
changeset
|
1824 if (tag == DICOM_TAG_SPECIFIC_CHARACTER_SET) |
72a2fd7fed8b
FromDcmtkBridge::FromJson
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1930
diff
changeset
|
1825 { |
72a2fd7fed8b
FromDcmtkBridge::FromJson
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1930
diff
changeset
|
1826 const Json::Value& value = json[tags[i]]; |
72a2fd7fed8b
FromDcmtkBridge::FromJson
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1930
diff
changeset
|
1827 if (value.type() != Json::stringValue || |
2216
9a8fab016145
sample worklist plugin fine-tuning the C-Find query
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2209
diff
changeset
|
1828 (value.asString().length() != 0 && |
9a8fab016145
sample worklist plugin fine-tuning the C-Find query
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2209
diff
changeset
|
1829 !GetDicomEncoding(encoding, value.asCString()))) |
1934
72a2fd7fed8b
FromDcmtkBridge::FromJson
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1930
diff
changeset
|
1830 { |
2954
d924f9bb61cc
taking advantage of details in OrthancException
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2905
diff
changeset
|
1831 throw OrthancException(ErrorCode_BadRequest, |
d924f9bb61cc
taking advantage of details in OrthancException
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2905
diff
changeset
|
1832 "Unknown encoding while creating DICOM from JSON: " + |
d924f9bb61cc
taking advantage of details in OrthancException
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2905
diff
changeset
|
1833 value.toStyledString()); |
1934
72a2fd7fed8b
FromDcmtkBridge::FromJson
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1930
diff
changeset
|
1834 } |
2216
9a8fab016145
sample worklist plugin fine-tuning the C-Find query
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2209
diff
changeset
|
1835 |
9a8fab016145
sample worklist plugin fine-tuning the C-Find query
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2209
diff
changeset
|
1836 if (value.asString().length() == 0) |
9a8fab016145
sample worklist plugin fine-tuning the C-Find query
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2209
diff
changeset
|
1837 { |
9a8fab016145
sample worklist plugin fine-tuning the C-Find query
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2209
diff
changeset
|
1838 return defaultEncoding; |
9a8fab016145
sample worklist plugin fine-tuning the C-Find query
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2209
diff
changeset
|
1839 } |
1934
72a2fd7fed8b
FromDcmtkBridge::FromJson
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1930
diff
changeset
|
1840 } |
72a2fd7fed8b
FromDcmtkBridge::FromJson
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1930
diff
changeset
|
1841 } |
72a2fd7fed8b
FromDcmtkBridge::FromJson
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1930
diff
changeset
|
1842 |
72a2fd7fed8b
FromDcmtkBridge::FromJson
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1930
diff
changeset
|
1843 return encoding; |
72a2fd7fed8b
FromDcmtkBridge::FromJson
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1930
diff
changeset
|
1844 } |
72a2fd7fed8b
FromDcmtkBridge::FromJson
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1930
diff
changeset
|
1845 |
72a2fd7fed8b
FromDcmtkBridge::FromJson
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1930
diff
changeset
|
1846 |
72a2fd7fed8b
FromDcmtkBridge::FromJson
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1930
diff
changeset
|
1847 static void SetString(DcmDataset& target, |
72a2fd7fed8b
FromDcmtkBridge::FromJson
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1930
diff
changeset
|
1848 const DcmTag& tag, |
72a2fd7fed8b
FromDcmtkBridge::FromJson
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1930
diff
changeset
|
1849 const std::string& value) |
72a2fd7fed8b
FromDcmtkBridge::FromJson
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1930
diff
changeset
|
1850 { |
72a2fd7fed8b
FromDcmtkBridge::FromJson
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1930
diff
changeset
|
1851 if (!target.putAndInsertString(tag, value.c_str()).good()) |
72a2fd7fed8b
FromDcmtkBridge::FromJson
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1930
diff
changeset
|
1852 { |
72a2fd7fed8b
FromDcmtkBridge::FromJson
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1930
diff
changeset
|
1853 throw OrthancException(ErrorCode_InternalError); |
72a2fd7fed8b
FromDcmtkBridge::FromJson
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1930
diff
changeset
|
1854 } |
72a2fd7fed8b
FromDcmtkBridge::FromJson
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1930
diff
changeset
|
1855 } |
72a2fd7fed8b
FromDcmtkBridge::FromJson
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1930
diff
changeset
|
1856 |
72a2fd7fed8b
FromDcmtkBridge::FromJson
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1930
diff
changeset
|
1857 |
72a2fd7fed8b
FromDcmtkBridge::FromJson
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1930
diff
changeset
|
1858 DcmDataset* FromDcmtkBridge::FromJson(const Json::Value& json, // Encoded using UTF-8 |
72a2fd7fed8b
FromDcmtkBridge::FromJson
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1930
diff
changeset
|
1859 bool generateIdentifiers, |
72a2fd7fed8b
FromDcmtkBridge::FromJson
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1930
diff
changeset
|
1860 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
|
1861 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
|
1862 const std::string& privateCreator) |
1934
72a2fd7fed8b
FromDcmtkBridge::FromJson
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1930
diff
changeset
|
1863 { |
3712
2a170a8f1faf
replacing std::auto_ptr by std::unique_ptr
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3708
diff
changeset
|
1864 std::unique_ptr<DcmDataset> result(new DcmDataset); |
1934
72a2fd7fed8b
FromDcmtkBridge::FromJson
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1930
diff
changeset
|
1865 Encoding encoding = ExtractEncoding(json, defaultEncoding); |
72a2fd7fed8b
FromDcmtkBridge::FromJson
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1930
diff
changeset
|
1866 |
72a2fd7fed8b
FromDcmtkBridge::FromJson
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1930
diff
changeset
|
1867 SetString(*result, DCM_SpecificCharacterSet, GetDicomSpecificCharacterSet(encoding)); |
72a2fd7fed8b
FromDcmtkBridge::FromJson
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1930
diff
changeset
|
1868 |
72a2fd7fed8b
FromDcmtkBridge::FromJson
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1930
diff
changeset
|
1869 const Json::Value::Members tags = json.getMemberNames(); |
72a2fd7fed8b
FromDcmtkBridge::FromJson
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1930
diff
changeset
|
1870 |
72a2fd7fed8b
FromDcmtkBridge::FromJson
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1930
diff
changeset
|
1871 bool hasPatientId = false; |
72a2fd7fed8b
FromDcmtkBridge::FromJson
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1930
diff
changeset
|
1872 bool hasStudyInstanceUid = false; |
72a2fd7fed8b
FromDcmtkBridge::FromJson
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1930
diff
changeset
|
1873 bool hasSeriesInstanceUid = false; |
72a2fd7fed8b
FromDcmtkBridge::FromJson
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1930
diff
changeset
|
1874 bool hasSopInstanceUid = false; |
72a2fd7fed8b
FromDcmtkBridge::FromJson
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1930
diff
changeset
|
1875 |
72a2fd7fed8b
FromDcmtkBridge::FromJson
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1930
diff
changeset
|
1876 for (size_t i = 0; i < tags.size(); i++) |
72a2fd7fed8b
FromDcmtkBridge::FromJson
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1930
diff
changeset
|
1877 { |
72a2fd7fed8b
FromDcmtkBridge::FromJson
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1930
diff
changeset
|
1878 DicomTag tag = FromDcmtkBridge::ParseTag(tags[i]); |
72a2fd7fed8b
FromDcmtkBridge::FromJson
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1930
diff
changeset
|
1879 const Json::Value& value = json[tags[i]]; |
72a2fd7fed8b
FromDcmtkBridge::FromJson
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1930
diff
changeset
|
1880 |
72a2fd7fed8b
FromDcmtkBridge::FromJson
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1930
diff
changeset
|
1881 if (tag == DICOM_TAG_PATIENT_ID) |
72a2fd7fed8b
FromDcmtkBridge::FromJson
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1930
diff
changeset
|
1882 { |
72a2fd7fed8b
FromDcmtkBridge::FromJson
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1930
diff
changeset
|
1883 hasPatientId = true; |
72a2fd7fed8b
FromDcmtkBridge::FromJson
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1930
diff
changeset
|
1884 } |
72a2fd7fed8b
FromDcmtkBridge::FromJson
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1930
diff
changeset
|
1885 else if (tag == DICOM_TAG_STUDY_INSTANCE_UID) |
72a2fd7fed8b
FromDcmtkBridge::FromJson
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1930
diff
changeset
|
1886 { |
72a2fd7fed8b
FromDcmtkBridge::FromJson
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1930
diff
changeset
|
1887 hasStudyInstanceUid = true; |
72a2fd7fed8b
FromDcmtkBridge::FromJson
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1930
diff
changeset
|
1888 } |
72a2fd7fed8b
FromDcmtkBridge::FromJson
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1930
diff
changeset
|
1889 else if (tag == DICOM_TAG_SERIES_INSTANCE_UID) |
72a2fd7fed8b
FromDcmtkBridge::FromJson
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1930
diff
changeset
|
1890 { |
72a2fd7fed8b
FromDcmtkBridge::FromJson
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1930
diff
changeset
|
1891 hasSeriesInstanceUid = true; |
72a2fd7fed8b
FromDcmtkBridge::FromJson
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1930
diff
changeset
|
1892 } |
72a2fd7fed8b
FromDcmtkBridge::FromJson
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1930
diff
changeset
|
1893 else if (tag == DICOM_TAG_SOP_INSTANCE_UID) |
72a2fd7fed8b
FromDcmtkBridge::FromJson
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1930
diff
changeset
|
1894 { |
72a2fd7fed8b
FromDcmtkBridge::FromJson
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1930
diff
changeset
|
1895 hasSopInstanceUid = true; |
72a2fd7fed8b
FromDcmtkBridge::FromJson
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1930
diff
changeset
|
1896 } |
72a2fd7fed8b
FromDcmtkBridge::FromJson
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1930
diff
changeset
|
1897 |
72a2fd7fed8b
FromDcmtkBridge::FromJson
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1930
diff
changeset
|
1898 if (tag != DICOM_TAG_SPECIFIC_CHARACTER_SET) |
72a2fd7fed8b
FromDcmtkBridge::FromJson
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1930
diff
changeset
|
1899 { |
3712
2a170a8f1faf
replacing std::auto_ptr by std::unique_ptr
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3708
diff
changeset
|
1900 std::unique_ptr<DcmElement> element(FromDcmtkBridge::FromJson(tag, value, decodeDataUriScheme, encoding, privateCreator)); |
1934
72a2fd7fed8b
FromDcmtkBridge::FromJson
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1930
diff
changeset
|
1901 const DcmTagKey& tag = element->getTag(); |
72a2fd7fed8b
FromDcmtkBridge::FromJson
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1930
diff
changeset
|
1902 |
72a2fd7fed8b
FromDcmtkBridge::FromJson
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1930
diff
changeset
|
1903 result->findAndDeleteElement(tag); |
72a2fd7fed8b
FromDcmtkBridge::FromJson
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1930
diff
changeset
|
1904 |
72a2fd7fed8b
FromDcmtkBridge::FromJson
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1930
diff
changeset
|
1905 DcmElement* tmp = element.release(); |
72a2fd7fed8b
FromDcmtkBridge::FromJson
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1930
diff
changeset
|
1906 if (!result->insert(tmp, false, false).good()) |
72a2fd7fed8b
FromDcmtkBridge::FromJson
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1930
diff
changeset
|
1907 { |
72a2fd7fed8b
FromDcmtkBridge::FromJson
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1930
diff
changeset
|
1908 delete tmp; |
72a2fd7fed8b
FromDcmtkBridge::FromJson
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1930
diff
changeset
|
1909 throw OrthancException(ErrorCode_InternalError); |
72a2fd7fed8b
FromDcmtkBridge::FromJson
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1930
diff
changeset
|
1910 } |
72a2fd7fed8b
FromDcmtkBridge::FromJson
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1930
diff
changeset
|
1911 } |
72a2fd7fed8b
FromDcmtkBridge::FromJson
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1930
diff
changeset
|
1912 } |
72a2fd7fed8b
FromDcmtkBridge::FromJson
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1930
diff
changeset
|
1913 |
72a2fd7fed8b
FromDcmtkBridge::FromJson
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1930
diff
changeset
|
1914 if (!hasPatientId && |
72a2fd7fed8b
FromDcmtkBridge::FromJson
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1930
diff
changeset
|
1915 generateIdentifiers) |
72a2fd7fed8b
FromDcmtkBridge::FromJson
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1930
diff
changeset
|
1916 { |
72a2fd7fed8b
FromDcmtkBridge::FromJson
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1930
diff
changeset
|
1917 SetString(*result, DCM_PatientID, GenerateUniqueIdentifier(ResourceType_Patient)); |
72a2fd7fed8b
FromDcmtkBridge::FromJson
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1930
diff
changeset
|
1918 } |
72a2fd7fed8b
FromDcmtkBridge::FromJson
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1930
diff
changeset
|
1919 |
72a2fd7fed8b
FromDcmtkBridge::FromJson
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1930
diff
changeset
|
1920 if (!hasStudyInstanceUid && |
72a2fd7fed8b
FromDcmtkBridge::FromJson
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1930
diff
changeset
|
1921 generateIdentifiers) |
72a2fd7fed8b
FromDcmtkBridge::FromJson
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1930
diff
changeset
|
1922 { |
72a2fd7fed8b
FromDcmtkBridge::FromJson
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1930
diff
changeset
|
1923 SetString(*result, DCM_StudyInstanceUID, GenerateUniqueIdentifier(ResourceType_Study)); |
72a2fd7fed8b
FromDcmtkBridge::FromJson
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1930
diff
changeset
|
1924 } |
72a2fd7fed8b
FromDcmtkBridge::FromJson
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1930
diff
changeset
|
1925 |
72a2fd7fed8b
FromDcmtkBridge::FromJson
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1930
diff
changeset
|
1926 if (!hasSeriesInstanceUid && |
72a2fd7fed8b
FromDcmtkBridge::FromJson
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1930
diff
changeset
|
1927 generateIdentifiers) |
72a2fd7fed8b
FromDcmtkBridge::FromJson
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1930
diff
changeset
|
1928 { |
72a2fd7fed8b
FromDcmtkBridge::FromJson
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1930
diff
changeset
|
1929 SetString(*result, DCM_SeriesInstanceUID, GenerateUniqueIdentifier(ResourceType_Series)); |
72a2fd7fed8b
FromDcmtkBridge::FromJson
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1930
diff
changeset
|
1930 } |
72a2fd7fed8b
FromDcmtkBridge::FromJson
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1930
diff
changeset
|
1931 |
72a2fd7fed8b
FromDcmtkBridge::FromJson
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1930
diff
changeset
|
1932 if (!hasSopInstanceUid && |
72a2fd7fed8b
FromDcmtkBridge::FromJson
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1930
diff
changeset
|
1933 generateIdentifiers) |
72a2fd7fed8b
FromDcmtkBridge::FromJson
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1930
diff
changeset
|
1934 { |
72a2fd7fed8b
FromDcmtkBridge::FromJson
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1930
diff
changeset
|
1935 SetString(*result, DCM_SOPInstanceUID, GenerateUniqueIdentifier(ResourceType_Instance)); |
72a2fd7fed8b
FromDcmtkBridge::FromJson
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1930
diff
changeset
|
1936 } |
72a2fd7fed8b
FromDcmtkBridge::FromJson
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1930
diff
changeset
|
1937 |
72a2fd7fed8b
FromDcmtkBridge::FromJson
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1930
diff
changeset
|
1938 return result.release(); |
72a2fd7fed8b
FromDcmtkBridge::FromJson
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1930
diff
changeset
|
1939 } |
1935
e251606c1433
FromDcmtkBridge::LoadFromMemoryBuffer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1934
diff
changeset
|
1940 |
e251606c1433
FromDcmtkBridge::LoadFromMemoryBuffer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1934
diff
changeset
|
1941 |
e251606c1433
FromDcmtkBridge::LoadFromMemoryBuffer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1934
diff
changeset
|
1942 DcmFileFormat* FromDcmtkBridge::LoadFromMemoryBuffer(const void* buffer, |
e251606c1433
FromDcmtkBridge::LoadFromMemoryBuffer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1934
diff
changeset
|
1943 size_t size) |
e251606c1433
FromDcmtkBridge::LoadFromMemoryBuffer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1934
diff
changeset
|
1944 { |
e251606c1433
FromDcmtkBridge::LoadFromMemoryBuffer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1934
diff
changeset
|
1945 DcmInputBufferStream is; |
e251606c1433
FromDcmtkBridge::LoadFromMemoryBuffer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1934
diff
changeset
|
1946 if (size > 0) |
e251606c1433
FromDcmtkBridge::LoadFromMemoryBuffer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1934
diff
changeset
|
1947 { |
e251606c1433
FromDcmtkBridge::LoadFromMemoryBuffer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1934
diff
changeset
|
1948 is.setBuffer(buffer, size); |
e251606c1433
FromDcmtkBridge::LoadFromMemoryBuffer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1934
diff
changeset
|
1949 } |
e251606c1433
FromDcmtkBridge::LoadFromMemoryBuffer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1934
diff
changeset
|
1950 is.setEos(); |
e251606c1433
FromDcmtkBridge::LoadFromMemoryBuffer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1934
diff
changeset
|
1951 |
3712
2a170a8f1faf
replacing std::auto_ptr by std::unique_ptr
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3708
diff
changeset
|
1952 std::unique_ptr<DcmFileFormat> result(new DcmFileFormat); |
1935
e251606c1433
FromDcmtkBridge::LoadFromMemoryBuffer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1934
diff
changeset
|
1953 |
e251606c1433
FromDcmtkBridge::LoadFromMemoryBuffer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1934
diff
changeset
|
1954 result->transferInit(); |
3771
74889e6f6d68
fix memory issues if parsing invalid DICOM file
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3769
diff
changeset
|
1955 |
74889e6f6d68
fix memory issues if parsing invalid DICOM file
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3769
diff
changeset
|
1956 /** |
74889e6f6d68
fix memory issues if parsing invalid DICOM file
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3769
diff
changeset
|
1957 * New in Orthanc 1.6.0: The "size" is given as an argument to the |
74889e6f6d68
fix memory issues if parsing invalid DICOM file
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3769
diff
changeset
|
1958 * "read()" method. This can avoid huge memory consumption if |
74889e6f6d68
fix memory issues if parsing invalid DICOM file
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3769
diff
changeset
|
1959 * parsing an invalid DICOM file, which can notably been observed |
74889e6f6d68
fix memory issues if parsing invalid DICOM file
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3769
diff
changeset
|
1960 * by executing the integration test "test_upload_compressed" on |
74889e6f6d68
fix memory issues if parsing invalid DICOM file
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3769
diff
changeset
|
1961 * valgrind running Orthanc. |
74889e6f6d68
fix memory issues if parsing invalid DICOM file
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3769
diff
changeset
|
1962 **/ |
74889e6f6d68
fix memory issues if parsing invalid DICOM file
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3769
diff
changeset
|
1963 if (!result->read(is, EXS_Unknown, EGL_noChange, size).good()) |
1935
e251606c1433
FromDcmtkBridge::LoadFromMemoryBuffer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1934
diff
changeset
|
1964 { |
2954
d924f9bb61cc
taking advantage of details in OrthancException
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2905
diff
changeset
|
1965 throw OrthancException(ErrorCode_BadFileFormat, |
d924f9bb61cc
taking advantage of details in OrthancException
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2905
diff
changeset
|
1966 "Cannot parse an invalid DICOM file (size: " + |
d924f9bb61cc
taking advantage of details in OrthancException
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2905
diff
changeset
|
1967 boost::lexical_cast<std::string>(size) + " bytes)"); |
1935
e251606c1433
FromDcmtkBridge::LoadFromMemoryBuffer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1934
diff
changeset
|
1968 } |
e251606c1433
FromDcmtkBridge::LoadFromMemoryBuffer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1934
diff
changeset
|
1969 |
e251606c1433
FromDcmtkBridge::LoadFromMemoryBuffer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1934
diff
changeset
|
1970 result->loadAllDataIntoMemory(); |
e251606c1433
FromDcmtkBridge::LoadFromMemoryBuffer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1934
diff
changeset
|
1971 result->transferEnd(); |
e251606c1433
FromDcmtkBridge::LoadFromMemoryBuffer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1934
diff
changeset
|
1972 |
e251606c1433
FromDcmtkBridge::LoadFromMemoryBuffer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1934
diff
changeset
|
1973 return result.release(); |
e251606c1433
FromDcmtkBridge::LoadFromMemoryBuffer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1934
diff
changeset
|
1974 } |
1998
9b61701c35f2
New URI "/modalities/.../move" to issue C-Move SCU requests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1981
diff
changeset
|
1975 |
9b61701c35f2
New URI "/modalities/.../move" to issue C-Move SCU requests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1981
diff
changeset
|
1976 |
9b61701c35f2
New URI "/modalities/.../move" to issue C-Move SCU requests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1981
diff
changeset
|
1977 void FromDcmtkBridge::FromJson(DicomMap& target, |
9b61701c35f2
New URI "/modalities/.../move" to issue C-Move SCU requests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1981
diff
changeset
|
1978 const Json::Value& source) |
9b61701c35f2
New URI "/modalities/.../move" to issue C-Move SCU requests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1981
diff
changeset
|
1979 { |
9b61701c35f2
New URI "/modalities/.../move" to issue C-Move SCU requests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1981
diff
changeset
|
1980 if (source.type() != Json::objectValue) |
9b61701c35f2
New URI "/modalities/.../move" to issue C-Move SCU requests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1981
diff
changeset
|
1981 { |
9b61701c35f2
New URI "/modalities/.../move" to issue C-Move SCU requests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1981
diff
changeset
|
1982 throw OrthancException(ErrorCode_BadFileFormat); |
9b61701c35f2
New URI "/modalities/.../move" to issue C-Move SCU requests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1981
diff
changeset
|
1983 } |
9b61701c35f2
New URI "/modalities/.../move" to issue C-Move SCU requests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1981
diff
changeset
|
1984 |
9b61701c35f2
New URI "/modalities/.../move" to issue C-Move SCU requests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1981
diff
changeset
|
1985 target.Clear(); |
9b61701c35f2
New URI "/modalities/.../move" to issue C-Move SCU requests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1981
diff
changeset
|
1986 |
9b61701c35f2
New URI "/modalities/.../move" to issue C-Move SCU requests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1981
diff
changeset
|
1987 Json::Value::Members members = source.getMemberNames(); |
9b61701c35f2
New URI "/modalities/.../move" to issue C-Move SCU requests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1981
diff
changeset
|
1988 |
9b61701c35f2
New URI "/modalities/.../move" to issue C-Move SCU requests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1981
diff
changeset
|
1989 for (size_t i = 0; i < members.size(); i++) |
9b61701c35f2
New URI "/modalities/.../move" to issue C-Move SCU requests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1981
diff
changeset
|
1990 { |
9b61701c35f2
New URI "/modalities/.../move" to issue C-Move SCU requests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1981
diff
changeset
|
1991 const Json::Value& value = source[members[i]]; |
9b61701c35f2
New URI "/modalities/.../move" to issue C-Move SCU requests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1981
diff
changeset
|
1992 |
9b61701c35f2
New URI "/modalities/.../move" to issue C-Move SCU requests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1981
diff
changeset
|
1993 if (value.type() != Json::stringValue) |
9b61701c35f2
New URI "/modalities/.../move" to issue C-Move SCU requests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1981
diff
changeset
|
1994 { |
9b61701c35f2
New URI "/modalities/.../move" to issue C-Move SCU requests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1981
diff
changeset
|
1995 throw OrthancException(ErrorCode_BadFileFormat); |
9b61701c35f2
New URI "/modalities/.../move" to issue C-Move SCU requests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1981
diff
changeset
|
1996 } |
9b61701c35f2
New URI "/modalities/.../move" to issue C-Move SCU requests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1981
diff
changeset
|
1997 |
2007
655489d9165d
DicomMap::ParseDicomMetaInformation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2006
diff
changeset
|
1998 target.SetValue(ParseTag(members[i]), value.asString(), false); |
1998
9b61701c35f2
New URI "/modalities/.../move" to issue C-Move SCU requests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1981
diff
changeset
|
1999 } |
9b61701c35f2
New URI "/modalities/.../move" to issue C-Move SCU requests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1981
diff
changeset
|
2000 } |
2207
6dc3bdb4088b
Fix handling of encodings in C-FIND for worklists
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2172
diff
changeset
|
2001 |
6dc3bdb4088b
Fix handling of encodings in C-FIND for worklists
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2172
diff
changeset
|
2002 |
6dc3bdb4088b
Fix handling of encodings in C-FIND for worklists
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2172
diff
changeset
|
2003 void FromDcmtkBridge::ChangeStringEncoding(DcmItem& dataset, |
6dc3bdb4088b
Fix handling of encodings in C-FIND for worklists
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2172
diff
changeset
|
2004 Encoding source, |
3217
cf8cbeb35f33
preliminary support of Korean character set
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3209
diff
changeset
|
2005 bool hasSourceCodeExtensions, |
2207
6dc3bdb4088b
Fix handling of encodings in C-FIND for worklists
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2172
diff
changeset
|
2006 Encoding target) |
6dc3bdb4088b
Fix handling of encodings in C-FIND for worklists
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2172
diff
changeset
|
2007 { |
6dc3bdb4088b
Fix handling of encodings in C-FIND for worklists
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2172
diff
changeset
|
2008 // Recursive exploration of a dataset to change the encoding of |
6dc3bdb4088b
Fix handling of encodings in C-FIND for worklists
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2172
diff
changeset
|
2009 // each string-like element |
6dc3bdb4088b
Fix handling of encodings in C-FIND for worklists
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2172
diff
changeset
|
2010 |
6dc3bdb4088b
Fix handling of encodings in C-FIND for worklists
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2172
diff
changeset
|
2011 if (source == target) |
6dc3bdb4088b
Fix handling of encodings in C-FIND for worklists
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2172
diff
changeset
|
2012 { |
6dc3bdb4088b
Fix handling of encodings in C-FIND for worklists
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2172
diff
changeset
|
2013 return; |
6dc3bdb4088b
Fix handling of encodings in C-FIND for worklists
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2172
diff
changeset
|
2014 } |
6dc3bdb4088b
Fix handling of encodings in C-FIND for worklists
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2172
diff
changeset
|
2015 |
6dc3bdb4088b
Fix handling of encodings in C-FIND for worklists
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2172
diff
changeset
|
2016 for (unsigned long i = 0; i < dataset.card(); i++) |
6dc3bdb4088b
Fix handling of encodings in C-FIND for worklists
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2172
diff
changeset
|
2017 { |
6dc3bdb4088b
Fix handling of encodings in C-FIND for worklists
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2172
diff
changeset
|
2018 DcmElement* element = dataset.getElement(i); |
6dc3bdb4088b
Fix handling of encodings in C-FIND for worklists
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2172
diff
changeset
|
2019 if (element) |
6dc3bdb4088b
Fix handling of encodings in C-FIND for worklists
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2172
diff
changeset
|
2020 { |
6dc3bdb4088b
Fix handling of encodings in C-FIND for worklists
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2172
diff
changeset
|
2021 if (element->isLeaf()) |
6dc3bdb4088b
Fix handling of encodings in C-FIND for worklists
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2172
diff
changeset
|
2022 { |
6dc3bdb4088b
Fix handling of encodings in C-FIND for worklists
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2172
diff
changeset
|
2023 char *c = NULL; |
6dc3bdb4088b
Fix handling of encodings in C-FIND for worklists
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2172
diff
changeset
|
2024 if (element->isaString() && |
6dc3bdb4088b
Fix handling of encodings in C-FIND for worklists
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2172
diff
changeset
|
2025 element->getString(c).good() && |
6dc3bdb4088b
Fix handling of encodings in C-FIND for worklists
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2172
diff
changeset
|
2026 c != NULL) |
6dc3bdb4088b
Fix handling of encodings in C-FIND for worklists
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2172
diff
changeset
|
2027 { |
3217
cf8cbeb35f33
preliminary support of Korean character set
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3209
diff
changeset
|
2028 std::string a = Toolbox::ConvertToUtf8(c, source, hasSourceCodeExtensions); |
2207
6dc3bdb4088b
Fix handling of encodings in C-FIND for worklists
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2172
diff
changeset
|
2029 std::string b = Toolbox::ConvertFromUtf8(a, target); |
6dc3bdb4088b
Fix handling of encodings in C-FIND for worklists
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2172
diff
changeset
|
2030 element->putString(b.c_str()); |
6dc3bdb4088b
Fix handling of encodings in C-FIND for worklists
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2172
diff
changeset
|
2031 } |
6dc3bdb4088b
Fix handling of encodings in C-FIND for worklists
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2172
diff
changeset
|
2032 } |
6dc3bdb4088b
Fix handling of encodings in C-FIND for worklists
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2172
diff
changeset
|
2033 else |
6dc3bdb4088b
Fix handling of encodings in C-FIND for worklists
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2172
diff
changeset
|
2034 { |
6dc3bdb4088b
Fix handling of encodings in C-FIND for worklists
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2172
diff
changeset
|
2035 // "All subclasses of DcmElement except for DcmSequenceOfItems |
6dc3bdb4088b
Fix handling of encodings in C-FIND for worklists
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2172
diff
changeset
|
2036 // are leaf nodes, while DcmSequenceOfItems, DcmItem, DcmDataset |
6dc3bdb4088b
Fix handling of encodings in C-FIND for worklists
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2172
diff
changeset
|
2037 // etc. are not." The following dynamic_cast is thus OK. |
6dc3bdb4088b
Fix handling of encodings in C-FIND for worklists
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2172
diff
changeset
|
2038 DcmSequenceOfItems& sequence = dynamic_cast<DcmSequenceOfItems&>(*element); |
6dc3bdb4088b
Fix handling of encodings in C-FIND for worklists
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2172
diff
changeset
|
2039 |
6dc3bdb4088b
Fix handling of encodings in C-FIND for worklists
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2172
diff
changeset
|
2040 for (unsigned long j = 0; j < sequence.card(); j++) |
6dc3bdb4088b
Fix handling of encodings in C-FIND for worklists
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2172
diff
changeset
|
2041 { |
3217
cf8cbeb35f33
preliminary support of Korean character set
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3209
diff
changeset
|
2042 ChangeStringEncoding(*sequence.getItem(j), source, hasSourceCodeExtensions, target); |
2207
6dc3bdb4088b
Fix handling of encodings in C-FIND for worklists
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2172
diff
changeset
|
2043 } |
6dc3bdb4088b
Fix handling of encodings in C-FIND for worklists
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2172
diff
changeset
|
2044 } |
6dc3bdb4088b
Fix handling of encodings in C-FIND for worklists
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2172
diff
changeset
|
2045 } |
6dc3bdb4088b
Fix handling of encodings in C-FIND for worklists
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2172
diff
changeset
|
2046 } |
6dc3bdb4088b
Fix handling of encodings in C-FIND for worklists
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2172
diff
changeset
|
2047 } |
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
|
2048 |
e3fd5bc429a2
URI to reconstruct the main DICOM tags, the JSON summary and the metadata
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2207
diff
changeset
|
2049 |
2232
3dd44baebc36
macro ORTHANC_ENABLE_LUA for orthanc-wsi
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2218
diff
changeset
|
2050 #if ORTHANC_ENABLE_LUA == 1 |
2218
3eefb84ac0bd
dynamically fix outgoing C-Find requests using "OutgoingFindRequestFilter()"
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2216
diff
changeset
|
2051 void FromDcmtkBridge::ExecuteToDicom(DicomMap& target, |
3eefb84ac0bd
dynamically fix outgoing C-Find requests using "OutgoingFindRequestFilter()"
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2216
diff
changeset
|
2052 LuaFunctionCall& call) |
3eefb84ac0bd
dynamically fix outgoing C-Find requests using "OutgoingFindRequestFilter()"
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2216
diff
changeset
|
2053 { |
3eefb84ac0bd
dynamically fix outgoing C-Find requests using "OutgoingFindRequestFilter()"
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2216
diff
changeset
|
2054 Json::Value output; |
3eefb84ac0bd
dynamically fix outgoing C-Find requests using "OutgoingFindRequestFilter()"
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2216
diff
changeset
|
2055 call.ExecuteToJson(output, true /* keep strings */); |
3eefb84ac0bd
dynamically fix outgoing C-Find requests using "OutgoingFindRequestFilter()"
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2216
diff
changeset
|
2056 |
3eefb84ac0bd
dynamically fix outgoing C-Find requests using "OutgoingFindRequestFilter()"
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2216
diff
changeset
|
2057 target.Clear(); |
3eefb84ac0bd
dynamically fix outgoing C-Find requests using "OutgoingFindRequestFilter()"
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2216
diff
changeset
|
2058 |
3eefb84ac0bd
dynamically fix outgoing C-Find requests using "OutgoingFindRequestFilter()"
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2216
diff
changeset
|
2059 if (output.type() == Json::arrayValue && |
3eefb84ac0bd
dynamically fix outgoing C-Find requests using "OutgoingFindRequestFilter()"
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2216
diff
changeset
|
2060 output.size() == 0) |
3eefb84ac0bd
dynamically fix outgoing C-Find requests using "OutgoingFindRequestFilter()"
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2216
diff
changeset
|
2061 { |
3eefb84ac0bd
dynamically fix outgoing C-Find requests using "OutgoingFindRequestFilter()"
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2216
diff
changeset
|
2062 // This case happens for empty tables |
3eefb84ac0bd
dynamically fix outgoing C-Find requests using "OutgoingFindRequestFilter()"
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2216
diff
changeset
|
2063 return; |
3eefb84ac0bd
dynamically fix outgoing C-Find requests using "OutgoingFindRequestFilter()"
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2216
diff
changeset
|
2064 } |
3eefb84ac0bd
dynamically fix outgoing C-Find requests using "OutgoingFindRequestFilter()"
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2216
diff
changeset
|
2065 |
3eefb84ac0bd
dynamically fix outgoing C-Find requests using "OutgoingFindRequestFilter()"
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2216
diff
changeset
|
2066 if (output.type() != Json::objectValue) |
3eefb84ac0bd
dynamically fix outgoing C-Find requests using "OutgoingFindRequestFilter()"
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2216
diff
changeset
|
2067 { |
2954
d924f9bb61cc
taking advantage of details in OrthancException
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2905
diff
changeset
|
2068 throw OrthancException(ErrorCode_LuaBadOutput, |
3156 | 2069 "Lua: The script must return a table"); |
2218
3eefb84ac0bd
dynamically fix outgoing C-Find requests using "OutgoingFindRequestFilter()"
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2216
diff
changeset
|
2070 } |
3eefb84ac0bd
dynamically fix outgoing C-Find requests using "OutgoingFindRequestFilter()"
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2216
diff
changeset
|
2071 |
3eefb84ac0bd
dynamically fix outgoing C-Find requests using "OutgoingFindRequestFilter()"
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2216
diff
changeset
|
2072 Json::Value::Members members = output.getMemberNames(); |
3eefb84ac0bd
dynamically fix outgoing C-Find requests using "OutgoingFindRequestFilter()"
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2216
diff
changeset
|
2073 |
3eefb84ac0bd
dynamically fix outgoing C-Find requests using "OutgoingFindRequestFilter()"
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2216
diff
changeset
|
2074 for (size_t i = 0; i < members.size(); i++) |
3eefb84ac0bd
dynamically fix outgoing C-Find requests using "OutgoingFindRequestFilter()"
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2216
diff
changeset
|
2075 { |
3eefb84ac0bd
dynamically fix outgoing C-Find requests using "OutgoingFindRequestFilter()"
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2216
diff
changeset
|
2076 if (output[members[i]].type() != Json::stringValue) |
3eefb84ac0bd
dynamically fix outgoing C-Find requests using "OutgoingFindRequestFilter()"
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2216
diff
changeset
|
2077 { |
2954
d924f9bb61cc
taking advantage of details in OrthancException
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2905
diff
changeset
|
2078 throw OrthancException(ErrorCode_LuaBadOutput, |
3156 | 2079 "Lua: The script must return a table " |
2954
d924f9bb61cc
taking advantage of details in OrthancException
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2905
diff
changeset
|
2080 "mapping names of DICOM tags to strings"); |
2218
3eefb84ac0bd
dynamically fix outgoing C-Find requests using "OutgoingFindRequestFilter()"
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2216
diff
changeset
|
2081 } |
3eefb84ac0bd
dynamically fix outgoing C-Find requests using "OutgoingFindRequestFilter()"
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2216
diff
changeset
|
2082 |
3eefb84ac0bd
dynamically fix outgoing C-Find requests using "OutgoingFindRequestFilter()"
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2216
diff
changeset
|
2083 DicomTag tag(ParseTag(members[i])); |
3eefb84ac0bd
dynamically fix outgoing C-Find requests using "OutgoingFindRequestFilter()"
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2216
diff
changeset
|
2084 target.SetValue(tag, output[members[i]].asString(), false); |
3eefb84ac0bd
dynamically fix outgoing C-Find requests using "OutgoingFindRequestFilter()"
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2216
diff
changeset
|
2085 } |
3eefb84ac0bd
dynamically fix outgoing C-Find requests using "OutgoingFindRequestFilter()"
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2216
diff
changeset
|
2086 } |
2232
3dd44baebc36
macro ORTHANC_ENABLE_LUA for orthanc-wsi
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2218
diff
changeset
|
2087 #endif |
2381
b8969010b534
uncoupling DCMTK primitives from Orthanc::Configuration
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2364
diff
changeset
|
2088 |
b8969010b534
uncoupling DCMTK primitives from Orthanc::Configuration
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2364
diff
changeset
|
2089 |
b8969010b534
uncoupling DCMTK primitives from Orthanc::Configuration
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2364
diff
changeset
|
2090 void FromDcmtkBridge::ExtractDicomSummary(DicomMap& target, |
3577
33cfcc74d1b1
argument "ignoreTagLength" to ParsedDicomFile::ExtractDicomSummary()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3448
diff
changeset
|
2091 DcmItem& dataset, |
33cfcc74d1b1
argument "ignoreTagLength" to ParsedDicomFile::ExtractDicomSummary()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3448
diff
changeset
|
2092 const std::set<DicomTag>& ignoreTagLength) |
2381
b8969010b534
uncoupling DCMTK primitives from Orthanc::Configuration
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2364
diff
changeset
|
2093 { |
b8969010b534
uncoupling DCMTK primitives from Orthanc::Configuration
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2364
diff
changeset
|
2094 ExtractDicomSummary(target, dataset, |
b8969010b534
uncoupling DCMTK primitives from Orthanc::Configuration
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2364
diff
changeset
|
2095 ORTHANC_MAXIMUM_TAG_LENGTH, |
3577
33cfcc74d1b1
argument "ignoreTagLength" to ParsedDicomFile::ExtractDicomSummary()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3448
diff
changeset
|
2096 GetDefaultDicomEncoding(), ignoreTagLength); |
2381
b8969010b534
uncoupling DCMTK primitives from Orthanc::Configuration
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2364
diff
changeset
|
2097 } |
b8969010b534
uncoupling DCMTK primitives from Orthanc::Configuration
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2364
diff
changeset
|
2098 |
b8969010b534
uncoupling DCMTK primitives from Orthanc::Configuration
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2364
diff
changeset
|
2099 |
b8969010b534
uncoupling DCMTK primitives from Orthanc::Configuration
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2364
diff
changeset
|
2100 void FromDcmtkBridge::ExtractDicomAsJson(Json::Value& target, |
2409
e4045b3c9772
ignore-length argument if retrieving DICOM tags
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2382
diff
changeset
|
2101 DcmDataset& dataset, |
e4045b3c9772
ignore-length argument if retrieving DICOM tags
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2382
diff
changeset
|
2102 const std::set<DicomTag>& ignoreTagLength) |
2381
b8969010b534
uncoupling DCMTK primitives from Orthanc::Configuration
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2364
diff
changeset
|
2103 { |
b8969010b534
uncoupling DCMTK primitives from Orthanc::Configuration
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2364
diff
changeset
|
2104 ExtractDicomAsJson(target, dataset, |
b8969010b534
uncoupling DCMTK primitives from Orthanc::Configuration
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2364
diff
changeset
|
2105 DicomToJsonFormat_Full, |
b8969010b534
uncoupling DCMTK primitives from Orthanc::Configuration
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2364
diff
changeset
|
2106 DicomToJsonFlags_Default, |
b8969010b534
uncoupling DCMTK primitives from Orthanc::Configuration
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2364
diff
changeset
|
2107 ORTHANC_MAXIMUM_TAG_LENGTH, |
2409
e4045b3c9772
ignore-length argument if retrieving DICOM tags
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2382
diff
changeset
|
2108 GetDefaultDicomEncoding(), |
e4045b3c9772
ignore-length argument if retrieving DICOM tags
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2382
diff
changeset
|
2109 ignoreTagLength); |
2381
b8969010b534
uncoupling DCMTK primitives from Orthanc::Configuration
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2364
diff
changeset
|
2110 } |
b8969010b534
uncoupling DCMTK primitives from Orthanc::Configuration
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2364
diff
changeset
|
2111 |
b8969010b534
uncoupling DCMTK primitives from Orthanc::Configuration
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2364
diff
changeset
|
2112 |
b8969010b534
uncoupling DCMTK primitives from Orthanc::Configuration
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2364
diff
changeset
|
2113 void FromDcmtkBridge::InitializeCodecs() |
b8969010b534
uncoupling DCMTK primitives from Orthanc::Configuration
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2364
diff
changeset
|
2114 { |
b8969010b534
uncoupling DCMTK primitives from Orthanc::Configuration
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2364
diff
changeset
|
2115 #if ORTHANC_ENABLE_DCMTK_JPEG_LOSSLESS == 1 |
2528
832217e4e872
old warnings turned into info
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2522
diff
changeset
|
2116 LOG(INFO) << "Registering JPEG Lossless codecs in DCMTK"; |
3727
090022f1b5e1
auto-generation of primitives to handle transfer syntaxes
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3712
diff
changeset
|
2117 DJLSDecoderRegistration::registerCodecs(); |
090022f1b5e1
auto-generation of primitives to handle transfer syntaxes
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3712
diff
changeset
|
2118 # if ORTHANC_ENABLE_DCMTK_TRANSCODING == 1 |
090022f1b5e1
auto-generation of primitives to handle transfer syntaxes
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3712
diff
changeset
|
2119 DJLSEncoderRegistration::registerCodecs(); |
090022f1b5e1
auto-generation of primitives to handle transfer syntaxes
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3712
diff
changeset
|
2120 # endif |
2381
b8969010b534
uncoupling DCMTK primitives from Orthanc::Configuration
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2364
diff
changeset
|
2121 #endif |
b8969010b534
uncoupling DCMTK primitives from Orthanc::Configuration
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2364
diff
changeset
|
2122 |
b8969010b534
uncoupling DCMTK primitives from Orthanc::Configuration
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2364
diff
changeset
|
2123 #if ORTHANC_ENABLE_DCMTK_JPEG == 1 |
2528
832217e4e872
old warnings turned into info
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2522
diff
changeset
|
2124 LOG(INFO) << "Registering JPEG codecs in DCMTK"; |
2381
b8969010b534
uncoupling DCMTK primitives from Orthanc::Configuration
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2364
diff
changeset
|
2125 DJDecoderRegistration::registerCodecs(); |
3727
090022f1b5e1
auto-generation of primitives to handle transfer syntaxes
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3712
diff
changeset
|
2126 # if ORTHANC_ENABLE_DCMTK_TRANSCODING == 1 |
090022f1b5e1
auto-generation of primitives to handle transfer syntaxes
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3712
diff
changeset
|
2127 DJEncoderRegistration::registerCodecs(); |
090022f1b5e1
auto-generation of primitives to handle transfer syntaxes
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3712
diff
changeset
|
2128 # endif |
2381
b8969010b534
uncoupling DCMTK primitives from Orthanc::Configuration
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2364
diff
changeset
|
2129 #endif |
3748
ca36e3f1112c
transcoding to uncompressed transfer syntaxes
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3743
diff
changeset
|
2130 |
ca36e3f1112c
transcoding to uncompressed transfer syntaxes
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3743
diff
changeset
|
2131 LOG(INFO) << "Registering RLE codecs in DCMTK"; |
ca36e3f1112c
transcoding to uncompressed transfer syntaxes
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3743
diff
changeset
|
2132 DcmRLEDecoderRegistration::registerCodecs(); |
ca36e3f1112c
transcoding to uncompressed transfer syntaxes
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3743
diff
changeset
|
2133 #if ORTHANC_ENABLE_DCMTK_TRANSCODING == 1 |
ca36e3f1112c
transcoding to uncompressed transfer syntaxes
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3743
diff
changeset
|
2134 DcmRLEEncoderRegistration::registerCodecs(); |
ca36e3f1112c
transcoding to uncompressed transfer syntaxes
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3743
diff
changeset
|
2135 #endif |
2381
b8969010b534
uncoupling DCMTK primitives from Orthanc::Configuration
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2364
diff
changeset
|
2136 } |
b8969010b534
uncoupling DCMTK primitives from Orthanc::Configuration
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2364
diff
changeset
|
2137 |
b8969010b534
uncoupling DCMTK primitives from Orthanc::Configuration
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2364
diff
changeset
|
2138 |
b8969010b534
uncoupling DCMTK primitives from Orthanc::Configuration
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2364
diff
changeset
|
2139 void FromDcmtkBridge::FinalizeCodecs() |
b8969010b534
uncoupling DCMTK primitives from Orthanc::Configuration
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2364
diff
changeset
|
2140 { |
b8969010b534
uncoupling DCMTK primitives from Orthanc::Configuration
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2364
diff
changeset
|
2141 #if ORTHANC_ENABLE_DCMTK_JPEG_LOSSLESS == 1 |
b8969010b534
uncoupling DCMTK primitives from Orthanc::Configuration
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2364
diff
changeset
|
2142 // Unregister JPEG-LS codecs |
b8969010b534
uncoupling DCMTK primitives from Orthanc::Configuration
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2364
diff
changeset
|
2143 DJLSDecoderRegistration::cleanup(); |
3727
090022f1b5e1
auto-generation of primitives to handle transfer syntaxes
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3712
diff
changeset
|
2144 # if ORTHANC_ENABLE_DCMTK_TRANSCODING == 1 |
090022f1b5e1
auto-generation of primitives to handle transfer syntaxes
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3712
diff
changeset
|
2145 DJLSEncoderRegistration::cleanup(); |
090022f1b5e1
auto-generation of primitives to handle transfer syntaxes
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3712
diff
changeset
|
2146 # endif |
2381
b8969010b534
uncoupling DCMTK primitives from Orthanc::Configuration
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2364
diff
changeset
|
2147 #endif |
b8969010b534
uncoupling DCMTK primitives from Orthanc::Configuration
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2364
diff
changeset
|
2148 |
b8969010b534
uncoupling DCMTK primitives from Orthanc::Configuration
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2364
diff
changeset
|
2149 #if ORTHANC_ENABLE_DCMTK_JPEG == 1 |
b8969010b534
uncoupling DCMTK primitives from Orthanc::Configuration
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2364
diff
changeset
|
2150 // Unregister JPEG codecs |
b8969010b534
uncoupling DCMTK primitives from Orthanc::Configuration
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2364
diff
changeset
|
2151 DJDecoderRegistration::cleanup(); |
3727
090022f1b5e1
auto-generation of primitives to handle transfer syntaxes
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3712
diff
changeset
|
2152 # if ORTHANC_ENABLE_DCMTK_TRANSCODING == 1 |
3743
33c19a6643e1
creating IDicomTranscoder abstraction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3730
diff
changeset
|
2153 DJEncoderRegistration::cleanup(); |
3727
090022f1b5e1
auto-generation of primitives to handle transfer syntaxes
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3712
diff
changeset
|
2154 # endif |
2381
b8969010b534
uncoupling DCMTK primitives from Orthanc::Configuration
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2364
diff
changeset
|
2155 #endif |
3748
ca36e3f1112c
transcoding to uncompressed transfer syntaxes
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3743
diff
changeset
|
2156 |
ca36e3f1112c
transcoding to uncompressed transfer syntaxes
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3743
diff
changeset
|
2157 DcmRLEDecoderRegistration::cleanup(); |
ca36e3f1112c
transcoding to uncompressed transfer syntaxes
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3743
diff
changeset
|
2158 #if ORTHANC_ENABLE_DCMTK_TRANSCODING == 1 |
ca36e3f1112c
transcoding to uncompressed transfer syntaxes
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3743
diff
changeset
|
2159 DcmRLEEncoderRegistration::cleanup(); |
ca36e3f1112c
transcoding to uncompressed transfer syntaxes
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3743
diff
changeset
|
2160 #endif |
2381
b8969010b534
uncoupling DCMTK primitives from Orthanc::Configuration
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2364
diff
changeset
|
2161 } |
2499
83b8b6743531
ITagVisitor - for anonymization relationships
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2470
diff
changeset
|
2162 |
83b8b6743531
ITagVisitor - for anonymization relationships
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2470
diff
changeset
|
2163 |
83b8b6743531
ITagVisitor - for anonymization relationships
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2470
diff
changeset
|
2164 |
83b8b6743531
ITagVisitor - for anonymization relationships
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2470
diff
changeset
|
2165 // Forward declaration |
83b8b6743531
ITagVisitor - for anonymization relationships
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2470
diff
changeset
|
2166 static void ApplyVisitorToElement(DcmElement& element, |
83b8b6743531
ITagVisitor - for anonymization relationships
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2470
diff
changeset
|
2167 ITagVisitor& visitor, |
83b8b6743531
ITagVisitor - for anonymization relationships
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2470
diff
changeset
|
2168 const std::vector<DicomTag>& parentTags, |
83b8b6743531
ITagVisitor - for anonymization relationships
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2470
diff
changeset
|
2169 const std::vector<size_t>& parentIndexes, |
3217
cf8cbeb35f33
preliminary support of Korean character set
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3209
diff
changeset
|
2170 Encoding encoding, |
cf8cbeb35f33
preliminary support of Korean character set
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3209
diff
changeset
|
2171 bool hasCodeExtensions); |
2499
83b8b6743531
ITagVisitor - for anonymization relationships
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2470
diff
changeset
|
2172 |
83b8b6743531
ITagVisitor - for anonymization relationships
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2470
diff
changeset
|
2173 static void ApplyVisitorToDataset(DcmItem& dataset, |
83b8b6743531
ITagVisitor - for anonymization relationships
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2470
diff
changeset
|
2174 ITagVisitor& visitor, |
83b8b6743531
ITagVisitor - for anonymization relationships
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2470
diff
changeset
|
2175 const std::vector<DicomTag>& parentTags, |
83b8b6743531
ITagVisitor - for anonymization relationships
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2470
diff
changeset
|
2176 const std::vector<size_t>& parentIndexes, |
3217
cf8cbeb35f33
preliminary support of Korean character set
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3209
diff
changeset
|
2177 Encoding encoding, |
cf8cbeb35f33
preliminary support of Korean character set
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3209
diff
changeset
|
2178 bool hasCodeExtensions) |
2499
83b8b6743531
ITagVisitor - for anonymization relationships
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2470
diff
changeset
|
2179 { |
83b8b6743531
ITagVisitor - for anonymization relationships
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2470
diff
changeset
|
2180 assert(parentTags.size() == parentIndexes.size()); |
83b8b6743531
ITagVisitor - for anonymization relationships
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2470
diff
changeset
|
2181 |
83b8b6743531
ITagVisitor - for anonymization relationships
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2470
diff
changeset
|
2182 for (unsigned long i = 0; i < dataset.card(); i++) |
83b8b6743531
ITagVisitor - for anonymization relationships
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2470
diff
changeset
|
2183 { |
83b8b6743531
ITagVisitor - for anonymization relationships
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2470
diff
changeset
|
2184 DcmElement* element = dataset.getElement(i); |
83b8b6743531
ITagVisitor - for anonymization relationships
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2470
diff
changeset
|
2185 if (element == NULL) |
83b8b6743531
ITagVisitor - for anonymization relationships
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2470
diff
changeset
|
2186 { |
83b8b6743531
ITagVisitor - for anonymization relationships
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2470
diff
changeset
|
2187 throw OrthancException(ErrorCode_InternalError); |
83b8b6743531
ITagVisitor - for anonymization relationships
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2470
diff
changeset
|
2188 } |
83b8b6743531
ITagVisitor - for anonymization relationships
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2470
diff
changeset
|
2189 else |
83b8b6743531
ITagVisitor - for anonymization relationships
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2470
diff
changeset
|
2190 { |
3217
cf8cbeb35f33
preliminary support of Korean character set
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3209
diff
changeset
|
2191 ApplyVisitorToElement(*element, visitor, parentTags, parentIndexes, encoding, hasCodeExtensions); |
2499
83b8b6743531
ITagVisitor - for anonymization relationships
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2470
diff
changeset
|
2192 } |
83b8b6743531
ITagVisitor - for anonymization relationships
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2470
diff
changeset
|
2193 } |
83b8b6743531
ITagVisitor - for anonymization relationships
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2470
diff
changeset
|
2194 } |
83b8b6743531
ITagVisitor - for anonymization relationships
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2470
diff
changeset
|
2195 |
83b8b6743531
ITagVisitor - for anonymization relationships
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2470
diff
changeset
|
2196 |
83b8b6743531
ITagVisitor - for anonymization relationships
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2470
diff
changeset
|
2197 static void ApplyVisitorToLeaf(DcmElement& element, |
83b8b6743531
ITagVisitor - for anonymization relationships
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2470
diff
changeset
|
2198 ITagVisitor& visitor, |
83b8b6743531
ITagVisitor - for anonymization relationships
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2470
diff
changeset
|
2199 const std::vector<DicomTag>& parentTags, |
83b8b6743531
ITagVisitor - for anonymization relationships
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2470
diff
changeset
|
2200 const std::vector<size_t>& parentIndexes, |
83b8b6743531
ITagVisitor - for anonymization relationships
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2470
diff
changeset
|
2201 const DicomTag& tag, |
3217
cf8cbeb35f33
preliminary support of Korean character set
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3209
diff
changeset
|
2202 Encoding encoding, |
cf8cbeb35f33
preliminary support of Korean character set
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3209
diff
changeset
|
2203 bool hasCodeExtensions) |
2499
83b8b6743531
ITagVisitor - for anonymization relationships
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2470
diff
changeset
|
2204 { |
3198
7724ed267b5c
unit testing dicomweb conversion
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3195
diff
changeset
|
2205 // TODO - Merge this function, that is more recent, with ConvertLeafElement() |
2499
83b8b6743531
ITagVisitor - for anonymization relationships
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2470
diff
changeset
|
2206 |
83b8b6743531
ITagVisitor - for anonymization relationships
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2470
diff
changeset
|
2207 assert(element.isLeaf()); |
83b8b6743531
ITagVisitor - for anonymization relationships
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2470
diff
changeset
|
2208 |
83b8b6743531
ITagVisitor - for anonymization relationships
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2470
diff
changeset
|
2209 DcmEVR evr = element.getTag().getEVR(); |
3198
7724ed267b5c
unit testing dicomweb conversion
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3195
diff
changeset
|
2210 |
7724ed267b5c
unit testing dicomweb conversion
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3195
diff
changeset
|
2211 |
7724ed267b5c
unit testing dicomweb conversion
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3195
diff
changeset
|
2212 /** |
7724ed267b5c
unit testing dicomweb conversion
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3195
diff
changeset
|
2213 * Fix the EVR for types internal to DCMTK |
7724ed267b5c
unit testing dicomweb conversion
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3195
diff
changeset
|
2214 **/ |
7724ed267b5c
unit testing dicomweb conversion
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3195
diff
changeset
|
2215 |
7724ed267b5c
unit testing dicomweb conversion
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3195
diff
changeset
|
2216 if (evr == EVR_ox) // OB or OW depending on context |
7724ed267b5c
unit testing dicomweb conversion
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3195
diff
changeset
|
2217 { |
7724ed267b5c
unit testing dicomweb conversion
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3195
diff
changeset
|
2218 evr = EVR_OB; |
7724ed267b5c
unit testing dicomweb conversion
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3195
diff
changeset
|
2219 } |
7724ed267b5c
unit testing dicomweb conversion
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3195
diff
changeset
|
2220 |
7724ed267b5c
unit testing dicomweb conversion
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3195
diff
changeset
|
2221 if (evr == EVR_UNKNOWN || // used internally for elements with unknown VR (encoded with 4-byte length field in explicit VR) |
7724ed267b5c
unit testing dicomweb conversion
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3195
diff
changeset
|
2222 evr == EVR_UNKNOWN2B) // used internally for elements with unknown VR with 2-byte length field in explicit VR |
7724ed267b5c
unit testing dicomweb conversion
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3195
diff
changeset
|
2223 { |
7724ed267b5c
unit testing dicomweb conversion
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3195
diff
changeset
|
2224 evr = EVR_UN; |
7724ed267b5c
unit testing dicomweb conversion
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3195
diff
changeset
|
2225 } |
7724ed267b5c
unit testing dicomweb conversion
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3195
diff
changeset
|
2226 |
7724ed267b5c
unit testing dicomweb conversion
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3195
diff
changeset
|
2227 const ValueRepresentation vr = FromDcmtkBridge::Convert(evr); |
7724ed267b5c
unit testing dicomweb conversion
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3195
diff
changeset
|
2228 |
7724ed267b5c
unit testing dicomweb conversion
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3195
diff
changeset
|
2229 |
7724ed267b5c
unit testing dicomweb conversion
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3195
diff
changeset
|
2230 /** |
7724ed267b5c
unit testing dicomweb conversion
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3195
diff
changeset
|
2231 * Deal with binary data (including PixelData). |
7724ed267b5c
unit testing dicomweb conversion
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3195
diff
changeset
|
2232 **/ |
7724ed267b5c
unit testing dicomweb conversion
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3195
diff
changeset
|
2233 |
7724ed267b5c
unit testing dicomweb conversion
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3195
diff
changeset
|
2234 if (evr == EVR_OB || // other byte |
7724ed267b5c
unit testing dicomweb conversion
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3195
diff
changeset
|
2235 evr == EVR_OW || // other word |
7724ed267b5c
unit testing dicomweb conversion
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3195
diff
changeset
|
2236 evr == EVR_UN) // unknown value representation |
7724ed267b5c
unit testing dicomweb conversion
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3195
diff
changeset
|
2237 { |
3199
9316f341e40f
unit testing json for dicomweb
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3198
diff
changeset
|
2238 Uint16* data16 = NULL; |
3198
7724ed267b5c
unit testing dicomweb conversion
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3195
diff
changeset
|
2239 Uint8* data = NULL; |
7724ed267b5c
unit testing dicomweb conversion
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3195
diff
changeset
|
2240 |
3199
9316f341e40f
unit testing json for dicomweb
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3198
diff
changeset
|
2241 if (evr == EVR_OW && |
9316f341e40f
unit testing json for dicomweb
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3198
diff
changeset
|
2242 element.getUint16Array(data16) == EC_Normal) |
9316f341e40f
unit testing json for dicomweb
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3198
diff
changeset
|
2243 { |
9316f341e40f
unit testing json for dicomweb
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3198
diff
changeset
|
2244 visitor.VisitBinary(parentTags, parentIndexes, tag, vr, data16, element.getLength()); |
9316f341e40f
unit testing json for dicomweb
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3198
diff
changeset
|
2245 } |
9316f341e40f
unit testing json for dicomweb
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3198
diff
changeset
|
2246 else if (evr != EVR_OW && |
9316f341e40f
unit testing json for dicomweb
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3198
diff
changeset
|
2247 element.getUint8Array(data) == EC_Normal) |
3198
7724ed267b5c
unit testing dicomweb conversion
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3195
diff
changeset
|
2248 { |
7724ed267b5c
unit testing dicomweb conversion
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3195
diff
changeset
|
2249 visitor.VisitBinary(parentTags, parentIndexes, tag, vr, data, element.getLength()); |
7724ed267b5c
unit testing dicomweb conversion
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3195
diff
changeset
|
2250 } |
7724ed267b5c
unit testing dicomweb conversion
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3195
diff
changeset
|
2251 else |
7724ed267b5c
unit testing dicomweb conversion
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3195
diff
changeset
|
2252 { |
7724ed267b5c
unit testing dicomweb conversion
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3195
diff
changeset
|
2253 visitor.VisitNotSupported(parentTags, parentIndexes, tag, vr); |
7724ed267b5c
unit testing dicomweb conversion
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3195
diff
changeset
|
2254 } |
7724ed267b5c
unit testing dicomweb conversion
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3195
diff
changeset
|
2255 |
7724ed267b5c
unit testing dicomweb conversion
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3195
diff
changeset
|
2256 return; // We're done |
7724ed267b5c
unit testing dicomweb conversion
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3195
diff
changeset
|
2257 } |
7724ed267b5c
unit testing dicomweb conversion
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3195
diff
changeset
|
2258 |
7724ed267b5c
unit testing dicomweb conversion
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3195
diff
changeset
|
2259 |
7724ed267b5c
unit testing dicomweb conversion
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3195
diff
changeset
|
2260 /** |
7724ed267b5c
unit testing dicomweb conversion
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3195
diff
changeset
|
2261 * Deal with plain strings (and convert them to UTF-8) |
7724ed267b5c
unit testing dicomweb conversion
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3195
diff
changeset
|
2262 **/ |
2499
83b8b6743531
ITagVisitor - for anonymization relationships
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2470
diff
changeset
|
2263 |
83b8b6743531
ITagVisitor - for anonymization relationships
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2470
diff
changeset
|
2264 char *c = NULL; |
83b8b6743531
ITagVisitor - for anonymization relationships
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2470
diff
changeset
|
2265 if (element.isaString() && |
83b8b6743531
ITagVisitor - for anonymization relationships
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2470
diff
changeset
|
2266 element.getString(c).good()) |
83b8b6743531
ITagVisitor - for anonymization relationships
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2470
diff
changeset
|
2267 { |
83b8b6743531
ITagVisitor - for anonymization relationships
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2470
diff
changeset
|
2268 std::string utf8; |
83b8b6743531
ITagVisitor - for anonymization relationships
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2470
diff
changeset
|
2269 |
83b8b6743531
ITagVisitor - for anonymization relationships
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2470
diff
changeset
|
2270 if (c != NULL) // This case corresponds to the empty string |
83b8b6743531
ITagVisitor - for anonymization relationships
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2470
diff
changeset
|
2271 { |
3448
b3bdd6dc10f2
don't change encoding of SpecificCharacterSet
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3302
diff
changeset
|
2272 if (element.getTag() == DCM_SpecificCharacterSet) |
b3bdd6dc10f2
don't change encoding of SpecificCharacterSet
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3302
diff
changeset
|
2273 { |
b3bdd6dc10f2
don't change encoding of SpecificCharacterSet
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3302
diff
changeset
|
2274 utf8.assign(c); |
b3bdd6dc10f2
don't change encoding of SpecificCharacterSet
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3302
diff
changeset
|
2275 } |
b3bdd6dc10f2
don't change encoding of SpecificCharacterSet
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3302
diff
changeset
|
2276 else |
b3bdd6dc10f2
don't change encoding of SpecificCharacterSet
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3302
diff
changeset
|
2277 { |
b3bdd6dc10f2
don't change encoding of SpecificCharacterSet
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3302
diff
changeset
|
2278 std::string s(c); |
b3bdd6dc10f2
don't change encoding of SpecificCharacterSet
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3302
diff
changeset
|
2279 utf8 = Toolbox::ConvertToUtf8(s, encoding, hasCodeExtensions); |
b3bdd6dc10f2
don't change encoding of SpecificCharacterSet
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3302
diff
changeset
|
2280 } |
2499
83b8b6743531
ITagVisitor - for anonymization relationships
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2470
diff
changeset
|
2281 } |
83b8b6743531
ITagVisitor - for anonymization relationships
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2470
diff
changeset
|
2282 |
83b8b6743531
ITagVisitor - for anonymization relationships
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2470
diff
changeset
|
2283 std::string newValue; |
83b8b6743531
ITagVisitor - for anonymization relationships
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2470
diff
changeset
|
2284 ITagVisitor::Action action = visitor.VisitString |
83b8b6743531
ITagVisitor - for anonymization relationships
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2470
diff
changeset
|
2285 (newValue, parentTags, parentIndexes, tag, vr, utf8); |
83b8b6743531
ITagVisitor - for anonymization relationships
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2470
diff
changeset
|
2286 |
83b8b6743531
ITagVisitor - for anonymization relationships
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2470
diff
changeset
|
2287 switch (action) |
83b8b6743531
ITagVisitor - for anonymization relationships
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2470
diff
changeset
|
2288 { |
83b8b6743531
ITagVisitor - for anonymization relationships
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2470
diff
changeset
|
2289 case ITagVisitor::Action_None: |
83b8b6743531
ITagVisitor - for anonymization relationships
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2470
diff
changeset
|
2290 break; |
83b8b6743531
ITagVisitor - for anonymization relationships
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2470
diff
changeset
|
2291 |
83b8b6743531
ITagVisitor - for anonymization relationships
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2470
diff
changeset
|
2292 case ITagVisitor::Action_Replace: |
83b8b6743531
ITagVisitor - for anonymization relationships
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2470
diff
changeset
|
2293 { |
83b8b6743531
ITagVisitor - for anonymization relationships
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2470
diff
changeset
|
2294 std::string s = Toolbox::ConvertFromUtf8(newValue, encoding); |
2522
ce2dfba9417c
fix build with dcmtk 3.6.0
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2513
diff
changeset
|
2295 if (element.putString(s.c_str()) != EC_Normal) |
2499
83b8b6743531
ITagVisitor - for anonymization relationships
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2470
diff
changeset
|
2296 { |
2954
d924f9bb61cc
taking advantage of details in OrthancException
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2905
diff
changeset
|
2297 throw OrthancException(ErrorCode_InternalError, |
d924f9bb61cc
taking advantage of details in OrthancException
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2905
diff
changeset
|
2298 "Cannot replace value of tag: " + tag.Format()); |
2499
83b8b6743531
ITagVisitor - for anonymization relationships
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2470
diff
changeset
|
2299 } |
83b8b6743531
ITagVisitor - for anonymization relationships
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2470
diff
changeset
|
2300 |
83b8b6743531
ITagVisitor - for anonymization relationships
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2470
diff
changeset
|
2301 break; |
83b8b6743531
ITagVisitor - for anonymization relationships
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2470
diff
changeset
|
2302 } |
83b8b6743531
ITagVisitor - for anonymization relationships
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2470
diff
changeset
|
2303 |
83b8b6743531
ITagVisitor - for anonymization relationships
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2470
diff
changeset
|
2304 default: |
83b8b6743531
ITagVisitor - for anonymization relationships
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2470
diff
changeset
|
2305 throw OrthancException(ErrorCode_InternalError); |
83b8b6743531
ITagVisitor - for anonymization relationships
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2470
diff
changeset
|
2306 } |
83b8b6743531
ITagVisitor - for anonymization relationships
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2470
diff
changeset
|
2307 |
83b8b6743531
ITagVisitor - for anonymization relationships
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2470
diff
changeset
|
2308 return; // We're done |
83b8b6743531
ITagVisitor - for anonymization relationships
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2470
diff
changeset
|
2309 } |
83b8b6743531
ITagVisitor - for anonymization relationships
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2470
diff
changeset
|
2310 |
83b8b6743531
ITagVisitor - for anonymization relationships
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2470
diff
changeset
|
2311 |
83b8b6743531
ITagVisitor - for anonymization relationships
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2470
diff
changeset
|
2312 try |
83b8b6743531
ITagVisitor - for anonymization relationships
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2470
diff
changeset
|
2313 { |
83b8b6743531
ITagVisitor - for anonymization relationships
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2470
diff
changeset
|
2314 // http://support.dcmtk.org/docs/dcvr_8h-source.html |
3198
7724ed267b5c
unit testing dicomweb conversion
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3195
diff
changeset
|
2315 switch (evr) |
2499
83b8b6743531
ITagVisitor - for anonymization relationships
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2470
diff
changeset
|
2316 { |
83b8b6743531
ITagVisitor - for anonymization relationships
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2470
diff
changeset
|
2317 |
83b8b6743531
ITagVisitor - for anonymization relationships
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2470
diff
changeset
|
2318 /** |
3198
7724ed267b5c
unit testing dicomweb conversion
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3195
diff
changeset
|
2319 * Plain string values. |
2499
83b8b6743531
ITagVisitor - for anonymization relationships
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2470
diff
changeset
|
2320 **/ |
83b8b6743531
ITagVisitor - for anonymization relationships
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2470
diff
changeset
|
2321 |
83b8b6743531
ITagVisitor - for anonymization relationships
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2470
diff
changeset
|
2322 case EVR_DS: // decimal string |
83b8b6743531
ITagVisitor - for anonymization relationships
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2470
diff
changeset
|
2323 case EVR_IS: // integer string |
83b8b6743531
ITagVisitor - for anonymization relationships
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2470
diff
changeset
|
2324 case EVR_AS: // age string |
83b8b6743531
ITagVisitor - for anonymization relationships
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2470
diff
changeset
|
2325 case EVR_DA: // date string |
83b8b6743531
ITagVisitor - for anonymization relationships
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2470
diff
changeset
|
2326 case EVR_DT: // date time string |
83b8b6743531
ITagVisitor - for anonymization relationships
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2470
diff
changeset
|
2327 case EVR_TM: // time string |
83b8b6743531
ITagVisitor - for anonymization relationships
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2470
diff
changeset
|
2328 case EVR_AE: // application entity title |
83b8b6743531
ITagVisitor - for anonymization relationships
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2470
diff
changeset
|
2329 case EVR_CS: // code string |
83b8b6743531
ITagVisitor - for anonymization relationships
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2470
diff
changeset
|
2330 case EVR_SH: // short string |
83b8b6743531
ITagVisitor - for anonymization relationships
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2470
diff
changeset
|
2331 case EVR_LO: // long string |
83b8b6743531
ITagVisitor - for anonymization relationships
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2470
diff
changeset
|
2332 case EVR_ST: // short text |
83b8b6743531
ITagVisitor - for anonymization relationships
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2470
diff
changeset
|
2333 case EVR_LT: // long text |
83b8b6743531
ITagVisitor - for anonymization relationships
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2470
diff
changeset
|
2334 case EVR_UT: // unlimited text |
83b8b6743531
ITagVisitor - for anonymization relationships
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2470
diff
changeset
|
2335 case EVR_PN: // person name |
83b8b6743531
ITagVisitor - for anonymization relationships
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2470
diff
changeset
|
2336 case EVR_UI: // unique identifier |
83b8b6743531
ITagVisitor - for anonymization relationships
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2470
diff
changeset
|
2337 { |
83b8b6743531
ITagVisitor - for anonymization relationships
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2470
diff
changeset
|
2338 Uint8* data = NULL; |
83b8b6743531
ITagVisitor - for anonymization relationships
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2470
diff
changeset
|
2339 |
83b8b6743531
ITagVisitor - for anonymization relationships
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2470
diff
changeset
|
2340 if (element.getUint8Array(data) == EC_Normal) |
83b8b6743531
ITagVisitor - for anonymization relationships
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2470
diff
changeset
|
2341 { |
3198
7724ed267b5c
unit testing dicomweb conversion
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3195
diff
changeset
|
2342 const Uint32 length = element.getLength(); |
7724ed267b5c
unit testing dicomweb conversion
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3195
diff
changeset
|
2343 Uint32 l = 0; |
7724ed267b5c
unit testing dicomweb conversion
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3195
diff
changeset
|
2344 while (l < length && |
7724ed267b5c
unit testing dicomweb conversion
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3195
diff
changeset
|
2345 data[l] != 0) |
7724ed267b5c
unit testing dicomweb conversion
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3195
diff
changeset
|
2346 { |
7724ed267b5c
unit testing dicomweb conversion
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3195
diff
changeset
|
2347 l++; |
7724ed267b5c
unit testing dicomweb conversion
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3195
diff
changeset
|
2348 } |
7724ed267b5c
unit testing dicomweb conversion
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3195
diff
changeset
|
2349 |
7724ed267b5c
unit testing dicomweb conversion
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3195
diff
changeset
|
2350 if (l == length) |
7724ed267b5c
unit testing dicomweb conversion
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3195
diff
changeset
|
2351 { |
7724ed267b5c
unit testing dicomweb conversion
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3195
diff
changeset
|
2352 // Not a null-terminated plain string |
7724ed267b5c
unit testing dicomweb conversion
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3195
diff
changeset
|
2353 visitor.VisitNotSupported(parentTags, parentIndexes, tag, vr); |
7724ed267b5c
unit testing dicomweb conversion
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3195
diff
changeset
|
2354 } |
7724ed267b5c
unit testing dicomweb conversion
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3195
diff
changeset
|
2355 else |
7724ed267b5c
unit testing dicomweb conversion
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3195
diff
changeset
|
2356 { |
7724ed267b5c
unit testing dicomweb conversion
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3195
diff
changeset
|
2357 std::string ignored; |
7724ed267b5c
unit testing dicomweb conversion
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3195
diff
changeset
|
2358 std::string s(reinterpret_cast<const char*>(data), l); |
7724ed267b5c
unit testing dicomweb conversion
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3195
diff
changeset
|
2359 ITagVisitor::Action action = visitor.VisitString |
7724ed267b5c
unit testing dicomweb conversion
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3195
diff
changeset
|
2360 (ignored, parentTags, parentIndexes, tag, vr, |
3217
cf8cbeb35f33
preliminary support of Korean character set
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3209
diff
changeset
|
2361 Toolbox::ConvertToUtf8(s, encoding, hasCodeExtensions)); |
3198
7724ed267b5c
unit testing dicomweb conversion
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3195
diff
changeset
|
2362 |
7724ed267b5c
unit testing dicomweb conversion
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3195
diff
changeset
|
2363 if (action != ITagVisitor::Action_None) |
7724ed267b5c
unit testing dicomweb conversion
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3195
diff
changeset
|
2364 { |
7724ed267b5c
unit testing dicomweb conversion
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3195
diff
changeset
|
2365 LOG(WARNING) << "Cannot replace this string tag: " |
7724ed267b5c
unit testing dicomweb conversion
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3195
diff
changeset
|
2366 << FromDcmtkBridge::GetTagName(element) |
7724ed267b5c
unit testing dicomweb conversion
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3195
diff
changeset
|
2367 << " (" << tag.Format() << ")"; |
7724ed267b5c
unit testing dicomweb conversion
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3195
diff
changeset
|
2368 } |
7724ed267b5c
unit testing dicomweb conversion
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3195
diff
changeset
|
2369 } |
2499
83b8b6743531
ITagVisitor - for anonymization relationships
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2470
diff
changeset
|
2370 } |
83b8b6743531
ITagVisitor - for anonymization relationships
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2470
diff
changeset
|
2371 else |
83b8b6743531
ITagVisitor - for anonymization relationships
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2470
diff
changeset
|
2372 { |
3195 | 2373 visitor.VisitNotSupported(parentTags, parentIndexes, tag, vr); |
2499
83b8b6743531
ITagVisitor - for anonymization relationships
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2470
diff
changeset
|
2374 } |
83b8b6743531
ITagVisitor - for anonymization relationships
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2470
diff
changeset
|
2375 |
3198
7724ed267b5c
unit testing dicomweb conversion
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3195
diff
changeset
|
2376 return; |
2499
83b8b6743531
ITagVisitor - for anonymization relationships
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2470
diff
changeset
|
2377 } |
83b8b6743531
ITagVisitor - for anonymization relationships
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2470
diff
changeset
|
2378 |
83b8b6743531
ITagVisitor - for anonymization relationships
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2470
diff
changeset
|
2379 /** |
83b8b6743531
ITagVisitor - for anonymization relationships
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2470
diff
changeset
|
2380 * Numeric types |
83b8b6743531
ITagVisitor - for anonymization relationships
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2470
diff
changeset
|
2381 **/ |
83b8b6743531
ITagVisitor - for anonymization relationships
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2470
diff
changeset
|
2382 |
83b8b6743531
ITagVisitor - for anonymization relationships
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2470
diff
changeset
|
2383 case EVR_SL: // signed long |
83b8b6743531
ITagVisitor - for anonymization relationships
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2470
diff
changeset
|
2384 { |
3194
47ef29168698
support of value multiplicity in ITagVisitor
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3156
diff
changeset
|
2385 DcmSignedLong& content = dynamic_cast<DcmSignedLong&>(element); |
47ef29168698
support of value multiplicity in ITagVisitor
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3156
diff
changeset
|
2386 |
47ef29168698
support of value multiplicity in ITagVisitor
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3156
diff
changeset
|
2387 std::vector<int64_t> values; |
47ef29168698
support of value multiplicity in ITagVisitor
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3156
diff
changeset
|
2388 values.reserve(content.getVM()); |
47ef29168698
support of value multiplicity in ITagVisitor
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3156
diff
changeset
|
2389 |
47ef29168698
support of value multiplicity in ITagVisitor
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3156
diff
changeset
|
2390 for (unsigned long i = 0; i < content.getVM(); i++) |
2499
83b8b6743531
ITagVisitor - for anonymization relationships
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2470
diff
changeset
|
2391 { |
3194
47ef29168698
support of value multiplicity in ITagVisitor
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3156
diff
changeset
|
2392 Sint32 f; |
47ef29168698
support of value multiplicity in ITagVisitor
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3156
diff
changeset
|
2393 if (content.getSint32(f, i).good()) |
47ef29168698
support of value multiplicity in ITagVisitor
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3156
diff
changeset
|
2394 { |
47ef29168698
support of value multiplicity in ITagVisitor
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3156
diff
changeset
|
2395 values.push_back(f); |
47ef29168698
support of value multiplicity in ITagVisitor
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3156
diff
changeset
|
2396 } |
2499
83b8b6743531
ITagVisitor - for anonymization relationships
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2470
diff
changeset
|
2397 } |
83b8b6743531
ITagVisitor - for anonymization relationships
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2470
diff
changeset
|
2398 |
3194
47ef29168698
support of value multiplicity in ITagVisitor
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3156
diff
changeset
|
2399 visitor.VisitIntegers(parentTags, parentIndexes, tag, vr, values); |
2499
83b8b6743531
ITagVisitor - for anonymization relationships
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2470
diff
changeset
|
2400 break; |
83b8b6743531
ITagVisitor - for anonymization relationships
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2470
diff
changeset
|
2401 } |
83b8b6743531
ITagVisitor - for anonymization relationships
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2470
diff
changeset
|
2402 |
83b8b6743531
ITagVisitor - for anonymization relationships
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2470
diff
changeset
|
2403 case EVR_SS: // signed short |
83b8b6743531
ITagVisitor - for anonymization relationships
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2470
diff
changeset
|
2404 { |
3194
47ef29168698
support of value multiplicity in ITagVisitor
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3156
diff
changeset
|
2405 DcmSignedShort& content = dynamic_cast<DcmSignedShort&>(element); |
47ef29168698
support of value multiplicity in ITagVisitor
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3156
diff
changeset
|
2406 |
47ef29168698
support of value multiplicity in ITagVisitor
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3156
diff
changeset
|
2407 std::vector<int64_t> values; |
47ef29168698
support of value multiplicity in ITagVisitor
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3156
diff
changeset
|
2408 values.reserve(content.getVM()); |
47ef29168698
support of value multiplicity in ITagVisitor
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3156
diff
changeset
|
2409 |
47ef29168698
support of value multiplicity in ITagVisitor
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3156
diff
changeset
|
2410 for (unsigned long i = 0; i < content.getVM(); i++) |
2499
83b8b6743531
ITagVisitor - for anonymization relationships
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2470
diff
changeset
|
2411 { |
3194
47ef29168698
support of value multiplicity in ITagVisitor
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3156
diff
changeset
|
2412 Sint16 f; |
47ef29168698
support of value multiplicity in ITagVisitor
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3156
diff
changeset
|
2413 if (content.getSint16(f, i).good()) |
47ef29168698
support of value multiplicity in ITagVisitor
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3156
diff
changeset
|
2414 { |
47ef29168698
support of value multiplicity in ITagVisitor
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3156
diff
changeset
|
2415 values.push_back(f); |
47ef29168698
support of value multiplicity in ITagVisitor
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3156
diff
changeset
|
2416 } |
2499
83b8b6743531
ITagVisitor - for anonymization relationships
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2470
diff
changeset
|
2417 } |
83b8b6743531
ITagVisitor - for anonymization relationships
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2470
diff
changeset
|
2418 |
3194
47ef29168698
support of value multiplicity in ITagVisitor
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3156
diff
changeset
|
2419 visitor.VisitIntegers(parentTags, parentIndexes, tag, vr, values); |
2499
83b8b6743531
ITagVisitor - for anonymization relationships
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2470
diff
changeset
|
2420 break; |
83b8b6743531
ITagVisitor - for anonymization relationships
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2470
diff
changeset
|
2421 } |
83b8b6743531
ITagVisitor - for anonymization relationships
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2470
diff
changeset
|
2422 |
83b8b6743531
ITagVisitor - for anonymization relationships
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2470
diff
changeset
|
2423 case EVR_UL: // unsigned long |
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
|
2424 #if DCMTK_VERSION_NUMBER >= 362 |
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
|
2425 case EVR_OL: |
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
|
2426 #endif |
2499
83b8b6743531
ITagVisitor - for anonymization relationships
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2470
diff
changeset
|
2427 { |
3194
47ef29168698
support of value multiplicity in ITagVisitor
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3156
diff
changeset
|
2428 DcmUnsignedLong& content = dynamic_cast<DcmUnsignedLong&>(element); |
47ef29168698
support of value multiplicity in ITagVisitor
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3156
diff
changeset
|
2429 |
47ef29168698
support of value multiplicity in ITagVisitor
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3156
diff
changeset
|
2430 std::vector<int64_t> values; |
47ef29168698
support of value multiplicity in ITagVisitor
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3156
diff
changeset
|
2431 values.reserve(content.getVM()); |
47ef29168698
support of value multiplicity in ITagVisitor
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3156
diff
changeset
|
2432 |
47ef29168698
support of value multiplicity in ITagVisitor
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3156
diff
changeset
|
2433 for (unsigned long i = 0; i < content.getVM(); i++) |
2499
83b8b6743531
ITagVisitor - for anonymization relationships
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2470
diff
changeset
|
2434 { |
3194
47ef29168698
support of value multiplicity in ITagVisitor
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3156
diff
changeset
|
2435 Uint32 f; |
47ef29168698
support of value multiplicity in ITagVisitor
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3156
diff
changeset
|
2436 if (content.getUint32(f, i).good()) |
47ef29168698
support of value multiplicity in ITagVisitor
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3156
diff
changeset
|
2437 { |
47ef29168698
support of value multiplicity in ITagVisitor
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3156
diff
changeset
|
2438 values.push_back(f); |
47ef29168698
support of value multiplicity in ITagVisitor
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3156
diff
changeset
|
2439 } |
2499
83b8b6743531
ITagVisitor - for anonymization relationships
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2470
diff
changeset
|
2440 } |
83b8b6743531
ITagVisitor - for anonymization relationships
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2470
diff
changeset
|
2441 |
3194
47ef29168698
support of value multiplicity in ITagVisitor
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3156
diff
changeset
|
2442 visitor.VisitIntegers(parentTags, parentIndexes, tag, vr, values); |
2499
83b8b6743531
ITagVisitor - for anonymization relationships
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2470
diff
changeset
|
2443 break; |
83b8b6743531
ITagVisitor - for anonymization relationships
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2470
diff
changeset
|
2444 } |
83b8b6743531
ITagVisitor - for anonymization relationships
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2470
diff
changeset
|
2445 |
83b8b6743531
ITagVisitor - for anonymization relationships
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2470
diff
changeset
|
2446 case EVR_US: // unsigned short |
83b8b6743531
ITagVisitor - for anonymization relationships
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2470
diff
changeset
|
2447 { |
3194
47ef29168698
support of value multiplicity in ITagVisitor
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3156
diff
changeset
|
2448 DcmUnsignedShort& content = dynamic_cast<DcmUnsignedShort&>(element); |
47ef29168698
support of value multiplicity in ITagVisitor
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3156
diff
changeset
|
2449 |
47ef29168698
support of value multiplicity in ITagVisitor
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3156
diff
changeset
|
2450 std::vector<int64_t> values; |
47ef29168698
support of value multiplicity in ITagVisitor
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3156
diff
changeset
|
2451 values.reserve(content.getVM()); |
47ef29168698
support of value multiplicity in ITagVisitor
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3156
diff
changeset
|
2452 |
47ef29168698
support of value multiplicity in ITagVisitor
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3156
diff
changeset
|
2453 for (unsigned long i = 0; i < content.getVM(); i++) |
2499
83b8b6743531
ITagVisitor - for anonymization relationships
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2470
diff
changeset
|
2454 { |
3194
47ef29168698
support of value multiplicity in ITagVisitor
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3156
diff
changeset
|
2455 Uint16 f; |
47ef29168698
support of value multiplicity in ITagVisitor
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3156
diff
changeset
|
2456 if (content.getUint16(f, i).good()) |
47ef29168698
support of value multiplicity in ITagVisitor
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3156
diff
changeset
|
2457 { |
47ef29168698
support of value multiplicity in ITagVisitor
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3156
diff
changeset
|
2458 values.push_back(f); |
47ef29168698
support of value multiplicity in ITagVisitor
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3156
diff
changeset
|
2459 } |
2499
83b8b6743531
ITagVisitor - for anonymization relationships
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2470
diff
changeset
|
2460 } |
83b8b6743531
ITagVisitor - for anonymization relationships
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2470
diff
changeset
|
2461 |
3194
47ef29168698
support of value multiplicity in ITagVisitor
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3156
diff
changeset
|
2462 visitor.VisitIntegers(parentTags, parentIndexes, tag, vr, values); |
2499
83b8b6743531
ITagVisitor - for anonymization relationships
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2470
diff
changeset
|
2463 break; |
83b8b6743531
ITagVisitor - for anonymization relationships
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2470
diff
changeset
|
2464 } |
83b8b6743531
ITagVisitor - for anonymization relationships
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2470
diff
changeset
|
2465 |
83b8b6743531
ITagVisitor - for anonymization relationships
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2470
diff
changeset
|
2466 case EVR_FL: // float single-precision |
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
|
2467 case EVR_OF: |
2499
83b8b6743531
ITagVisitor - for anonymization relationships
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2470
diff
changeset
|
2468 { |
3194
47ef29168698
support of value multiplicity in ITagVisitor
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3156
diff
changeset
|
2469 DcmFloatingPointSingle& content = dynamic_cast<DcmFloatingPointSingle&>(element); |
47ef29168698
support of value multiplicity in ITagVisitor
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3156
diff
changeset
|
2470 |
47ef29168698
support of value multiplicity in ITagVisitor
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3156
diff
changeset
|
2471 std::vector<double> values; |
47ef29168698
support of value multiplicity in ITagVisitor
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3156
diff
changeset
|
2472 values.reserve(content.getVM()); |
47ef29168698
support of value multiplicity in ITagVisitor
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3156
diff
changeset
|
2473 |
47ef29168698
support of value multiplicity in ITagVisitor
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3156
diff
changeset
|
2474 for (unsigned long i = 0; i < content.getVM(); i++) |
2499
83b8b6743531
ITagVisitor - for anonymization relationships
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2470
diff
changeset
|
2475 { |
3194
47ef29168698
support of value multiplicity in ITagVisitor
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3156
diff
changeset
|
2476 Float32 f; |
47ef29168698
support of value multiplicity in ITagVisitor
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3156
diff
changeset
|
2477 if (content.getFloat32(f, i).good()) |
47ef29168698
support of value multiplicity in ITagVisitor
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3156
diff
changeset
|
2478 { |
47ef29168698
support of value multiplicity in ITagVisitor
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3156
diff
changeset
|
2479 values.push_back(f); |
47ef29168698
support of value multiplicity in ITagVisitor
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3156
diff
changeset
|
2480 } |
2499
83b8b6743531
ITagVisitor - for anonymization relationships
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2470
diff
changeset
|
2481 } |
83b8b6743531
ITagVisitor - for anonymization relationships
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2470
diff
changeset
|
2482 |
3194
47ef29168698
support of value multiplicity in ITagVisitor
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3156
diff
changeset
|
2483 visitor.VisitDoubles(parentTags, parentIndexes, tag, vr, values); |
2499
83b8b6743531
ITagVisitor - for anonymization relationships
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2470
diff
changeset
|
2484 break; |
83b8b6743531
ITagVisitor - for anonymization relationships
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2470
diff
changeset
|
2485 } |
83b8b6743531
ITagVisitor - for anonymization relationships
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2470
diff
changeset
|
2486 |
83b8b6743531
ITagVisitor - for anonymization relationships
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2470
diff
changeset
|
2487 case EVR_FD: // float double-precision |
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
|
2488 #if DCMTK_VERSION_NUMBER >= 361 |
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
|
2489 case EVR_OD: |
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
|
2490 #endif |
2499
83b8b6743531
ITagVisitor - for anonymization relationships
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2470
diff
changeset
|
2491 { |
3194
47ef29168698
support of value multiplicity in ITagVisitor
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3156
diff
changeset
|
2492 DcmFloatingPointDouble& content = dynamic_cast<DcmFloatingPointDouble&>(element); |
47ef29168698
support of value multiplicity in ITagVisitor
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3156
diff
changeset
|
2493 |
47ef29168698
support of value multiplicity in ITagVisitor
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3156
diff
changeset
|
2494 std::vector<double> values; |
47ef29168698
support of value multiplicity in ITagVisitor
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3156
diff
changeset
|
2495 values.reserve(content.getVM()); |
47ef29168698
support of value multiplicity in ITagVisitor
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3156
diff
changeset
|
2496 |
47ef29168698
support of value multiplicity in ITagVisitor
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3156
diff
changeset
|
2497 for (unsigned long i = 0; i < content.getVM(); i++) |
2499
83b8b6743531
ITagVisitor - for anonymization relationships
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2470
diff
changeset
|
2498 { |
3194
47ef29168698
support of value multiplicity in ITagVisitor
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3156
diff
changeset
|
2499 Float64 f; |
47ef29168698
support of value multiplicity in ITagVisitor
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3156
diff
changeset
|
2500 if (content.getFloat64(f, i).good()) |
47ef29168698
support of value multiplicity in ITagVisitor
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3156
diff
changeset
|
2501 { |
47ef29168698
support of value multiplicity in ITagVisitor
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3156
diff
changeset
|
2502 values.push_back(f); |
47ef29168698
support of value multiplicity in ITagVisitor
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3156
diff
changeset
|
2503 } |
2499
83b8b6743531
ITagVisitor - for anonymization relationships
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2470
diff
changeset
|
2504 } |
83b8b6743531
ITagVisitor - for anonymization relationships
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2470
diff
changeset
|
2505 |
3194
47ef29168698
support of value multiplicity in ITagVisitor
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3156
diff
changeset
|
2506 visitor.VisitDoubles(parentTags, parentIndexes, tag, vr, values); |
2499
83b8b6743531
ITagVisitor - for anonymization relationships
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2470
diff
changeset
|
2507 break; |
83b8b6743531
ITagVisitor - for anonymization relationships
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2470
diff
changeset
|
2508 } |
83b8b6743531
ITagVisitor - for anonymization relationships
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2470
diff
changeset
|
2509 |
83b8b6743531
ITagVisitor - for anonymization relationships
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2470
diff
changeset
|
2510 |
83b8b6743531
ITagVisitor - for anonymization relationships
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2470
diff
changeset
|
2511 /** |
83b8b6743531
ITagVisitor - for anonymization relationships
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2470
diff
changeset
|
2512 * Attribute tag. |
83b8b6743531
ITagVisitor - for anonymization relationships
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2470
diff
changeset
|
2513 **/ |
83b8b6743531
ITagVisitor - for anonymization relationships
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2470
diff
changeset
|
2514 |
83b8b6743531
ITagVisitor - for anonymization relationships
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2470
diff
changeset
|
2515 case EVR_AT: |
83b8b6743531
ITagVisitor - for anonymization relationships
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2470
diff
changeset
|
2516 { |
3194
47ef29168698
support of value multiplicity in ITagVisitor
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3156
diff
changeset
|
2517 DcmAttributeTag& content = dynamic_cast<DcmAttributeTag&>(element); |
47ef29168698
support of value multiplicity in ITagVisitor
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3156
diff
changeset
|
2518 |
47ef29168698
support of value multiplicity in ITagVisitor
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3156
diff
changeset
|
2519 std::vector<DicomTag> values; |
47ef29168698
support of value multiplicity in ITagVisitor
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3156
diff
changeset
|
2520 values.reserve(content.getVM()); |
47ef29168698
support of value multiplicity in ITagVisitor
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3156
diff
changeset
|
2521 |
47ef29168698
support of value multiplicity in ITagVisitor
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3156
diff
changeset
|
2522 for (unsigned long i = 0; i < content.getVM(); i++) |
2499
83b8b6743531
ITagVisitor - for anonymization relationships
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2470
diff
changeset
|
2523 { |
3194
47ef29168698
support of value multiplicity in ITagVisitor
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3156
diff
changeset
|
2524 DcmTagKey f; |
47ef29168698
support of value multiplicity in ITagVisitor
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3156
diff
changeset
|
2525 if (content.getTagVal(f, i).good()) |
47ef29168698
support of value multiplicity in ITagVisitor
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3156
diff
changeset
|
2526 { |
47ef29168698
support of value multiplicity in ITagVisitor
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3156
diff
changeset
|
2527 DicomTag t(f.getGroup(), f.getElement()); |
47ef29168698
support of value multiplicity in ITagVisitor
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3156
diff
changeset
|
2528 values.push_back(t); |
47ef29168698
support of value multiplicity in ITagVisitor
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3156
diff
changeset
|
2529 } |
2499
83b8b6743531
ITagVisitor - for anonymization relationships
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2470
diff
changeset
|
2530 } |
83b8b6743531
ITagVisitor - for anonymization relationships
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2470
diff
changeset
|
2531 |
3195 | 2532 assert(vr == ValueRepresentation_AttributeTag); |
2533 visitor.VisitAttributes(parentTags, parentIndexes, tag, values); | |
2499
83b8b6743531
ITagVisitor - for anonymization relationships
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2470
diff
changeset
|
2534 break; |
83b8b6743531
ITagVisitor - for anonymization relationships
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2470
diff
changeset
|
2535 } |
83b8b6743531
ITagVisitor - for anonymization relationships
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2470
diff
changeset
|
2536 |
83b8b6743531
ITagVisitor - for anonymization relationships
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2470
diff
changeset
|
2537 |
83b8b6743531
ITagVisitor - for anonymization relationships
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2470
diff
changeset
|
2538 /** |
83b8b6743531
ITagVisitor - for anonymization relationships
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2470
diff
changeset
|
2539 * Sequence types, should never occur at this point because of |
83b8b6743531
ITagVisitor - for anonymization relationships
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2470
diff
changeset
|
2540 * "element.isLeaf()". |
83b8b6743531
ITagVisitor - for anonymization relationships
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2470
diff
changeset
|
2541 **/ |
83b8b6743531
ITagVisitor - for anonymization relationships
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2470
diff
changeset
|
2542 |
83b8b6743531
ITagVisitor - for anonymization relationships
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2470
diff
changeset
|
2543 case EVR_SQ: // sequence of items |
3198
7724ed267b5c
unit testing dicomweb conversion
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3195
diff
changeset
|
2544 { |
2499
83b8b6743531
ITagVisitor - for anonymization relationships
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2470
diff
changeset
|
2545 return; |
3198
7724ed267b5c
unit testing dicomweb conversion
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3195
diff
changeset
|
2546 } |
7724ed267b5c
unit testing dicomweb conversion
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3195
diff
changeset
|
2547 |
7724ed267b5c
unit testing dicomweb conversion
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3195
diff
changeset
|
2548 |
7724ed267b5c
unit testing dicomweb conversion
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3195
diff
changeset
|
2549 /** |
7724ed267b5c
unit testing dicomweb conversion
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3195
diff
changeset
|
2550 * Internal to DCMTK. |
7724ed267b5c
unit testing dicomweb conversion
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3195
diff
changeset
|
2551 **/ |
2499
83b8b6743531
ITagVisitor - for anonymization relationships
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2470
diff
changeset
|
2552 |
83b8b6743531
ITagVisitor - for anonymization relationships
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2470
diff
changeset
|
2553 case EVR_xs: // SS or US depending on context |
83b8b6743531
ITagVisitor - for anonymization relationships
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2470
diff
changeset
|
2554 case EVR_lt: // US, SS or OW depending on context, used for LUT Data (thus the name) |
83b8b6743531
ITagVisitor - for anonymization relationships
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2470
diff
changeset
|
2555 case EVR_na: // na="not applicable", for data which has no VR |
83b8b6743531
ITagVisitor - for anonymization relationships
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2470
diff
changeset
|
2556 case EVR_up: // up="unsigned pointer", used internally for DICOMDIR suppor |
83b8b6743531
ITagVisitor - for anonymization relationships
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2470
diff
changeset
|
2557 case EVR_item: // used internally for items |
83b8b6743531
ITagVisitor - for anonymization relationships
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2470
diff
changeset
|
2558 case EVR_metainfo: // used internally for meta info datasets |
83b8b6743531
ITagVisitor - for anonymization relationships
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2470
diff
changeset
|
2559 case EVR_dataset: // used internally for datasets |
83b8b6743531
ITagVisitor - for anonymization relationships
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2470
diff
changeset
|
2560 case EVR_fileFormat: // used internally for DICOM files |
83b8b6743531
ITagVisitor - for anonymization relationships
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2470
diff
changeset
|
2561 case EVR_dicomDir: // used internally for DICOMDIR objects |
83b8b6743531
ITagVisitor - for anonymization relationships
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2470
diff
changeset
|
2562 case EVR_dirRecord: // used internally for DICOMDIR records |
83b8b6743531
ITagVisitor - for anonymization relationships
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2470
diff
changeset
|
2563 case EVR_pixelSQ: // used internally for pixel sequences in a compressed image |
83b8b6743531
ITagVisitor - for anonymization relationships
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2470
diff
changeset
|
2564 case EVR_pixelItem: // used internally for pixel items in a compressed image |
83b8b6743531
ITagVisitor - for anonymization relationships
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2470
diff
changeset
|
2565 case EVR_PixelData: // used internally for uncompressed pixeld data |
83b8b6743531
ITagVisitor - for anonymization relationships
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2470
diff
changeset
|
2566 case EVR_OverlayData: // used internally for overlay data |
3198
7724ed267b5c
unit testing dicomweb conversion
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3195
diff
changeset
|
2567 { |
3195 | 2568 visitor.VisitNotSupported(parentTags, parentIndexes, tag, vr); |
2499
83b8b6743531
ITagVisitor - for anonymization relationships
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2470
diff
changeset
|
2569 return; |
3198
7724ed267b5c
unit testing dicomweb conversion
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3195
diff
changeset
|
2570 } |
7724ed267b5c
unit testing dicomweb conversion
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3195
diff
changeset
|
2571 |
7724ed267b5c
unit testing dicomweb conversion
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3195
diff
changeset
|
2572 |
7724ed267b5c
unit testing dicomweb conversion
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3195
diff
changeset
|
2573 /** |
7724ed267b5c
unit testing dicomweb conversion
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3195
diff
changeset
|
2574 * Default case. |
7724ed267b5c
unit testing dicomweb conversion
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3195
diff
changeset
|
2575 **/ |
2499
83b8b6743531
ITagVisitor - for anonymization relationships
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2470
diff
changeset
|
2576 |
83b8b6743531
ITagVisitor - for anonymization relationships
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2470
diff
changeset
|
2577 default: |
83b8b6743531
ITagVisitor - for anonymization relationships
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2470
diff
changeset
|
2578 return; |
83b8b6743531
ITagVisitor - for anonymization relationships
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2470
diff
changeset
|
2579 } |
83b8b6743531
ITagVisitor - for anonymization relationships
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2470
diff
changeset
|
2580 } |
83b8b6743531
ITagVisitor - for anonymization relationships
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2470
diff
changeset
|
2581 catch (boost::bad_lexical_cast&) |
83b8b6743531
ITagVisitor - for anonymization relationships
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2470
diff
changeset
|
2582 { |
83b8b6743531
ITagVisitor - for anonymization relationships
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2470
diff
changeset
|
2583 return; |
83b8b6743531
ITagVisitor - for anonymization relationships
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2470
diff
changeset
|
2584 } |
83b8b6743531
ITagVisitor - for anonymization relationships
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2470
diff
changeset
|
2585 catch (std::bad_cast&) |
83b8b6743531
ITagVisitor - for anonymization relationships
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2470
diff
changeset
|
2586 { |
83b8b6743531
ITagVisitor - for anonymization relationships
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2470
diff
changeset
|
2587 return; |
83b8b6743531
ITagVisitor - for anonymization relationships
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2470
diff
changeset
|
2588 } |
83b8b6743531
ITagVisitor - for anonymization relationships
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2470
diff
changeset
|
2589 } |
83b8b6743531
ITagVisitor - for anonymization relationships
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2470
diff
changeset
|
2590 |
83b8b6743531
ITagVisitor - for anonymization relationships
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2470
diff
changeset
|
2591 |
83b8b6743531
ITagVisitor - for anonymization relationships
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2470
diff
changeset
|
2592 static void ApplyVisitorToElement(DcmElement& element, |
83b8b6743531
ITagVisitor - for anonymization relationships
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2470
diff
changeset
|
2593 ITagVisitor& visitor, |
83b8b6743531
ITagVisitor - for anonymization relationships
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2470
diff
changeset
|
2594 const std::vector<DicomTag>& parentTags, |
83b8b6743531
ITagVisitor - for anonymization relationships
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2470
diff
changeset
|
2595 const std::vector<size_t>& parentIndexes, |
3217
cf8cbeb35f33
preliminary support of Korean character set
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3209
diff
changeset
|
2596 Encoding encoding, |
cf8cbeb35f33
preliminary support of Korean character set
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3209
diff
changeset
|
2597 bool hasCodeExtensions) |
2499
83b8b6743531
ITagVisitor - for anonymization relationships
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2470
diff
changeset
|
2598 { |
83b8b6743531
ITagVisitor - for anonymization relationships
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2470
diff
changeset
|
2599 assert(parentTags.size() == parentIndexes.size()); |
83b8b6743531
ITagVisitor - for anonymization relationships
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2470
diff
changeset
|
2600 |
83b8b6743531
ITagVisitor - for anonymization relationships
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2470
diff
changeset
|
2601 DicomTag tag(FromDcmtkBridge::Convert(element.getTag())); |
83b8b6743531
ITagVisitor - for anonymization relationships
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2470
diff
changeset
|
2602 |
83b8b6743531
ITagVisitor - for anonymization relationships
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2470
diff
changeset
|
2603 if (element.isLeaf()) |
83b8b6743531
ITagVisitor - for anonymization relationships
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2470
diff
changeset
|
2604 { |
3217
cf8cbeb35f33
preliminary support of Korean character set
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3209
diff
changeset
|
2605 ApplyVisitorToLeaf(element, visitor, parentTags, parentIndexes, tag, encoding, hasCodeExtensions); |
2499
83b8b6743531
ITagVisitor - for anonymization relationships
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2470
diff
changeset
|
2606 } |
83b8b6743531
ITagVisitor - for anonymization relationships
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2470
diff
changeset
|
2607 else |
83b8b6743531
ITagVisitor - for anonymization relationships
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2470
diff
changeset
|
2608 { |
83b8b6743531
ITagVisitor - for anonymization relationships
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2470
diff
changeset
|
2609 // "All subclasses of DcmElement except for DcmSequenceOfItems |
83b8b6743531
ITagVisitor - for anonymization relationships
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2470
diff
changeset
|
2610 // are leaf nodes, while DcmSequenceOfItems, DcmItem, DcmDataset |
83b8b6743531
ITagVisitor - for anonymization relationships
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2470
diff
changeset
|
2611 // etc. are not." The following dynamic_cast is thus OK. |
83b8b6743531
ITagVisitor - for anonymization relationships
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2470
diff
changeset
|
2612 DcmSequenceOfItems& sequence = dynamic_cast<DcmSequenceOfItems&>(element); |
83b8b6743531
ITagVisitor - for anonymization relationships
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2470
diff
changeset
|
2613 |
3195 | 2614 if (sequence.card() == 0) |
2615 { | |
2616 visitor.VisitEmptySequence(parentTags, parentIndexes, tag); | |
2617 } | |
2618 else | |
2499
83b8b6743531
ITagVisitor - for anonymization relationships
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2470
diff
changeset
|
2619 { |
3195 | 2620 std::vector<DicomTag> tags = parentTags; |
2621 std::vector<size_t> indexes = parentIndexes; | |
2622 tags.push_back(tag); | |
2623 indexes.push_back(0); | |
2624 | |
2625 for (unsigned long i = 0; i < sequence.card(); i++) | |
2626 { | |
2627 indexes.back() = static_cast<size_t>(i); | |
2628 DcmItem* child = sequence.getItem(i); | |
3217
cf8cbeb35f33
preliminary support of Korean character set
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3209
diff
changeset
|
2629 ApplyVisitorToDataset(*child, visitor, tags, indexes, encoding, hasCodeExtensions); |
3195 | 2630 } |
2499
83b8b6743531
ITagVisitor - for anonymization relationships
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2470
diff
changeset
|
2631 } |
83b8b6743531
ITagVisitor - for anonymization relationships
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2470
diff
changeset
|
2632 } |
83b8b6743531
ITagVisitor - for anonymization relationships
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2470
diff
changeset
|
2633 } |
83b8b6743531
ITagVisitor - for anonymization relationships
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2470
diff
changeset
|
2634 |
83b8b6743531
ITagVisitor - for anonymization relationships
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2470
diff
changeset
|
2635 |
83b8b6743531
ITagVisitor - for anonymization relationships
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2470
diff
changeset
|
2636 void FromDcmtkBridge::Apply(DcmItem& dataset, |
83b8b6743531
ITagVisitor - for anonymization relationships
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2470
diff
changeset
|
2637 ITagVisitor& visitor, |
83b8b6743531
ITagVisitor - for anonymization relationships
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2470
diff
changeset
|
2638 Encoding defaultEncoding) |
83b8b6743531
ITagVisitor - for anonymization relationships
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2470
diff
changeset
|
2639 { |
83b8b6743531
ITagVisitor - for anonymization relationships
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2470
diff
changeset
|
2640 std::vector<DicomTag> parentTags; |
83b8b6743531
ITagVisitor - for anonymization relationships
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2470
diff
changeset
|
2641 std::vector<size_t> parentIndexes; |
3217
cf8cbeb35f33
preliminary support of Korean character set
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3209
diff
changeset
|
2642 bool hasCodeExtensions; |
cf8cbeb35f33
preliminary support of Korean character set
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3209
diff
changeset
|
2643 Encoding encoding = DetectEncoding(hasCodeExtensions, dataset, defaultEncoding); |
cf8cbeb35f33
preliminary support of Korean character set
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3209
diff
changeset
|
2644 ApplyVisitorToDataset(dataset, visitor, parentTags, parentIndexes, encoding, hasCodeExtensions); |
2499
83b8b6743531
ITagVisitor - for anonymization relationships
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2470
diff
changeset
|
2645 } |
3882
904575738462
implemented IDicomTranscoder::Store()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3881
diff
changeset
|
2646 |
904575738462
implemented IDicomTranscoder::Store()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3881
diff
changeset
|
2647 |
904575738462
implemented IDicomTranscoder::Store()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3881
diff
changeset
|
2648 |
904575738462
implemented IDicomTranscoder::Store()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3881
diff
changeset
|
2649 bool FromDcmtkBridge::LookupOrthancTransferSyntax(DicomTransferSyntax& target, |
904575738462
implemented IDicomTranscoder::Store()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3881
diff
changeset
|
2650 DcmFileFormat& dicom) |
904575738462
implemented IDicomTranscoder::Store()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3881
diff
changeset
|
2651 { |
904575738462
implemented IDicomTranscoder::Store()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3881
diff
changeset
|
2652 if (dicom.getDataset() == NULL) |
904575738462
implemented IDicomTranscoder::Store()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3881
diff
changeset
|
2653 { |
904575738462
implemented IDicomTranscoder::Store()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3881
diff
changeset
|
2654 throw OrthancException(ErrorCode_InternalError); |
904575738462
implemented IDicomTranscoder::Store()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3881
diff
changeset
|
2655 } |
904575738462
implemented IDicomTranscoder::Store()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3881
diff
changeset
|
2656 |
904575738462
implemented IDicomTranscoder::Store()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3881
diff
changeset
|
2657 DcmDataset& dataset = *dicom.getDataset(); |
904575738462
implemented IDicomTranscoder::Store()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3881
diff
changeset
|
2658 |
3883
795c9ca5eb91
DANGEROUS changeset: replaced "getOriginalXfer()" by "getCurrentXfer()" throughout Orthanc
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3882
diff
changeset
|
2659 E_TransferSyntax xfer = dataset.getCurrentXfer(); |
3882
904575738462
implemented IDicomTranscoder::Store()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3881
diff
changeset
|
2660 if (xfer == EXS_Unknown) |
904575738462
implemented IDicomTranscoder::Store()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3881
diff
changeset
|
2661 { |
904575738462
implemented IDicomTranscoder::Store()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3881
diff
changeset
|
2662 dataset.updateOriginalXfer(); |
904575738462
implemented IDicomTranscoder::Store()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3881
diff
changeset
|
2663 xfer = dataset.getOriginalXfer(); |
904575738462
implemented IDicomTranscoder::Store()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3881
diff
changeset
|
2664 if (xfer == EXS_Unknown) |
904575738462
implemented IDicomTranscoder::Store()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3881
diff
changeset
|
2665 { |
904575738462
implemented IDicomTranscoder::Store()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3881
diff
changeset
|
2666 throw OrthancException(ErrorCode_BadFileFormat, |
904575738462
implemented IDicomTranscoder::Store()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3881
diff
changeset
|
2667 "Cannot determine the transfer syntax of the DICOM instance"); |
904575738462
implemented IDicomTranscoder::Store()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3881
diff
changeset
|
2668 } |
904575738462
implemented IDicomTranscoder::Store()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3881
diff
changeset
|
2669 } |
904575738462
implemented IDicomTranscoder::Store()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3881
diff
changeset
|
2670 |
904575738462
implemented IDicomTranscoder::Store()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3881
diff
changeset
|
2671 return FromDcmtkBridge::LookupOrthancTransferSyntax(target, xfer); |
904575738462
implemented IDicomTranscoder::Store()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3881
diff
changeset
|
2672 } |
0 | 2673 } |
3730
ae31ba2b09a6
toolbox: LookupTransferSyntax()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3727
diff
changeset
|
2674 |
ae31ba2b09a6
toolbox: LookupTransferSyntax()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3727
diff
changeset
|
2675 |
ae31ba2b09a6
toolbox: LookupTransferSyntax()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3727
diff
changeset
|
2676 #include "./FromDcmtkBridge_TransferSyntaxes.impl.h" |