Mercurial > hg > orthanc-stone
comparison Framework/Oracle/ParseDicomFileCommand.cpp @ 1111:3730956f41a5 broker
ParseDicomFileCommand::GetDicomDirPath()
author | Sebastien Jodogne <s.jodogne@gmail.com> |
---|---|
date | Thu, 31 Oct 2019 18:38:26 +0100 |
parents | b82b74d13830 |
children | a08699daf78b |
comparison
equal
deleted
inserted
replaced
1110:b82b74d13830 | 1111:3730956f41a5 |
---|---|
19 **/ | 19 **/ |
20 | 20 |
21 | 21 |
22 #include "ParseDicomFileCommand.h" | 22 #include "ParseDicomFileCommand.h" |
23 | 23 |
24 #include <Core/OrthancException.h> | |
25 | |
26 #include <boost/filesystem/path.hpp> | |
27 | |
24 namespace OrthancStone | 28 namespace OrthancStone |
25 { | 29 { |
26 ParseDicomFileCommand::SuccessMessage::SuccessMessage(const ParseDicomFileCommand& command, | 30 ParseDicomFileCommand::SuccessMessage::SuccessMessage(const ParseDicomFileCommand& command, |
27 DcmFileFormat& content) : | 31 DcmFileFormat& content) : |
28 OriginMessage(command) | 32 OriginMessage(command) |
29 { | 33 { |
30 dicom_.reset(new Orthanc::ParsedDicomFile(content)); | 34 dicom_.reset(new Orthanc::ParsedDicomFile(content)); |
31 } | 35 } |
36 | |
37 | |
38 Orthanc::ParsedDicomFile& ParseDicomFileCommand::SuccessMessage::GetDicom() const | |
39 { | |
40 if (dicom_.get()) | |
41 { | |
42 return *dicom_; | |
43 } | |
44 else | |
45 { | |
46 throw Orthanc::OrthancException(Orthanc::ErrorCode_BadSequenceOfCalls); | |
47 } | |
48 } | |
49 | |
50 | |
51 Orthanc::ParsedDicomFile* ParseDicomFileCommand::SuccessMessage::ReleaseDicom() | |
52 { | |
53 if (dicom_.get()) | |
54 { | |
55 return dicom_.release(); | |
56 } | |
57 else | |
58 { | |
59 throw Orthanc::OrthancException(Orthanc::ErrorCode_BadSequenceOfCalls); | |
60 } | |
61 } | |
62 | |
63 | |
64 std::string ParseDicomFileCommand::GetDicomDirPath(const std::string& dicomDirPath, | |
65 const std::string& file) | |
66 { | |
67 std::string tmp = file; | |
68 | |
69 #if !defined(_WIN32) | |
70 std::replace(tmp.begin(), tmp.end(), '\\', '/'); | |
71 #endif | |
72 | |
73 boost::filesystem::path base = boost::filesystem::path(dicomDirPath).parent_path(); | |
74 | |
75 return (base / tmp).string(); | |
76 } | |
32 } | 77 } |