Mercurial > hg > orthanc-stone
annotate Framework/Oracle/ParseDicomFileCommand.h @ 1116:a08699daf78b broker
ParsedDicomFileCache
author | Sebastien Jodogne <s.jodogne@gmail.com> |
---|---|
date | Mon, 04 Nov 2019 15:54:35 +0100 |
parents | 3730956f41a5 |
children | a8bf81756839 |
rev | line source |
---|---|
1110 | 1 /** |
2 * Stone of Orthanc | |
3 * Copyright (C) 2012-2016 Sebastien Jodogne, Medical Physics | |
4 * Department, University Hospital of Liege, Belgium | |
5 * Copyright (C) 2017-2019 Osimis S.A., Belgium | |
6 * | |
7 * This program is free software: you can redistribute it and/or | |
8 * modify it under the terms of the GNU Affero General Public License | |
9 * as published by the Free Software Foundation, either version 3 of | |
10 * the License, or (at your option) any later version. | |
11 * | |
12 * This program is distributed in the hope that it will be useful, but | |
13 * WITHOUT ANY WARRANTY; without even the implied warranty of | |
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |
15 * Affero General Public License for more details. | |
16 * | |
17 * You should have received a copy of the GNU Affero General Public License | |
18 * along with this program. If not, see <http://www.gnu.org/licenses/>. | |
19 **/ | |
20 | |
21 | |
22 #pragma once | |
23 | |
24 #if !defined(ORTHANC_ENABLE_DCMTK) | |
25 # error The macro ORTHANC_ENABLE_DCMTK must be defined | |
26 #endif | |
27 | |
28 #if ORTHANC_ENABLE_DCMTK != 1 | |
29 # error Support for DCMTK must be enabled to use ParseDicomFileCommand | |
30 #endif | |
31 | |
32 #include "../Messages/IMessage.h" | |
33 #include "OracleCommandWithPayload.h" | |
34 | |
35 #include <Core/DicomParsing/ParsedDicomFile.h> | |
36 | |
37 #include <dcmtk/dcmdata/dcfilefo.h> | |
38 | |
39 namespace OrthancStone | |
40 { | |
41 class ParseDicomFileCommand : public OracleCommandWithPayload | |
42 { | |
43 public: | |
44 class SuccessMessage : public OriginMessage<ParseDicomFileCommand> | |
45 { | |
46 ORTHANC_STONE_MESSAGE(__FILE__, __LINE__); | |
47 | |
48 private: | |
1116
a08699daf78b
ParsedDicomFileCache
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1111
diff
changeset
|
49 boost::shared_ptr<Orthanc::ParsedDicomFile> dicom_; |
a08699daf78b
ParsedDicomFileCache
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1111
diff
changeset
|
50 size_t fileSize_; |
a08699daf78b
ParsedDicomFileCache
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1111
diff
changeset
|
51 std::string sopInstanceUid_; |
1110 | 52 |
53 public: | |
54 SuccessMessage(const ParseDicomFileCommand& command, | |
1116
a08699daf78b
ParsedDicomFileCache
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1111
diff
changeset
|
55 DcmFileFormat& content, |
a08699daf78b
ParsedDicomFileCache
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1111
diff
changeset
|
56 size_t fileSize); |
1110 | 57 |
1116
a08699daf78b
ParsedDicomFileCache
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1111
diff
changeset
|
58 size_t GetFileSize() const |
1110 | 59 { |
1116
a08699daf78b
ParsedDicomFileCache
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1111
diff
changeset
|
60 return fileSize_; |
1110 | 61 } |
1116
a08699daf78b
ParsedDicomFileCache
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1111
diff
changeset
|
62 |
a08699daf78b
ParsedDicomFileCache
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1111
diff
changeset
|
63 const std::string& GetSopInstanceUid() const |
a08699daf78b
ParsedDicomFileCache
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1111
diff
changeset
|
64 { |
a08699daf78b
ParsedDicomFileCache
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1111
diff
changeset
|
65 return sopInstanceUid_; |
a08699daf78b
ParsedDicomFileCache
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1111
diff
changeset
|
66 } |
a08699daf78b
ParsedDicomFileCache
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1111
diff
changeset
|
67 |
a08699daf78b
ParsedDicomFileCache
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1111
diff
changeset
|
68 boost::shared_ptr<Orthanc::ParsedDicomFile> GetDicom() const; |
1110 | 69 }; |
70 | |
71 private: | |
72 std::string path_; | |
73 bool pixelDataIncluded_; | |
74 | |
75 public: | |
76 ParseDicomFileCommand(const std::string& path) : | |
77 path_(path), | |
78 pixelDataIncluded_(true) | |
79 { | |
80 } | |
81 | |
1111
3730956f41a5
ParseDicomFileCommand::GetDicomDirPath()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1110
diff
changeset
|
82 ParseDicomFileCommand(const std::string& dicomDirPath, |
3730956f41a5
ParseDicomFileCommand::GetDicomDirPath()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1110
diff
changeset
|
83 const std::string& file) : |
3730956f41a5
ParseDicomFileCommand::GetDicomDirPath()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1110
diff
changeset
|
84 path_(GetDicomDirPath(dicomDirPath, file)), |
3730956f41a5
ParseDicomFileCommand::GetDicomDirPath()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1110
diff
changeset
|
85 pixelDataIncluded_(true) |
3730956f41a5
ParseDicomFileCommand::GetDicomDirPath()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1110
diff
changeset
|
86 { |
3730956f41a5
ParseDicomFileCommand::GetDicomDirPath()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1110
diff
changeset
|
87 } |
3730956f41a5
ParseDicomFileCommand::GetDicomDirPath()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1110
diff
changeset
|
88 |
3730956f41a5
ParseDicomFileCommand::GetDicomDirPath()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1110
diff
changeset
|
89 static std::string GetDicomDirPath(const std::string& dicomDirPath, |
3730956f41a5
ParseDicomFileCommand::GetDicomDirPath()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1110
diff
changeset
|
90 const std::string& file); |
3730956f41a5
ParseDicomFileCommand::GetDicomDirPath()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1110
diff
changeset
|
91 |
1110 | 92 virtual Type GetType() const |
93 { | |
94 return Type_ParseDicomFile; | |
95 } | |
96 | |
97 const std::string& GetPath() const | |
98 { | |
99 return path_; | |
100 } | |
101 | |
102 bool IsPixelDataIncluded() const | |
103 { | |
104 return pixelDataIncluded_; | |
105 } | |
106 | |
107 void SetPixelDataIncluded(bool included) | |
108 { | |
109 pixelDataIncluded_ = included; | |
110 } | |
111 }; | |
112 } |