Mercurial > hg > orthanc
comparison Core/DicomNetworking/DicomFindAnswers.cpp @ 3158:b6e7714c3fe6
Don't return tags whose group is below 0x0008 in C-FIND SCP
author | Sebastien Jodogne <s.jodogne@gmail.com> |
---|---|
date | Wed, 23 Jan 2019 14:23:10 +0100 |
parents | 4e43e67f8ecf |
children | 9b0e67161600 |
comparison
equal
deleted
inserted
replaced
3157:8a9eb767280c | 3158:b6e7714c3fe6 |
---|---|
148 } | 148 } |
149 | 149 |
150 | 150 |
151 DcmDataset* DicomFindAnswers::ExtractDcmDataset(size_t index) const | 151 DcmDataset* DicomFindAnswers::ExtractDcmDataset(size_t index) const |
152 { | 152 { |
153 return new DcmDataset(*GetAnswer(index).GetDcmtkObject().getDataset()); | 153 // As "DicomFindAnswers" stores its content using class |
154 // "ParsedDicomFile" (that internally uses "DcmFileFormat" from | |
155 // DCMTK), the dataset can contain tags that are reserved if | |
156 // storing the media on the disk, notably tag | |
157 // "MediaStorageSOPClassUID" (0002,0002). In this function, we | |
158 // remove all those tags whose group is below 0x0008. The | |
159 // resulting data set is clean for emission in the C-FIND SCP. | |
160 | |
161 // http://dicom.nema.org/medical/dicom/current/output/chtml/part04/sect_C.4.html#sect_C.4.1.1.3 | |
162 // https://groups.google.com/d/msg/orthanc-users/D3kpPuX8yV0/_zgHOzkMEQAJ | |
163 | |
164 DcmDataset& source = *GetAnswer(index).GetDcmtkObject().getDataset(); | |
165 | |
166 std::auto_ptr<DcmDataset> target(new DcmDataset); | |
167 | |
168 for (unsigned long i = 0; i < source.card(); i++) | |
169 { | |
170 const DcmElement* element = source.getElement(i); | |
171 assert(element != NULL); | |
172 | |
173 if (element != NULL && | |
174 element->getTag().getGroup() >= 0x0008 && | |
175 element->getTag().getElement() != 0x0000) | |
176 { | |
177 target->insert(dynamic_cast<DcmElement*>(element->clone())); | |
178 } | |
179 } | |
180 | |
181 return target.release(); | |
154 } | 182 } |
155 | 183 |
156 | 184 |
157 void DicomFindAnswers::ToJson(Json::Value& target, | 185 void DicomFindAnswers::ToJson(Json::Value& target, |
158 size_t index, | 186 size_t index, |