Mercurial > hg > orthanc-stone
annotate Framework/Oracle/ParseDicomFileCommand.h @ 1135:a0a33e5ea5bb broker
IOracleCommand::Clone()
author | Sebastien Jodogne <s.jodogne@gmail.com> |
---|---|
date | Wed, 06 Nov 2019 17:34:58 +0100 |
parents | 87fbeb823375 |
children |
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" | |
1128
8e3763d1736a
removing CustomOracleCommand
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1124
diff
changeset
|
33 #include "OracleCommandBase.h" |
1110 | 34 |
35 #include <Core/DicomParsing/ParsedDicomFile.h> | |
36 | |
37 #include <dcmtk/dcmdata/dcfilefo.h> | |
38 | |
39 namespace OrthancStone | |
40 { | |
1128
8e3763d1736a
removing CustomOracleCommand
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1124
diff
changeset
|
41 class ParseDicomFileCommand : public OracleCommandBase |
1110 | 42 { |
43 public: | |
1135
a0a33e5ea5bb
IOracleCommand::Clone()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1134
diff
changeset
|
44 class SuccessMessage : public OriginMessage<ParseDicomFileCommand> |
1110 | 45 { |
46 ORTHANC_STONE_MESSAGE(__FILE__, __LINE__); | |
47 | |
48 private: | |
1134
87fbeb823375
allocating messages from oracle commands on the stack
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1128
diff
changeset
|
49 Orthanc::ParsedDicomFile& dicom_; |
87fbeb823375
allocating messages from oracle commands on the stack
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1128
diff
changeset
|
50 size_t fileSize_; |
87fbeb823375
allocating messages from oracle commands on the stack
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1128
diff
changeset
|
51 bool hasPixelData_; |
87fbeb823375
allocating messages from oracle commands on the stack
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1128
diff
changeset
|
52 std::string sopInstanceUid_; |
1110 | 53 |
54 public: | |
1135
a0a33e5ea5bb
IOracleCommand::Clone()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1134
diff
changeset
|
55 SuccessMessage(const ParseDicomFileCommand& command, |
1134
87fbeb823375
allocating messages from oracle commands on the stack
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1128
diff
changeset
|
56 Orthanc::ParsedDicomFile& dicom, |
1124
a8bf81756839
unsuccessful attempt to cache ParseDicomFileCommand
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1116
diff
changeset
|
57 size_t fileSize, |
a8bf81756839
unsuccessful attempt to cache ParseDicomFileCommand
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1116
diff
changeset
|
58 bool hasPixelData); |
a8bf81756839
unsuccessful attempt to cache ParseDicomFileCommand
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1116
diff
changeset
|
59 |
1134
87fbeb823375
allocating messages from oracle commands on the stack
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1128
diff
changeset
|
60 Orthanc::ParsedDicomFile& GetDicom() const |
1124
a8bf81756839
unsuccessful attempt to cache ParseDicomFileCommand
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1116
diff
changeset
|
61 { |
a8bf81756839
unsuccessful attempt to cache ParseDicomFileCommand
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1116
diff
changeset
|
62 return dicom_; |
a8bf81756839
unsuccessful attempt to cache ParseDicomFileCommand
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1116
diff
changeset
|
63 } |
1110 | 64 |
1116
a08699daf78b
ParsedDicomFileCache
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1111
diff
changeset
|
65 size_t GetFileSize() const |
1110 | 66 { |
1116
a08699daf78b
ParsedDicomFileCache
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1111
diff
changeset
|
67 return fileSize_; |
1110 | 68 } |
1124
a8bf81756839
unsuccessful attempt to cache ParseDicomFileCommand
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1116
diff
changeset
|
69 |
a8bf81756839
unsuccessful attempt to cache ParseDicomFileCommand
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1116
diff
changeset
|
70 bool HasPixelData() const |
a8bf81756839
unsuccessful attempt to cache ParseDicomFileCommand
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1116
diff
changeset
|
71 { |
a8bf81756839
unsuccessful attempt to cache ParseDicomFileCommand
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1116
diff
changeset
|
72 return hasPixelData_; |
a8bf81756839
unsuccessful attempt to cache ParseDicomFileCommand
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1116
diff
changeset
|
73 } |
1116
a08699daf78b
ParsedDicomFileCache
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1111
diff
changeset
|
74 |
a08699daf78b
ParsedDicomFileCache
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1111
diff
changeset
|
75 const std::string& GetSopInstanceUid() const |
a08699daf78b
ParsedDicomFileCache
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1111
diff
changeset
|
76 { |
a08699daf78b
ParsedDicomFileCache
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1111
diff
changeset
|
77 return sopInstanceUid_; |
a08699daf78b
ParsedDicomFileCache
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1111
diff
changeset
|
78 } |
1110 | 79 }; |
80 | |
81 private: | |
82 std::string path_; | |
83 bool pixelDataIncluded_; | |
84 | |
1135
a0a33e5ea5bb
IOracleCommand::Clone()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1134
diff
changeset
|
85 ParseDicomFileCommand(const ParseDicomFileCommand& other) : |
a0a33e5ea5bb
IOracleCommand::Clone()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1134
diff
changeset
|
86 path_(other.path_), |
a0a33e5ea5bb
IOracleCommand::Clone()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1134
diff
changeset
|
87 pixelDataIncluded_(other.pixelDataIncluded_) |
a0a33e5ea5bb
IOracleCommand::Clone()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1134
diff
changeset
|
88 { |
a0a33e5ea5bb
IOracleCommand::Clone()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1134
diff
changeset
|
89 } |
a0a33e5ea5bb
IOracleCommand::Clone()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1134
diff
changeset
|
90 |
1110 | 91 public: |
92 ParseDicomFileCommand(const std::string& path) : | |
93 path_(path), | |
94 pixelDataIncluded_(true) | |
95 { | |
96 } | |
97 | |
1111
3730956f41a5
ParseDicomFileCommand::GetDicomDirPath()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1110
diff
changeset
|
98 ParseDicomFileCommand(const std::string& dicomDirPath, |
3730956f41a5
ParseDicomFileCommand::GetDicomDirPath()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1110
diff
changeset
|
99 const std::string& file) : |
3730956f41a5
ParseDicomFileCommand::GetDicomDirPath()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1110
diff
changeset
|
100 path_(GetDicomDirPath(dicomDirPath, file)), |
3730956f41a5
ParseDicomFileCommand::GetDicomDirPath()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1110
diff
changeset
|
101 pixelDataIncluded_(true) |
3730956f41a5
ParseDicomFileCommand::GetDicomDirPath()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1110
diff
changeset
|
102 { |
3730956f41a5
ParseDicomFileCommand::GetDicomDirPath()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1110
diff
changeset
|
103 } |
3730956f41a5
ParseDicomFileCommand::GetDicomDirPath()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1110
diff
changeset
|
104 |
3730956f41a5
ParseDicomFileCommand::GetDicomDirPath()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1110
diff
changeset
|
105 static std::string GetDicomDirPath(const std::string& dicomDirPath, |
3730956f41a5
ParseDicomFileCommand::GetDicomDirPath()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1110
diff
changeset
|
106 const std::string& file); |
3730956f41a5
ParseDicomFileCommand::GetDicomDirPath()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1110
diff
changeset
|
107 |
1110 | 108 virtual Type GetType() const |
109 { | |
110 return Type_ParseDicomFile; | |
111 } | |
112 | |
1135
a0a33e5ea5bb
IOracleCommand::Clone()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1134
diff
changeset
|
113 virtual IOracleCommand* Clone() const |
a0a33e5ea5bb
IOracleCommand::Clone()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1134
diff
changeset
|
114 { |
a0a33e5ea5bb
IOracleCommand::Clone()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1134
diff
changeset
|
115 return new ParseDicomFileCommand(*this); |
a0a33e5ea5bb
IOracleCommand::Clone()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1134
diff
changeset
|
116 } |
a0a33e5ea5bb
IOracleCommand::Clone()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1134
diff
changeset
|
117 |
1110 | 118 const std::string& GetPath() const |
119 { | |
120 return path_; | |
121 } | |
122 | |
123 bool IsPixelDataIncluded() const | |
124 { | |
125 return pixelDataIncluded_; | |
126 } | |
127 | |
128 void SetPixelDataIncluded(bool included) | |
129 { | |
130 pixelDataIncluded_ = included; | |
131 } | |
132 }; | |
133 } |