annotate Framework/Oracle/ParseDicomFileCommand.h @ 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
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"
b82b74d13830 ParseDicomFileCommand
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
33 #include "OracleCommandWithPayload.h"
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 {
b82b74d13830 ParseDicomFileCommand
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
41 class ParseDicomFileCommand : public OracleCommandWithPayload
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:
b82b74d13830 ParseDicomFileCommand
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
44 class SuccessMessage : public OriginMessage<ParseDicomFileCommand>
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:
b82b74d13830 ParseDicomFileCommand
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
49 std::auto_ptr<Orthanc::ParsedDicomFile> dicom_;
b82b74d13830 ParseDicomFileCommand
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
50
b82b74d13830 ParseDicomFileCommand
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
51 public:
b82b74d13830 ParseDicomFileCommand
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
52 SuccessMessage(const ParseDicomFileCommand& command,
b82b74d13830 ParseDicomFileCommand
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
53 DcmFileFormat& content);
b82b74d13830 ParseDicomFileCommand
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
54
1111
3730956f41a5 ParseDicomFileCommand::GetDicomDirPath()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1110
diff changeset
55 bool HasDicom() const
1110
b82b74d13830 ParseDicomFileCommand
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
56 {
1111
3730956f41a5 ParseDicomFileCommand::GetDicomDirPath()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1110
diff changeset
57 return dicom_.get() != NULL;
1110
b82b74d13830 ParseDicomFileCommand
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
58 }
1111
3730956f41a5 ParseDicomFileCommand::GetDicomDirPath()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1110
diff changeset
59
3730956f41a5 ParseDicomFileCommand::GetDicomDirPath()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1110
diff changeset
60 Orthanc::ParsedDicomFile& GetDicom() const;
3730956f41a5 ParseDicomFileCommand::GetDicomDirPath()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1110
diff changeset
61
3730956f41a5 ParseDicomFileCommand::GetDicomDirPath()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1110
diff changeset
62 Orthanc::ParsedDicomFile* ReleaseDicom();
1110
b82b74d13830 ParseDicomFileCommand
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
63 };
b82b74d13830 ParseDicomFileCommand
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
64
b82b74d13830 ParseDicomFileCommand
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
65 private:
b82b74d13830 ParseDicomFileCommand
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
66 std::string path_;
b82b74d13830 ParseDicomFileCommand
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
67 bool pixelDataIncluded_;
b82b74d13830 ParseDicomFileCommand
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
68
b82b74d13830 ParseDicomFileCommand
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
69 public:
b82b74d13830 ParseDicomFileCommand
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
70 ParseDicomFileCommand(const std::string& path) :
b82b74d13830 ParseDicomFileCommand
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
71 path_(path),
b82b74d13830 ParseDicomFileCommand
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
72 pixelDataIncluded_(true)
b82b74d13830 ParseDicomFileCommand
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
73 {
b82b74d13830 ParseDicomFileCommand
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
74 }
b82b74d13830 ParseDicomFileCommand
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
75
1111
3730956f41a5 ParseDicomFileCommand::GetDicomDirPath()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1110
diff changeset
76 ParseDicomFileCommand(const std::string& dicomDirPath,
3730956f41a5 ParseDicomFileCommand::GetDicomDirPath()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1110
diff changeset
77 const std::string& file) :
3730956f41a5 ParseDicomFileCommand::GetDicomDirPath()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1110
diff changeset
78 path_(GetDicomDirPath(dicomDirPath, file)),
3730956f41a5 ParseDicomFileCommand::GetDicomDirPath()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1110
diff changeset
79 pixelDataIncluded_(true)
3730956f41a5 ParseDicomFileCommand::GetDicomDirPath()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1110
diff changeset
80 {
3730956f41a5 ParseDicomFileCommand::GetDicomDirPath()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1110
diff changeset
81 }
3730956f41a5 ParseDicomFileCommand::GetDicomDirPath()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1110
diff changeset
82
3730956f41a5 ParseDicomFileCommand::GetDicomDirPath()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1110
diff changeset
83 static std::string GetDicomDirPath(const std::string& dicomDirPath,
3730956f41a5 ParseDicomFileCommand::GetDicomDirPath()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1110
diff changeset
84 const std::string& file);
3730956f41a5 ParseDicomFileCommand::GetDicomDirPath()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1110
diff changeset
85
1110
b82b74d13830 ParseDicomFileCommand
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
86 virtual Type GetType() const
b82b74d13830 ParseDicomFileCommand
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
87 {
b82b74d13830 ParseDicomFileCommand
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
88 return Type_ParseDicomFile;
b82b74d13830 ParseDicomFileCommand
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
89 }
b82b74d13830 ParseDicomFileCommand
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
90
b82b74d13830 ParseDicomFileCommand
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
91 const std::string& GetPath() const
b82b74d13830 ParseDicomFileCommand
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
92 {
b82b74d13830 ParseDicomFileCommand
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
93 return path_;
b82b74d13830 ParseDicomFileCommand
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
94 }
b82b74d13830 ParseDicomFileCommand
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
95
b82b74d13830 ParseDicomFileCommand
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
96 bool IsPixelDataIncluded() const
b82b74d13830 ParseDicomFileCommand
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
97 {
b82b74d13830 ParseDicomFileCommand
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
98 return pixelDataIncluded_;
b82b74d13830 ParseDicomFileCommand
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
99 }
b82b74d13830 ParseDicomFileCommand
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
100
b82b74d13830 ParseDicomFileCommand
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
101 void SetPixelDataIncluded(bool included)
b82b74d13830 ParseDicomFileCommand
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
102 {
b82b74d13830 ParseDicomFileCommand
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
103 pixelDataIncluded_ = included;
b82b74d13830 ParseDicomFileCommand
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
104 }
b82b74d13830 ParseDicomFileCommand
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
105 };
b82b74d13830 ParseDicomFileCommand
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
106 }