Mercurial > hg > orthanc-wsi
comparison Framework/Inputs/DicomPyramidInstance.cpp @ 213:2a4e1f7de5ab
remove calls to deprecated classes of JsonCpp
author | Sebastien Jodogne <s.jodogne@gmail.com> |
---|---|
date | Tue, 22 Dec 2020 09:28:30 +0100 |
parents | b0bd22077cd8 |
children | 1e864138f0da |
comparison
equal
deleted
inserted
replaced
212:f1ea48f92d66 | 213:2a4e1f7de5ab |
---|---|
29 #include <Logging.h> | 29 #include <Logging.h> |
30 #include <OrthancException.h> | 30 #include <OrthancException.h> |
31 #include <Toolbox.h> | 31 #include <Toolbox.h> |
32 | 32 |
33 #include <cassert> | 33 #include <cassert> |
34 #include <json/writer.h> | |
35 | 34 |
36 #define SERIALIZED_METADATA "4200" | 35 #define SERIALIZED_METADATA "4200" |
37 | 36 |
38 | 37 |
39 namespace OrthancWSI | 38 namespace OrthancWSI |
52 | 51 |
53 FullOrthancDataset dataset(orthanc, "/instances/" + instanceId + "/header"); | 52 FullOrthancDataset dataset(orthanc, "/instances/" + instanceId + "/header"); |
54 DicomDatasetReader header(dataset); | 53 DicomDatasetReader header(dataset); |
55 | 54 |
56 std::string s = Orthanc::Toolbox::StripSpaces | 55 std::string s = Orthanc::Toolbox::StripSpaces |
57 (header.GetMandatoryStringValue(Orthanc::DICOM_TAG_TRANSFER_SYNTAX_UID)); | 56 (header.GetMandatoryStringValue(OrthancStone::DicomPath(Orthanc::DICOM_TAG_TRANSFER_SYNTAX_UID))); |
58 | 57 |
59 if (s == "1.2.840.10008.1.2" || | 58 if (s == "1.2.840.10008.1.2" || |
60 s == "1.2.840.10008.1.2.1") | 59 s == "1.2.840.10008.1.2.1") |
61 { | 60 { |
62 return ImageCompression_None; | 61 return ImageCompression_None; |
83 OrthancStone::DicomDatasetReader& reader) | 82 OrthancStone::DicomDatasetReader& reader) |
84 { | 83 { |
85 using namespace OrthancStone; | 84 using namespace OrthancStone; |
86 | 85 |
87 std::string p = Orthanc::Toolbox::StripSpaces | 86 std::string p = Orthanc::Toolbox::StripSpaces |
88 (reader.GetMandatoryStringValue(Orthanc::DICOM_TAG_PHOTOMETRIC_INTERPRETATION)); | 87 (reader.GetMandatoryStringValue(OrthancStone::DicomPath(Orthanc::DICOM_TAG_PHOTOMETRIC_INTERPRETATION))); |
89 | 88 |
90 photometric = Orthanc::StringToPhotometricInterpretation(p.c_str()); | 89 photometric = Orthanc::StringToPhotometricInterpretation(p.c_str()); |
91 | 90 |
92 if (photometric == Orthanc::PhotometricInterpretation_Palette) | 91 if (photometric == Orthanc::PhotometricInterpretation_Palette) |
93 { | 92 { |
95 "Unsupported photometric interpretation: " + p); | 94 "Unsupported photometric interpretation: " + p); |
96 } | 95 } |
97 | 96 |
98 unsigned int bitsStored, samplesPerPixel, tmp; | 97 unsigned int bitsStored, samplesPerPixel, tmp; |
99 | 98 |
100 if (!reader.GetUnsignedIntegerValue(bitsStored, Orthanc::DICOM_TAG_BITS_STORED) || | 99 if (!reader.GetUnsignedIntegerValue(bitsStored, OrthancStone::DicomPath(Orthanc::DICOM_TAG_BITS_STORED)) || |
101 !reader.GetUnsignedIntegerValue(samplesPerPixel, Orthanc::DICOM_TAG_SAMPLES_PER_PIXEL) || | 100 !reader.GetUnsignedIntegerValue(samplesPerPixel, OrthancStone::DicomPath(Orthanc::DICOM_TAG_SAMPLES_PER_PIXEL)) || |
102 !reader.GetUnsignedIntegerValue(tmp, Orthanc::DICOM_TAG_PIXEL_REPRESENTATION)) | 101 !reader.GetUnsignedIntegerValue(tmp, OrthancStone::DicomPath(Orthanc::DICOM_TAG_PIXEL_REPRESENTATION))) |
103 { | 102 { |
104 throw Orthanc::OrthancException(Orthanc::ErrorCode_InexistentTag); | 103 throw Orthanc::OrthancException(Orthanc::ErrorCode_InexistentTag); |
105 } | 104 } |
106 | 105 |
107 bool isSigned = (tmp != 0); | 106 bool isSigned = (tmp != 0); |
152 using namespace OrthancStone; | 151 using namespace OrthancStone; |
153 | 152 |
154 FullOrthancDataset dataset(orthanc, "/instances/" + instanceId + "/tags"); | 153 FullOrthancDataset dataset(orthanc, "/instances/" + instanceId + "/tags"); |
155 DicomDatasetReader reader(dataset); | 154 DicomDatasetReader reader(dataset); |
156 | 155 |
157 if (reader.GetMandatoryStringValue(Orthanc::DICOM_TAG_SOP_CLASS_UID) != "1.2.840.10008.5.1.4.1.1.77.1.6" || | 156 if (reader.GetMandatoryStringValue(OrthancStone::DicomPath(Orthanc::DICOM_TAG_SOP_CLASS_UID)) != "1.2.840.10008.5.1.4.1.1.77.1.6" || |
158 reader.GetMandatoryStringValue(Orthanc::DICOM_TAG_MODALITY) != "SM") | 157 reader.GetMandatoryStringValue(OrthancStone::DicomPath(Orthanc::DICOM_TAG_MODALITY)) != "SM") |
159 { | 158 { |
160 throw Orthanc::OrthancException(Orthanc::ErrorCode_ParameterOutOfRange); | 159 throw Orthanc::OrthancException(Orthanc::ErrorCode_ParameterOutOfRange); |
161 } | 160 } |
162 | 161 |
163 hasCompression_ = false; | 162 hasCompression_ = false; |
164 DetectPixelFormat(format_, photometric_, reader); | 163 DetectPixelFormat(format_, photometric_, reader); |
165 | 164 |
166 unsigned int tmp; | 165 unsigned int tmp; |
167 if (!reader.GetUnsignedIntegerValue(tileWidth_, Orthanc::DICOM_TAG_COLUMNS) || | 166 if (!reader.GetUnsignedIntegerValue(tileWidth_, OrthancStone::DicomPath(Orthanc::DICOM_TAG_COLUMNS)) || |
168 !reader.GetUnsignedIntegerValue(tileHeight_, Orthanc::DICOM_TAG_ROWS) || | 167 !reader.GetUnsignedIntegerValue(tileHeight_, OrthancStone::DicomPath(Orthanc::DICOM_TAG_ROWS)) || |
169 !reader.GetUnsignedIntegerValue(totalWidth_, DICOM_TAG_TOTAL_PIXEL_MATRIX_COLUMNS) || | 168 !reader.GetUnsignedIntegerValue(totalWidth_, OrthancStone::DicomPath(DICOM_TAG_TOTAL_PIXEL_MATRIX_COLUMNS)) || |
170 !reader.GetUnsignedIntegerValue(totalHeight_, DICOM_TAG_TOTAL_PIXEL_MATRIX_ROWS) || | 169 !reader.GetUnsignedIntegerValue(totalHeight_, OrthancStone::DicomPath(DICOM_TAG_TOTAL_PIXEL_MATRIX_ROWS)) || |
171 !reader.GetUnsignedIntegerValue(tmp, Orthanc::DICOM_TAG_NUMBER_OF_FRAMES)) | 170 !reader.GetUnsignedIntegerValue(tmp, OrthancStone::DicomPath(Orthanc::DICOM_TAG_NUMBER_OF_FRAMES))) |
172 { | 171 { |
173 throw Orthanc::OrthancException(Orthanc::ErrorCode_BadFileFormat); | 172 throw Orthanc::OrthancException(Orthanc::ErrorCode_BadFileFormat); |
174 } | 173 } |
175 | 174 |
176 size_t countFrames; | 175 size_t countFrames; |
177 if (!reader.GetDataset().GetSequenceSize(countFrames, DICOM_TAG_PER_FRAME_FUNCTIONAL_GROUPS_SEQUENCE)) | 176 if (!reader.GetDataset().GetSequenceSize(countFrames, OrthancStone::DicomPath(DICOM_TAG_PER_FRAME_FUNCTIONAL_GROUPS_SEQUENCE))) |
178 { | 177 { |
179 throw Orthanc::OrthancException(Orthanc::ErrorCode_BadFileFormat); | 178 throw Orthanc::OrthancException(Orthanc::ErrorCode_BadFileFormat); |
180 } | 179 } |
181 | 180 |
182 if (countFrames != tmp) | 181 if (countFrames != tmp) |
309 | 308 |
310 default: | 309 default: |
311 throw Orthanc::OrthancException(Orthanc::ErrorCode_NotImplemented); | 310 throw Orthanc::OrthancException(Orthanc::ErrorCode_NotImplemented); |
312 } | 311 } |
313 | 312 |
314 Json::FastWriter writer; | 313 Orthanc::Toolbox::WriteFastJson(result, content); |
315 result = writer.write(content); | |
316 } | 314 } |
317 | 315 |
318 | 316 |
319 void DicomPyramidInstance::Deserialize(const std::string& s) | 317 void DicomPyramidInstance::Deserialize(const std::string& s) |
320 { | 318 { |