# HG changeset patch # User Sebastien Jodogne # Date 1572543506 -3600 # Node ID 3730956f41a5ad9bb2b839935accb182d7091778 # Parent b82b74d138304696a4d03e055d95e2624d6b96bb ParseDicomFileCommand::GetDicomDirPath() diff -r b82b74d13830 -r 3730956f41a5 Framework/Oracle/GenericOracleRunner.cpp --- a/Framework/Oracle/GenericOracleRunner.cpp Thu Oct 31 15:05:46 2019 +0100 +++ b/Framework/Oracle/GenericOracleRunner.cpp Thu Oct 31 18:38:26 2019 +0100 @@ -208,7 +208,7 @@ c = a / b; } - LOG(INFO) << "Oracle reading file: " << c.string(); + LOG(TRACE) << "Oracle reading file: " << c.string(); return c.string(); } diff -r b82b74d13830 -r 3730956f41a5 Framework/Oracle/ParseDicomFileCommand.cpp --- a/Framework/Oracle/ParseDicomFileCommand.cpp Thu Oct 31 15:05:46 2019 +0100 +++ b/Framework/Oracle/ParseDicomFileCommand.cpp Thu Oct 31 18:38:26 2019 +0100 @@ -21,6 +21,10 @@ #include "ParseDicomFileCommand.h" +#include + +#include + namespace OrthancStone { ParseDicomFileCommand::SuccessMessage::SuccessMessage(const ParseDicomFileCommand& command, @@ -29,4 +33,45 @@ { dicom_.reset(new Orthanc::ParsedDicomFile(content)); } + + + Orthanc::ParsedDicomFile& ParseDicomFileCommand::SuccessMessage::GetDicom() const + { + if (dicom_.get()) + { + return *dicom_; + } + else + { + throw Orthanc::OrthancException(Orthanc::ErrorCode_BadSequenceOfCalls); + } + } + + + Orthanc::ParsedDicomFile* ParseDicomFileCommand::SuccessMessage::ReleaseDicom() + { + if (dicom_.get()) + { + return dicom_.release(); + } + else + { + throw Orthanc::OrthancException(Orthanc::ErrorCode_BadSequenceOfCalls); + } + } + + + std::string ParseDicomFileCommand::GetDicomDirPath(const std::string& dicomDirPath, + const std::string& file) + { + std::string tmp = file; + +#if !defined(_WIN32) + std::replace(tmp.begin(), tmp.end(), '\\', '/'); +#endif + + boost::filesystem::path base = boost::filesystem::path(dicomDirPath).parent_path(); + + return (base / tmp).string(); + } } diff -r b82b74d13830 -r 3730956f41a5 Framework/Oracle/ParseDicomFileCommand.h --- a/Framework/Oracle/ParseDicomFileCommand.h Thu Oct 31 15:05:46 2019 +0100 +++ b/Framework/Oracle/ParseDicomFileCommand.h Thu Oct 31 18:38:26 2019 +0100 @@ -52,10 +52,14 @@ SuccessMessage(const ParseDicomFileCommand& command, DcmFileFormat& content); - const Orthanc::ParsedDicomFile& GetDicom() const + bool HasDicom() const { - return *dicom_; + return dicom_.get() != NULL; } + + Orthanc::ParsedDicomFile& GetDicom() const; + + Orthanc::ParsedDicomFile* ReleaseDicom(); }; private: @@ -69,6 +73,16 @@ { } + ParseDicomFileCommand(const std::string& dicomDirPath, + const std::string& file) : + path_(GetDicomDirPath(dicomDirPath, file)), + pixelDataIncluded_(true) + { + } + + static std::string GetDicomDirPath(const std::string& dicomDirPath, + const std::string& file); + virtual Type GetType() const { return Type_ParseDicomFile;