comparison Framework/DicomToolbox.cpp @ 83:0cb3ac4f9159

refactoring
author Sebastien Jodogne <s.jodogne@gmail.com>
date Thu, 15 Dec 2016 11:51:58 +0100
parents f45cec2c32e2
children ff0ef01c332c
comparison
equal deleted inserted replaced
82:5b127ab0080b 83:0cb3ac4f9159
26 #include "../Resources/Orthanc/Core/Toolbox.h" 26 #include "../Resources/Orthanc/Core/Toolbox.h"
27 27
28 #if ORTHANC_ENABLE_DCMTK == 1 28 #if ORTHANC_ENABLE_DCMTK == 1
29 # include <dcmtk/dcmdata/dcelem.h> 29 # include <dcmtk/dcmdata/dcelem.h>
30 # include <dcmtk/dcmdata/dcsequen.h> 30 # include <dcmtk/dcmdata/dcsequen.h>
31 # include <dcmtk/dcmdata/dcvrat.h>
31 #endif 32 #endif
32 33
33 namespace OrthancWSI 34 namespace OrthancWSI
34 { 35 {
35 namespace DicomToolbox 36 namespace DicomToolbox
64 { 65 {
65 if (!dataset.tagExists(key) && 66 if (!dataset.tagExists(key) &&
66 !dataset.putAndInsertUint32(key, value).good()) 67 !dataset.putAndInsertUint32(key, value).good())
67 { 68 {
68 throw Orthanc::OrthancException(Orthanc::ErrorCode_InternalError); 69 throw Orthanc::OrthancException(Orthanc::ErrorCode_InternalError);
70 }
71 }
72
73
74 void SetAttributeTag(DcmItem& dataset,
75 const DcmTagKey& key,
76 const DcmTagKey& value)
77 {
78 if (!dataset.tagExists(key))
79 {
80 std::auto_ptr<DcmAttributeTag> tag(new DcmAttributeTag(key));
81
82 if (!tag->putTagVal(value).good() ||
83 !dataset.insert(tag.release()).good())
84 {
85 throw Orthanc::OrthancException(Orthanc::ErrorCode_InternalError);
86 }
69 } 87 }
70 } 88 }
71 89
72 90
73 DcmItem* ExtractSingleSequenceItem(DcmItem& dataset, 91 DcmItem* ExtractSingleSequenceItem(DcmItem& dataset,