comparison OrthancServer/Sources/DicomInstanceToStore.cpp @ 4507:b4c58795f3a8

widening the use of DicomTransferSyntax enum
author Sebastien Jodogne <s.jodogne@gmail.com>
date Thu, 11 Feb 2021 09:33:48 +0100
parents ac69c9f76c71
children 8f9090b137f1
comparison
equal deleted inserted replaced
4506:ac69c9f76c71 4507:b4c58795f3a8
265 return bufferSize_; 265 return bufferSize_;
266 } 266 }
267 } 267 }
268 268
269 269
270 bool LookupTransferSyntax(std::string& result) 270 bool LookupTransferSyntax(DicomTransferSyntax& result)
271 { 271 {
272 DicomMap header; 272 DicomMap header;
273 if (DicomMap::ParseDicomMetaInformation(header, GetBufferData(), GetBufferSize())) 273 if (DicomMap::ParseDicomMetaInformation(header, GetBufferData(), GetBufferSize()))
274 { 274 {
275 const DicomValue* value = header.TestAndGetValue(DICOM_TAG_TRANSFER_SYNTAX_UID); 275 const DicomValue* value = header.TestAndGetValue(DICOM_TAG_TRANSFER_SYNTAX_UID);
276 if (value != NULL && 276 if (value != NULL &&
277 !value->IsBinary() && 277 !value->IsBinary() &&
278 !value->IsNull()) 278 !value->IsNull())
279 { 279 {
280 result = Toolbox::StripSpaces(value->GetContent()); 280 return ::Orthanc::LookupTransferSyntax(result, Toolbox::StripSpaces(value->GetContent()));
281 return true;
282 } 281 }
283 } 282 }
284 else 283 else
285 { 284 {
286 // This is a DICOM file without a proper meta-header. Fallback 285 // This is a DICOM file without a proper meta-header. Fallback
287 // to DCMTK, which will fully parse the dataset to retrieve 286 // to DCMTK, which will fully parse the dataset to retrieve
288 // the transfer syntax. Added in Orthanc 1.8.2. 287 // the transfer syntax. Added in Orthanc 1.8.2.
289 std::string transferSyntax; 288 return GetParsedDicomFile().LookupTransferSyntax(result);
290 if (GetParsedDicomFile().LookupTransferSyntax(transferSyntax))
291 {
292 result = Toolbox::StripSpaces(transferSyntax);
293 return true;
294 }
295 } 289 }
296 290
297 return false; 291 return false;
298 } 292 }
299 293
375 { 369 {
376 return const_cast<PImpl&>(*pimpl_).GetBufferSize(); 370 return const_cast<PImpl&>(*pimpl_).GetBufferSize();
377 } 371 }
378 372
379 373
380 bool DicomInstanceToStore::LookupTransferSyntax(std::string& result) const 374 bool DicomInstanceToStore::LookupTransferSyntax(DicomTransferSyntax& result) const
381 { 375 {
382 return const_cast<PImpl&>(*pimpl_).LookupTransferSyntax(result); 376 return const_cast<PImpl&>(*pimpl_).LookupTransferSyntax(result);
383 } 377 }
384 378
385 379
390 384
391 ParsedDicomFile& DicomInstanceToStore::GetParsedDicomFile() const 385 ParsedDicomFile& DicomInstanceToStore::GetParsedDicomFile() const
392 { 386 {
393 return const_cast<PImpl&>(*pimpl_).GetParsedDicomFile(); 387 return const_cast<PImpl&>(*pimpl_).GetParsedDicomFile();
394 } 388 }
389
390 void DicomInstanceToStore::GetSummary(DicomMap& summary) const
391 {
392 OrthancConfiguration::DefaultExtractDicomSummary(summary, GetParsedDicomFile());
393 }
394
395 void DicomInstanceToStore::GetDicomAsJson(Json::Value& dicomAsJson) const
396 {
397 OrthancConfiguration::DefaultDicomDatasetToJson(dicomAsJson, GetParsedDicomFile());
398 }
399
400 void DicomInstanceToStore::DatasetToJson(Json::Value& target,
401 DicomToJsonFormat format,
402 DicomToJsonFlags flags,
403 unsigned int maxStringLength) const
404 {
405 return GetParsedDicomFile().DatasetToJson(target, format, flags, maxStringLength);
406 }
407
408 unsigned int DicomInstanceToStore::GetFramesCount() const
409 {
410 return GetParsedDicomFile().GetFramesCount();
411 }
412
413 ImageAccessor* DicomInstanceToStore::DecodeFrame(unsigned int frame) const
414 {
415 return GetParsedDicomFile().DecodeFrame(frame);
416 }
395 } 417 }