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
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
1110
b82b74d13830 ParseDicomFileCommand
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1 /**
b82b74d13830 ParseDicomFileCommand
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2 * Stone of Orthanc
b82b74d13830 ParseDicomFileCommand
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3 * Copyright (C) 2012-2016 Sebastien Jodogne, Medical Physics
b82b74d13830 ParseDicomFileCommand
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4 * Department, University Hospital of Liege, Belgium
b82b74d13830 ParseDicomFileCommand
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
5 * Copyright (C) 2017-2019 Osimis S.A., Belgium
b82b74d13830 ParseDicomFileCommand
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6 *
b82b74d13830 ParseDicomFileCommand
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7 * This program is free software: you can redistribute it and/or
b82b74d13830 ParseDicomFileCommand
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8 * modify it under the terms of the GNU Affero General Public License
b82b74d13830 ParseDicomFileCommand
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
9 * as published by the Free Software Foundation, either version 3 of
b82b74d13830 ParseDicomFileCommand
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
10 * the License, or (at your option) any later version.
b82b74d13830 ParseDicomFileCommand
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
11 *
b82b74d13830 ParseDicomFileCommand
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
12 * This program is distributed in the hope that it will be useful, but
b82b74d13830 ParseDicomFileCommand
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
13 * WITHOUT ANY WARRANTY; without even the implied warranty of
b82b74d13830 ParseDicomFileCommand
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
b82b74d13830 ParseDicomFileCommand
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
15 * Affero General Public License for more details.
b82b74d13830 ParseDicomFileCommand
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
16 *
b82b74d13830 ParseDicomFileCommand
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
17 * You should have received a copy of the GNU Affero General Public License
b82b74d13830 ParseDicomFileCommand
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
18 * along with this program. If not, see <http://www.gnu.org/licenses/>.
b82b74d13830 ParseDicomFileCommand
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
19 **/
b82b74d13830 ParseDicomFileCommand
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
20
b82b74d13830 ParseDicomFileCommand
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
21
b82b74d13830 ParseDicomFileCommand
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
22 #pragma once
b82b74d13830 ParseDicomFileCommand
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
23
b82b74d13830 ParseDicomFileCommand
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
24 #if !defined(ORTHANC_ENABLE_DCMTK)
b82b74d13830 ParseDicomFileCommand
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
25 # error The macro ORTHANC_ENABLE_DCMTK must be defined
b82b74d13830 ParseDicomFileCommand
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
26 #endif
b82b74d13830 ParseDicomFileCommand
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
27
b82b74d13830 ParseDicomFileCommand
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
28 #if ORTHANC_ENABLE_DCMTK != 1
b82b74d13830 ParseDicomFileCommand
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
29 # error Support for DCMTK must be enabled to use ParseDicomFileCommand
b82b74d13830 ParseDicomFileCommand
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
30 #endif
b82b74d13830 ParseDicomFileCommand
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
31
b82b74d13830 ParseDicomFileCommand
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
32 #include "../Messages/IMessage.h"
1128
8e3763d1736a removing CustomOracleCommand
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1124
diff changeset
33 #include "OracleCommandBase.h"
1110
b82b74d13830 ParseDicomFileCommand
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
34
b82b74d13830 ParseDicomFileCommand
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
35 #include <Core/DicomParsing/ParsedDicomFile.h>
b82b74d13830 ParseDicomFileCommand
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
36
b82b74d13830 ParseDicomFileCommand
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
37 #include <dcmtk/dcmdata/dcfilefo.h>
b82b74d13830 ParseDicomFileCommand
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
38
b82b74d13830 ParseDicomFileCommand
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
39 namespace OrthancStone
b82b74d13830 ParseDicomFileCommand
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
40 {
1128
8e3763d1736a removing CustomOracleCommand
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1124
diff changeset
41 class ParseDicomFileCommand : public OracleCommandBase
1110
b82b74d13830 ParseDicomFileCommand
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
42 {
b82b74d13830 ParseDicomFileCommand
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
43 public:
1135
a0a33e5ea5bb IOracleCommand::Clone()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1134
diff changeset
44 class SuccessMessage : public OriginMessage<ParseDicomFileCommand>
1110
b82b74d13830 ParseDicomFileCommand
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
45 {
b82b74d13830 ParseDicomFileCommand
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
46 ORTHANC_STONE_MESSAGE(__FILE__, __LINE__);
b82b74d13830 ParseDicomFileCommand
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
47
b82b74d13830 ParseDicomFileCommand
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
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
b82b74d13830 ParseDicomFileCommand
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
53
b82b74d13830 ParseDicomFileCommand
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
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
b82b74d13830 ParseDicomFileCommand
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
64
1116
a08699daf78b ParsedDicomFileCache
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1111
diff changeset
65 size_t GetFileSize() const
1110
b82b74d13830 ParseDicomFileCommand
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
66 {
1116
a08699daf78b ParsedDicomFileCache
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1111
diff changeset
67 return fileSize_;
1110
b82b74d13830 ParseDicomFileCommand
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
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
b82b74d13830 ParseDicomFileCommand
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
79 };
b82b74d13830 ParseDicomFileCommand
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
80
b82b74d13830 ParseDicomFileCommand
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
81 private:
b82b74d13830 ParseDicomFileCommand
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
82 std::string path_;
b82b74d13830 ParseDicomFileCommand
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
83 bool pixelDataIncluded_;
b82b74d13830 ParseDicomFileCommand
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
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
b82b74d13830 ParseDicomFileCommand
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
91 public:
b82b74d13830 ParseDicomFileCommand
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
92 ParseDicomFileCommand(const std::string& path) :
b82b74d13830 ParseDicomFileCommand
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
93 path_(path),
b82b74d13830 ParseDicomFileCommand
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
94 pixelDataIncluded_(true)
b82b74d13830 ParseDicomFileCommand
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
95 {
b82b74d13830 ParseDicomFileCommand
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
96 }
b82b74d13830 ParseDicomFileCommand
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
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
b82b74d13830 ParseDicomFileCommand
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
108 virtual Type GetType() const
b82b74d13830 ParseDicomFileCommand
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
109 {
b82b74d13830 ParseDicomFileCommand
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
110 return Type_ParseDicomFile;
b82b74d13830 ParseDicomFileCommand
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
111 }
b82b74d13830 ParseDicomFileCommand
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
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
b82b74d13830 ParseDicomFileCommand
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
118 const std::string& GetPath() const
b82b74d13830 ParseDicomFileCommand
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
119 {
b82b74d13830 ParseDicomFileCommand
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
120 return path_;
b82b74d13830 ParseDicomFileCommand
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
121 }
b82b74d13830 ParseDicomFileCommand
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
122
b82b74d13830 ParseDicomFileCommand
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
123 bool IsPixelDataIncluded() const
b82b74d13830 ParseDicomFileCommand
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
124 {
b82b74d13830 ParseDicomFileCommand
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
125 return pixelDataIncluded_;
b82b74d13830 ParseDicomFileCommand
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
126 }
b82b74d13830 ParseDicomFileCommand
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
127
b82b74d13830 ParseDicomFileCommand
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
128 void SetPixelDataIncluded(bool included)
b82b74d13830 ParseDicomFileCommand
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
129 {
b82b74d13830 ParseDicomFileCommand
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
130 pixelDataIncluded_ = included;
b82b74d13830 ParseDicomFileCommand
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
131 }
b82b74d13830 ParseDicomFileCommand
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
132 };
b82b74d13830 ParseDicomFileCommand
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
133 }