Mercurial > hg > orthanc
annotate Core/DicomNetworking/DicomFindAnswers.cpp @ 3634:103ee029982e storage-commitment
integration default->storage-commitment
author | Sebastien Jodogne <s.jodogne@gmail.com> |
---|---|
date | Wed, 29 Jan 2020 08:51:31 +0100 |
parents | 9b0e67161600 |
children | 94f4a18a79cc |
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:
831
diff
changeset
|
4 * Department, University Hospital of Liege, Belgium |
3060
4e43e67f8ecf
preparing for 2019
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2521
diff
changeset
|
5 * Copyright (C) 2017-2019 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 | |
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" |
0 | 35 #include "DicomFindAnswers.h" |
36 | |
2382
7284093111b0
big reorganization to cleanly separate framework vs. server
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2381
diff
changeset
|
37 #include "../DicomParsing/FromDcmtkBridge.h" |
7284093111b0
big reorganization to cleanly separate framework vs. server
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2381
diff
changeset
|
38 #include "../OrthancException.h" |
1787
1b1d5470233f
refactoring of DicomFindAnswers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1368
diff
changeset
|
39 |
1b1d5470233f
refactoring of DicomFindAnswers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1368
diff
changeset
|
40 #include <memory> |
1789 | 41 #include <dcmtk/dcmdata/dcfilefo.h> |
1847 | 42 #include <boost/noncopyable.hpp> |
1789 | 43 |
0 | 44 |
62 | 45 namespace Orthanc |
0 | 46 { |
2207
6dc3bdb4088b
Fix handling of encodings in C-FIND for worklists
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2202
diff
changeset
|
47 void DicomFindAnswers::AddAnswerInternal(ParsedDicomFile* answer) |
1789 | 48 { |
2207
6dc3bdb4088b
Fix handling of encodings in C-FIND for worklists
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2202
diff
changeset
|
49 std::auto_ptr<ParsedDicomFile> protection(answer); |
1797
23722a191e4e
worklists are working
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1789
diff
changeset
|
50 |
2207
6dc3bdb4088b
Fix handling of encodings in C-FIND for worklists
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2202
diff
changeset
|
51 if (isWorklist_) |
1797
23722a191e4e
worklists are working
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1789
diff
changeset
|
52 { |
2207
6dc3bdb4088b
Fix handling of encodings in C-FIND for worklists
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2202
diff
changeset
|
53 // These lines are necessary when serving worklists, otherwise |
6dc3bdb4088b
Fix handling of encodings in C-FIND for worklists
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2202
diff
changeset
|
54 // Orthanc does not behave as "wlmscpfs" |
6dc3bdb4088b
Fix handling of encodings in C-FIND for worklists
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2202
diff
changeset
|
55 protection->Remove(DICOM_TAG_MEDIA_STORAGE_SOP_INSTANCE_UID); |
6dc3bdb4088b
Fix handling of encodings in C-FIND for worklists
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2202
diff
changeset
|
56 protection->Remove(DICOM_TAG_SOP_INSTANCE_UID); |
1789 | 57 } |
58 | |
2207
6dc3bdb4088b
Fix handling of encodings in C-FIND for worklists
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2202
diff
changeset
|
59 protection->ChangeEncoding(encoding_); |
6dc3bdb4088b
Fix handling of encodings in C-FIND for worklists
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2202
diff
changeset
|
60 |
6dc3bdb4088b
Fix handling of encodings in C-FIND for worklists
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2202
diff
changeset
|
61 answers_.push_back(protection.release()); |
6dc3bdb4088b
Fix handling of encodings in C-FIND for worklists
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2202
diff
changeset
|
62 } |
6dc3bdb4088b
Fix handling of encodings in C-FIND for worklists
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2202
diff
changeset
|
63 |
6dc3bdb4088b
Fix handling of encodings in C-FIND for worklists
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2202
diff
changeset
|
64 |
6dc3bdb4088b
Fix handling of encodings in C-FIND for worklists
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2202
diff
changeset
|
65 DicomFindAnswers::DicomFindAnswers(bool isWorklist) : |
2381
b8969010b534
uncoupling DCMTK primitives from Orthanc::Configuration
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2244
diff
changeset
|
66 encoding_(GetDefaultDicomEncoding()), |
2207
6dc3bdb4088b
Fix handling of encodings in C-FIND for worklists
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2202
diff
changeset
|
67 isWorklist_(isWorklist), |
6dc3bdb4088b
Fix handling of encodings in C-FIND for worklists
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2202
diff
changeset
|
68 complete_(true) |
6dc3bdb4088b
Fix handling of encodings in C-FIND for worklists
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2202
diff
changeset
|
69 { |
6dc3bdb4088b
Fix handling of encodings in C-FIND for worklists
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2202
diff
changeset
|
70 } |
6dc3bdb4088b
Fix handling of encodings in C-FIND for worklists
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2202
diff
changeset
|
71 |
6dc3bdb4088b
Fix handling of encodings in C-FIND for worklists
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2202
diff
changeset
|
72 |
6dc3bdb4088b
Fix handling of encodings in C-FIND for worklists
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2202
diff
changeset
|
73 void DicomFindAnswers::SetEncoding(Encoding encoding) |
6dc3bdb4088b
Fix handling of encodings in C-FIND for worklists
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2202
diff
changeset
|
74 { |
6dc3bdb4088b
Fix handling of encodings in C-FIND for worklists
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2202
diff
changeset
|
75 for (size_t i = 0; i < answers_.size(); i++) |
1789 | 76 { |
2207
6dc3bdb4088b
Fix handling of encodings in C-FIND for worklists
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2202
diff
changeset
|
77 assert(answers_[i] != NULL); |
6dc3bdb4088b
Fix handling of encodings in C-FIND for worklists
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2202
diff
changeset
|
78 answers_[i]->ChangeEncoding(encoding); |
1789 | 79 } |
80 | |
2207
6dc3bdb4088b
Fix handling of encodings in C-FIND for worklists
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2202
diff
changeset
|
81 encoding_ = encoding; |
6dc3bdb4088b
Fix handling of encodings in C-FIND for worklists
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2202
diff
changeset
|
82 } |
1789 | 83 |
84 | |
2059 | 85 void DicomFindAnswers::SetWorklist(bool isWorklist) |
86 { | |
87 if (answers_.empty()) | |
88 { | |
89 isWorklist_ = isWorklist; | |
90 } | |
91 else | |
92 { | |
93 // This set of answers is not empty anymore, cannot change its type | |
94 throw OrthancException(ErrorCode_BadSequenceOfCalls); | |
95 } | |
96 } | |
97 | |
98 | |
0 | 99 void DicomFindAnswers::Clear() |
100 { | |
1789 | 101 for (size_t i = 0; i < answers_.size(); i++) |
0 | 102 { |
1789 | 103 assert(answers_[i] != NULL); |
104 delete answers_[i]; | |
0 | 105 } |
1787
1b1d5470233f
refactoring of DicomFindAnswers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1368
diff
changeset
|
106 |
1789 | 107 answers_.clear(); |
0 | 108 } |
109 | |
1789 | 110 |
0 | 111 void DicomFindAnswers::Reserve(size_t size) |
112 { | |
1789 | 113 if (size > answers_.size()) |
0 | 114 { |
1789 | 115 answers_.reserve(size); |
0 | 116 } |
117 } | |
118 | |
1787
1b1d5470233f
refactoring of DicomFindAnswers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1368
diff
changeset
|
119 |
1b1d5470233f
refactoring of DicomFindAnswers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1368
diff
changeset
|
120 void DicomFindAnswers::Add(const DicomMap& map) |
1b1d5470233f
refactoring of DicomFindAnswers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1368
diff
changeset
|
121 { |
3276
9b0e67161600
More tolerance wrt. invalid DICOM files that must be returned by Orthanc C-FIND SCP
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3158
diff
changeset
|
122 // We use the permissive mode to be tolerant wrt. invalid DICOM |
9b0e67161600
More tolerance wrt. invalid DICOM files that must be returned by Orthanc C-FIND SCP
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3158
diff
changeset
|
123 // files that contain some tags with out-of-range values (such |
9b0e67161600
More tolerance wrt. invalid DICOM files that must be returned by Orthanc C-FIND SCP
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3158
diff
changeset
|
124 // tags are removed from the answers) |
9b0e67161600
More tolerance wrt. invalid DICOM files that must be returned by Orthanc C-FIND SCP
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3158
diff
changeset
|
125 AddAnswerInternal(new ParsedDicomFile(map, encoding_, true /* permissive */)); |
1787
1b1d5470233f
refactoring of DicomFindAnswers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1368
diff
changeset
|
126 } |
1b1d5470233f
refactoring of DicomFindAnswers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1368
diff
changeset
|
127 |
1789 | 128 |
1787
1b1d5470233f
refactoring of DicomFindAnswers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1368
diff
changeset
|
129 void DicomFindAnswers::Add(ParsedDicomFile& dicom) |
1b1d5470233f
refactoring of DicomFindAnswers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1368
diff
changeset
|
130 { |
2521
6db878376018
support anonymization of CurrentRequestedProcedureEvidenceSequence
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2447
diff
changeset
|
131 AddAnswerInternal(dicom.Clone(true)); |
1787
1b1d5470233f
refactoring of DicomFindAnswers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1368
diff
changeset
|
132 } |
1b1d5470233f
refactoring of DicomFindAnswers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1368
diff
changeset
|
133 |
1995
f0acfa753973
New callback to handle non-worklists C-Find requests: OrthancPluginRegisterCFindCallback()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1900
diff
changeset
|
134 void DicomFindAnswers::Add(const void* dicom, |
1787
1b1d5470233f
refactoring of DicomFindAnswers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1368
diff
changeset
|
135 size_t size) |
1b1d5470233f
refactoring of DicomFindAnswers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1368
diff
changeset
|
136 { |
2207
6dc3bdb4088b
Fix handling of encodings in C-FIND for worklists
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2202
diff
changeset
|
137 AddAnswerInternal(new ParsedDicomFile(dicom, size)); |
1789 | 138 } |
139 | |
140 | |
2207
6dc3bdb4088b
Fix handling of encodings in C-FIND for worklists
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2202
diff
changeset
|
141 ParsedDicomFile& DicomFindAnswers::GetAnswer(size_t index) const |
1789 | 142 { |
143 if (index < answers_.size()) | |
144 { | |
2207
6dc3bdb4088b
Fix handling of encodings in C-FIND for worklists
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2202
diff
changeset
|
145 return *answers_[index]; |
1789 | 146 } |
147 else | |
148 { | |
149 throw OrthancException(ErrorCode_ParameterOutOfRange); | |
150 } | |
1787
1b1d5470233f
refactoring of DicomFindAnswers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1368
diff
changeset
|
151 } |
1b1d5470233f
refactoring of DicomFindAnswers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1368
diff
changeset
|
152 |
1b1d5470233f
refactoring of DicomFindAnswers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1368
diff
changeset
|
153 |
1789 | 154 DcmDataset* DicomFindAnswers::ExtractDcmDataset(size_t index) const |
155 { | |
3158
b6e7714c3fe6
Don't return tags whose group is below 0x0008 in C-FIND SCP
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3060
diff
changeset
|
156 // As "DicomFindAnswers" stores its content using class |
b6e7714c3fe6
Don't return tags whose group is below 0x0008 in C-FIND SCP
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3060
diff
changeset
|
157 // "ParsedDicomFile" (that internally uses "DcmFileFormat" from |
b6e7714c3fe6
Don't return tags whose group is below 0x0008 in C-FIND SCP
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3060
diff
changeset
|
158 // DCMTK), the dataset can contain tags that are reserved if |
b6e7714c3fe6
Don't return tags whose group is below 0x0008 in C-FIND SCP
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3060
diff
changeset
|
159 // storing the media on the disk, notably tag |
b6e7714c3fe6
Don't return tags whose group is below 0x0008 in C-FIND SCP
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3060
diff
changeset
|
160 // "MediaStorageSOPClassUID" (0002,0002). In this function, we |
b6e7714c3fe6
Don't return tags whose group is below 0x0008 in C-FIND SCP
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3060
diff
changeset
|
161 // remove all those tags whose group is below 0x0008. The |
b6e7714c3fe6
Don't return tags whose group is below 0x0008 in C-FIND SCP
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3060
diff
changeset
|
162 // resulting data set is clean for emission in the C-FIND SCP. |
b6e7714c3fe6
Don't return tags whose group is below 0x0008 in C-FIND SCP
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3060
diff
changeset
|
163 |
b6e7714c3fe6
Don't return tags whose group is below 0x0008 in C-FIND SCP
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3060
diff
changeset
|
164 // http://dicom.nema.org/medical/dicom/current/output/chtml/part04/sect_C.4.html#sect_C.4.1.1.3 |
b6e7714c3fe6
Don't return tags whose group is below 0x0008 in C-FIND SCP
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3060
diff
changeset
|
165 // https://groups.google.com/d/msg/orthanc-users/D3kpPuX8yV0/_zgHOzkMEQAJ |
b6e7714c3fe6
Don't return tags whose group is below 0x0008 in C-FIND SCP
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3060
diff
changeset
|
166 |
b6e7714c3fe6
Don't return tags whose group is below 0x0008 in C-FIND SCP
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3060
diff
changeset
|
167 DcmDataset& source = *GetAnswer(index).GetDcmtkObject().getDataset(); |
b6e7714c3fe6
Don't return tags whose group is below 0x0008 in C-FIND SCP
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3060
diff
changeset
|
168 |
b6e7714c3fe6
Don't return tags whose group is below 0x0008 in C-FIND SCP
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3060
diff
changeset
|
169 std::auto_ptr<DcmDataset> target(new DcmDataset); |
b6e7714c3fe6
Don't return tags whose group is below 0x0008 in C-FIND SCP
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3060
diff
changeset
|
170 |
b6e7714c3fe6
Don't return tags whose group is below 0x0008 in C-FIND SCP
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3060
diff
changeset
|
171 for (unsigned long i = 0; i < source.card(); i++) |
b6e7714c3fe6
Don't return tags whose group is below 0x0008 in C-FIND SCP
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3060
diff
changeset
|
172 { |
b6e7714c3fe6
Don't return tags whose group is below 0x0008 in C-FIND SCP
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3060
diff
changeset
|
173 const DcmElement* element = source.getElement(i); |
b6e7714c3fe6
Don't return tags whose group is below 0x0008 in C-FIND SCP
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3060
diff
changeset
|
174 assert(element != NULL); |
b6e7714c3fe6
Don't return tags whose group is below 0x0008 in C-FIND SCP
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3060
diff
changeset
|
175 |
b6e7714c3fe6
Don't return tags whose group is below 0x0008 in C-FIND SCP
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3060
diff
changeset
|
176 if (element != NULL && |
b6e7714c3fe6
Don't return tags whose group is below 0x0008 in C-FIND SCP
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3060
diff
changeset
|
177 element->getTag().getGroup() >= 0x0008 && |
b6e7714c3fe6
Don't return tags whose group is below 0x0008 in C-FIND SCP
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3060
diff
changeset
|
178 element->getTag().getElement() != 0x0000) |
b6e7714c3fe6
Don't return tags whose group is below 0x0008 in C-FIND SCP
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3060
diff
changeset
|
179 { |
b6e7714c3fe6
Don't return tags whose group is below 0x0008 in C-FIND SCP
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3060
diff
changeset
|
180 target->insert(dynamic_cast<DcmElement*>(element->clone())); |
b6e7714c3fe6
Don't return tags whose group is below 0x0008 in C-FIND SCP
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3060
diff
changeset
|
181 } |
b6e7714c3fe6
Don't return tags whose group is below 0x0008 in C-FIND SCP
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3060
diff
changeset
|
182 } |
b6e7714c3fe6
Don't return tags whose group is below 0x0008 in C-FIND SCP
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3060
diff
changeset
|
183 |
b6e7714c3fe6
Don't return tags whose group is below 0x0008 in C-FIND SCP
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3060
diff
changeset
|
184 return target.release(); |
1787
1b1d5470233f
refactoring of DicomFindAnswers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1368
diff
changeset
|
185 } |
1b1d5470233f
refactoring of DicomFindAnswers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1368
diff
changeset
|
186 |
1b1d5470233f
refactoring of DicomFindAnswers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1368
diff
changeset
|
187 |
1b1d5470233f
refactoring of DicomFindAnswers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1368
diff
changeset
|
188 void DicomFindAnswers::ToJson(Json::Value& target, |
1b1d5470233f
refactoring of DicomFindAnswers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1368
diff
changeset
|
189 size_t index, |
1b1d5470233f
refactoring of DicomFindAnswers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1368
diff
changeset
|
190 bool simplify) const |
1b1d5470233f
refactoring of DicomFindAnswers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1368
diff
changeset
|
191 { |
1860
c7d70f659190
DicomToJsonFormat_Simple -> DicomToJsonFormat_Human
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1847
diff
changeset
|
192 DicomToJsonFormat format = (simplify ? DicomToJsonFormat_Human : DicomToJsonFormat_Full); |
2128
9329ba17a069
Possibility to DELETE "dicom-as-json" attachments to reconstruct them
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2059
diff
changeset
|
193 GetAnswer(index).DatasetToJson(target, format, DicomToJsonFlags_None, 0); |
1787
1b1d5470233f
refactoring of DicomFindAnswers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1368
diff
changeset
|
194 } |
1b1d5470233f
refactoring of DicomFindAnswers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1368
diff
changeset
|
195 |
1b1d5470233f
refactoring of DicomFindAnswers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1368
diff
changeset
|
196 |
1368 | 197 void DicomFindAnswers::ToJson(Json::Value& target, |
198 bool simplify) const | |
0 | 199 { |
200 target = Json::arrayValue; | |
201 | |
202 for (size_t i = 0; i < GetSize(); i++) | |
203 { | |
1787
1b1d5470233f
refactoring of DicomFindAnswers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1368
diff
changeset
|
204 Json::Value answer; |
1b1d5470233f
refactoring of DicomFindAnswers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1368
diff
changeset
|
205 ToJson(answer, i, simplify); |
0 | 206 target.append(answer); |
207 } | |
208 } | |
209 } |