comparison OrthancStone/Sources/Toolbox/DicomStructuredReport.cpp @ 2087:51c8b21b81e4

fix
author Sebastien Jodogne <s.jodogne@gmail.com>
date Tue, 07 Nov 2023 18:11:13 +0100
parents 554bc96e7508
children 63d77859edee 7c3d65166c26
comparison
equal deleted inserted replaced
2086:40476d5e0cfd 2087:51c8b21b81e4
31 #include <dcmtk/dcmdata/dcdeftag.h> 31 #include <dcmtk/dcmdata/dcdeftag.h>
32 #include <dcmtk/dcmdata/dcsequen.h> 32 #include <dcmtk/dcmdata/dcsequen.h>
33 #include <dcmtk/dcmdata/dcfilefo.h> 33 #include <dcmtk/dcmdata/dcfilefo.h>
34 34
35 35
36 static std::string FormatTag(const DcmTagKey& key)
37 {
38 OFString s = key.toString();
39 return std::string(s.c_str());
40 }
41
42
36 static std::string GetStringValue(DcmItem& dataset, 43 static std::string GetStringValue(DcmItem& dataset,
37 const DcmTagKey& key) 44 const DcmTagKey& key)
38 { 45 {
39 const char* value = NULL; 46 const char* value = NULL;
40 if (dataset.findAndGetString(key, value).good() && 47 if (dataset.findAndGetString(key, value).good() &&
43 return value; 50 return value;
44 } 51 }
45 else 52 else
46 { 53 {
47 throw Orthanc::OrthancException(Orthanc::ErrorCode_BadFileFormat, 54 throw Orthanc::OrthancException(Orthanc::ErrorCode_BadFileFormat,
48 "Missing tag in DICOM-SR: " + key.toString()); 55 "Missing tag in DICOM-SR: " + FormatTag(key));
49 } 56 }
50 } 57 }
51 58
52 59
53 static DcmSequenceOfItems& GetSequenceValue(DcmItem& dataset, 60 static DcmSequenceOfItems& GetSequenceValue(DcmItem& dataset,
60 return *sequence; 67 return *sequence;
61 } 68 }
62 else 69 else
63 { 70 {
64 throw Orthanc::OrthancException(Orthanc::ErrorCode_BadFileFormat, 71 throw Orthanc::OrthancException(Orthanc::ErrorCode_BadFileFormat,
65 "Missing sequence in DICOM-SR: " + key.toString()); 72 "Missing sequence in DICOM-SR: " + FormatTag(key));
66 } 73 }
67 } 74 }
68 75
69 76
70 static void CheckStringValue(DcmItem& dataset, 77 static void CheckStringValue(DcmItem& dataset,