Mercurial > hg > orthanc-stone
comparison Framework/Oracle/ParseDicomFileCommand.cpp @ 1116:a08699daf78b broker
ParsedDicomFileCache
author | Sebastien Jodogne <s.jodogne@gmail.com> |
---|---|
date | Mon, 04 Nov 2019 15:54:35 +0100 |
parents | 3730956f41a5 |
children | a8bf81756839 |
comparison
equal
deleted
inserted
replaced
1111:3730956f41a5 | 1116:a08699daf78b |
---|---|
26 #include <boost/filesystem/path.hpp> | 26 #include <boost/filesystem/path.hpp> |
27 | 27 |
28 namespace OrthancStone | 28 namespace OrthancStone |
29 { | 29 { |
30 ParseDicomFileCommand::SuccessMessage::SuccessMessage(const ParseDicomFileCommand& command, | 30 ParseDicomFileCommand::SuccessMessage::SuccessMessage(const ParseDicomFileCommand& command, |
31 DcmFileFormat& content) : | 31 DcmFileFormat& content, |
32 OriginMessage(command) | 32 size_t fileSize) : |
33 OriginMessage(command), | |
34 fileSize_(fileSize) | |
33 { | 35 { |
34 dicom_.reset(new Orthanc::ParsedDicomFile(content)); | 36 dicom_.reset(new Orthanc::ParsedDicomFile(content)); |
35 } | |
36 | 37 |
37 | 38 if (!dicom_->GetTagValue(sopInstanceUid_, Orthanc::DICOM_TAG_SOP_INSTANCE_UID)) |
38 Orthanc::ParsedDicomFile& ParseDicomFileCommand::SuccessMessage::GetDicom() const | |
39 { | |
40 if (dicom_.get()) | |
41 { | 39 { |
42 return *dicom_; | 40 throw Orthanc::OrthancException(Orthanc::ErrorCode_BadFileFormat, |
43 } | 41 "DICOM instance missing tag SOPInstanceUID"); |
44 else | |
45 { | |
46 throw Orthanc::OrthancException(Orthanc::ErrorCode_BadSequenceOfCalls); | |
47 } | 42 } |
48 } | 43 } |
49 | 44 |
50 | 45 |
51 Orthanc::ParsedDicomFile* ParseDicomFileCommand::SuccessMessage::ReleaseDicom() | 46 boost::shared_ptr<Orthanc::ParsedDicomFile> ParseDicomFileCommand::SuccessMessage::GetDicom() const |
52 { | 47 { |
53 if (dicom_.get()) | 48 assert(dicom_.get() != NULL); |
54 { | 49 return dicom_; |
55 return dicom_.release(); | |
56 } | |
57 else | |
58 { | |
59 throw Orthanc::OrthancException(Orthanc::ErrorCode_BadSequenceOfCalls); | |
60 } | |
61 } | 50 } |
62 | 51 |
63 | 52 |
64 std::string ParseDicomFileCommand::GetDicomDirPath(const std::string& dicomDirPath, | 53 std::string ParseDicomFileCommand::GetDicomDirPath(const std::string& dicomDirPath, |
65 const std::string& file) | 54 const std::string& file) |
66 { | 55 { |
67 std::string tmp = file; | 56 std::string tmp = file; |
68 | 57 |