comparison Framework/Oracle/ParseDicomFileCommand.cpp @ 1124:a8bf81756839 broker

unsuccessful attempt to cache ParseDicomFileCommand
author Sebastien Jodogne <s.jodogne@gmail.com>
date Tue, 05 Nov 2019 18:49:06 +0100
parents a08699daf78b
children 87fbeb823375
comparison
equal deleted inserted replaced
1117:383aa2a7d426 1124:a8bf81756839
25 25
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 void ParseDicomFileCommand::SuccessMessage::Setup()
31 DcmFileFormat& content,
32 size_t fileSize) :
33 OriginMessage(command),
34 fileSize_(fileSize)
35 { 31 {
36 dicom_.reset(new Orthanc::ParsedDicomFile(content));
37
38 if (!dicom_->GetTagValue(sopInstanceUid_, Orthanc::DICOM_TAG_SOP_INSTANCE_UID)) 32 if (!dicom_->GetTagValue(sopInstanceUid_, Orthanc::DICOM_TAG_SOP_INSTANCE_UID))
39 { 33 {
40 throw Orthanc::OrthancException(Orthanc::ErrorCode_BadFileFormat, 34 throw Orthanc::OrthancException(Orthanc::ErrorCode_BadFileFormat,
41 "DICOM instance missing tag SOPInstanceUID"); 35 "DICOM instance missing tag SOPInstanceUID");
42 } 36 }
43 } 37 }
44 38
45 39
46 boost::shared_ptr<Orthanc::ParsedDicomFile> ParseDicomFileCommand::SuccessMessage::GetDicom() const 40 ParseDicomFileCommand::SuccessMessage::SuccessMessage(const ParseDicomFileCommand& command,
41 DcmFileFormat& dicom,
42 size_t fileSize,
43 bool hasPixelData) :
44 OriginMessage(command),
45 fileSize_(fileSize),
46 hasPixelData_(hasPixelData)
47 { 47 {
48 assert(dicom_.get() != NULL); 48 dicom_.reset(new Orthanc::ParsedDicomFile(dicom));
49 return dicom_; 49 Setup();
50 }
51
52
53 ParseDicomFileCommand::SuccessMessage::SuccessMessage(const ParseDicomFileCommand& command,
54 boost::shared_ptr<Orthanc::ParsedDicomFile> dicom,
55 size_t fileSize,
56 bool hasPixelData) :
57 OriginMessage(command),
58 dicom_(dicom),
59 fileSize_(fileSize),
60 hasPixelData_(hasPixelData)
61 {
62 Setup();
50 } 63 }
51 64
52 65
53 std::string ParseDicomFileCommand::GetDicomDirPath(const std::string& dicomDirPath, 66 std::string ParseDicomFileCommand::GetDicomDirPath(const std::string& dicomDirPath,
54 const std::string& file) 67 const std::string& file)