comparison Core/DicomFormat/DicomMap.cpp @ 1364:111e23bb4904 query-retrieve

integration mainline->query-retrieve
author Sebastien Jodogne <s.jodogne@gmail.com>
date Thu, 21 May 2015 16:58:30 +0200
parents c2c28dd17e87 0649c5aef34a
children 1412ec22ee0b
comparison
equal deleted inserted replaced
953:f894be6e7cc1 1364:111e23bb4904
1 /** 1 /**
2 * Orthanc - A Lightweight, RESTful DICOM Store 2 * Orthanc - A Lightweight, RESTful DICOM Store
3 * Copyright (C) 2012-2014 Medical Physics Department, CHU of Liege, 3 * Copyright (C) 2012-2015 Sebastien Jodogne, Medical Physics
4 * Belgium 4 * Department, University Hospital of Liege, Belgium
5 * 5 *
6 * This program is free software: you can redistribute it and/or 6 * This program is free software: you can redistribute it and/or
7 * modify it under the terms of the GNU General Public License as 7 * modify it under the terms of the GNU General Public License as
8 * published by the Free Software Foundation, either version 3 of the 8 * published by the Free Software Foundation, either version 3 of the
9 * License, or (at your option) any later version. 9 * License, or (at your option) any later version.
34 #include "DicomMap.h" 34 #include "DicomMap.h"
35 35
36 #include <stdio.h> 36 #include <stdio.h>
37 #include <memory> 37 #include <memory>
38 #include "DicomString.h" 38 #include "DicomString.h"
39 #include "DicomArray.h"
39 #include "../OrthancException.h" 40 #include "../OrthancException.h"
40 41
41 42
42 namespace Orthanc 43 namespace Orthanc
43 { 44 {
188 189
189 return result.release(); 190 return result.release();
190 } 191 }
191 192
192 193
194 void DicomMap::Assign(const DicomMap& other)
195 {
196 Clear();
197
198 for (Map::const_iterator it = other.map_.begin(); it != other.map_.end(); ++it)
199 {
200 map_.insert(std::make_pair(it->first, it->second->Clone()));
201 }
202 }
203
204
193 const DicomValue& DicomMap::GetValue(const DicomTag& tag) const 205 const DicomValue& DicomMap::GetValue(const DicomTag& tag) const
194 { 206 {
195 const DicomValue* value = TestAndGetValue(tag); 207 const DicomValue* value = TestAndGetValue(tag);
196 208
197 if (value) 209 if (value)
387 GetMainDicomTagsInternal(result, ResourceType_Series); 399 GetMainDicomTagsInternal(result, ResourceType_Series);
388 GetMainDicomTagsInternal(result, ResourceType_Instance); 400 GetMainDicomTagsInternal(result, ResourceType_Instance);
389 } 401 }
390 402
391 403
392 void DicomMap::ExtractMainDicomTagsForLevel(DicomMap& result, 404 void DicomMap::Print(FILE* fp) const
393 ResourceType level) const 405 {
394 { 406 DicomArray a(*this);
395 switch (level) 407 a.Print(fp);
396 { 408 }
397 case ResourceType_Patient: 409
398 ExtractPatientInformation(result); 410
399 break; 411 void DicomMap::GetTags(std::set<DicomTag>& tags) const
400 412 {
401 case ResourceType_Study: 413 tags.clear();
402 ExtractStudyInformation(result); 414
403 break; 415 for (Map::const_iterator it = map_.begin();
404 416 it != map_.end(); ++it)
405 case ResourceType_Series: 417 {
406 ExtractSeriesInformation(result); 418 tags.insert(it->first);
407 break; 419 }
408 420 }
409 case ResourceType_Instance:
410 ExtractInstanceInformation(result);
411 break;
412
413 default:
414 throw OrthancException(ErrorCode_ParameterOutOfRange);
415 }
416 }
417
418 } 421 }