Mercurial > hg > orthanc-stone
annotate Framework/Oracle/ParseDicomSuccessMessage.h @ 1186:3284c3fd96ad broker
merge
author | Sebastien Jodogne <s.jodogne@gmail.com> |
---|---|
date | Fri, 22 Nov 2019 09:51:47 +0100 |
parents | 48befc2bf66d |
children | 0ca50d275b9a |
rev | line source |
---|---|
1151
48befc2bf66d
ParseDicomFromWadoCommand
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1 /** |
48befc2bf66d
ParseDicomFromWadoCommand
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
2 * Stone of Orthanc |
48befc2bf66d
ParseDicomFromWadoCommand
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
3 * Copyright (C) 2012-2016 Sebastien Jodogne, Medical Physics |
48befc2bf66d
ParseDicomFromWadoCommand
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
4 * Department, University Hospital of Liege, Belgium |
48befc2bf66d
ParseDicomFromWadoCommand
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
5 * Copyright (C) 2017-2019 Osimis S.A., Belgium |
48befc2bf66d
ParseDicomFromWadoCommand
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
6 * |
48befc2bf66d
ParseDicomFromWadoCommand
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
7 * This program is free software: you can redistribute it and/or |
48befc2bf66d
ParseDicomFromWadoCommand
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
8 * modify it under the terms of the GNU Affero General Public License |
48befc2bf66d
ParseDicomFromWadoCommand
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
9 * as published by the Free Software Foundation, either version 3 of |
48befc2bf66d
ParseDicomFromWadoCommand
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
10 * the License, or (at your option) any later version. |
48befc2bf66d
ParseDicomFromWadoCommand
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
11 * |
48befc2bf66d
ParseDicomFromWadoCommand
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
12 * This program is distributed in the hope that it will be useful, but |
48befc2bf66d
ParseDicomFromWadoCommand
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
13 * WITHOUT ANY WARRANTY; without even the implied warranty of |
48befc2bf66d
ParseDicomFromWadoCommand
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
48befc2bf66d
ParseDicomFromWadoCommand
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
15 * Affero General Public License for more details. |
48befc2bf66d
ParseDicomFromWadoCommand
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
16 * |
48befc2bf66d
ParseDicomFromWadoCommand
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
17 * You should have received a copy of the GNU Affero General Public License |
48befc2bf66d
ParseDicomFromWadoCommand
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
18 * along with this program. If not, see <http://www.gnu.org/licenses/>. |
48befc2bf66d
ParseDicomFromWadoCommand
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
19 **/ |
48befc2bf66d
ParseDicomFromWadoCommand
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
20 |
48befc2bf66d
ParseDicomFromWadoCommand
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
21 |
48befc2bf66d
ParseDicomFromWadoCommand
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
22 #pragma once |
48befc2bf66d
ParseDicomFromWadoCommand
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
23 |
48befc2bf66d
ParseDicomFromWadoCommand
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
24 #if !defined(ORTHANC_ENABLE_DCMTK) |
48befc2bf66d
ParseDicomFromWadoCommand
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
25 # error The macro ORTHANC_ENABLE_DCMTK must be defined |
48befc2bf66d
ParseDicomFromWadoCommand
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
26 #endif |
48befc2bf66d
ParseDicomFromWadoCommand
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
27 |
48befc2bf66d
ParseDicomFromWadoCommand
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
28 #if ORTHANC_ENABLE_DCMTK != 1 |
48befc2bf66d
ParseDicomFromWadoCommand
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
29 # error Support for DCMTK must be enabled to use ParseDicomFromFileCommand |
48befc2bf66d
ParseDicomFromWadoCommand
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
30 #endif |
48befc2bf66d
ParseDicomFromWadoCommand
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
31 |
48befc2bf66d
ParseDicomFromWadoCommand
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
32 #include "OracleCommandBase.h" |
48befc2bf66d
ParseDicomFromWadoCommand
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
33 #include "../Messages/IMessageEmitter.h" |
48befc2bf66d
ParseDicomFromWadoCommand
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
34 #include "../Messages/IObserver.h" |
48befc2bf66d
ParseDicomFromWadoCommand
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
35 |
48befc2bf66d
ParseDicomFromWadoCommand
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
36 #include <map> |
48befc2bf66d
ParseDicomFromWadoCommand
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
37 |
48befc2bf66d
ParseDicomFromWadoCommand
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
38 namespace Orthanc |
48befc2bf66d
ParseDicomFromWadoCommand
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
39 { |
48befc2bf66d
ParseDicomFromWadoCommand
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
40 class ParsedDicomFile; |
48befc2bf66d
ParseDicomFromWadoCommand
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
41 } |
48befc2bf66d
ParseDicomFromWadoCommand
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
42 |
48befc2bf66d
ParseDicomFromWadoCommand
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
43 namespace OrthancStone |
48befc2bf66d
ParseDicomFromWadoCommand
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
44 { |
48befc2bf66d
ParseDicomFromWadoCommand
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
45 class ParseDicomSuccessMessage : public OriginMessage<OracleCommandBase> |
48befc2bf66d
ParseDicomFromWadoCommand
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
46 { |
48befc2bf66d
ParseDicomFromWadoCommand
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
47 ORTHANC_STONE_MESSAGE(__FILE__, __LINE__); |
48befc2bf66d
ParseDicomFromWadoCommand
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
48 |
48befc2bf66d
ParseDicomFromWadoCommand
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
49 private: |
48befc2bf66d
ParseDicomFromWadoCommand
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
50 Orthanc::ParsedDicomFile& dicom_; |
48befc2bf66d
ParseDicomFromWadoCommand
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
51 size_t fileSize_; |
48befc2bf66d
ParseDicomFromWadoCommand
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
52 bool hasPixelData_; |
48befc2bf66d
ParseDicomFromWadoCommand
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
53 |
48befc2bf66d
ParseDicomFromWadoCommand
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
54 public: |
48befc2bf66d
ParseDicomFromWadoCommand
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
55 ParseDicomSuccessMessage(const OracleCommandBase& command, |
48befc2bf66d
ParseDicomFromWadoCommand
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
56 Orthanc::ParsedDicomFile& dicom, |
48befc2bf66d
ParseDicomFromWadoCommand
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
57 size_t fileSize, |
48befc2bf66d
ParseDicomFromWadoCommand
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
58 bool hasPixelData) : |
48befc2bf66d
ParseDicomFromWadoCommand
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
59 OriginMessage(command), |
48befc2bf66d
ParseDicomFromWadoCommand
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
60 dicom_(dicom), |
48befc2bf66d
ParseDicomFromWadoCommand
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
61 fileSize_(fileSize), |
48befc2bf66d
ParseDicomFromWadoCommand
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
62 hasPixelData_(hasPixelData) |
48befc2bf66d
ParseDicomFromWadoCommand
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
63 { |
48befc2bf66d
ParseDicomFromWadoCommand
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
64 } |
48befc2bf66d
ParseDicomFromWadoCommand
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
65 |
48befc2bf66d
ParseDicomFromWadoCommand
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
66 Orthanc::ParsedDicomFile& GetDicom() const |
48befc2bf66d
ParseDicomFromWadoCommand
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
67 { |
48befc2bf66d
ParseDicomFromWadoCommand
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
68 return dicom_; |
48befc2bf66d
ParseDicomFromWadoCommand
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
69 } |
48befc2bf66d
ParseDicomFromWadoCommand
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
70 |
48befc2bf66d
ParseDicomFromWadoCommand
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
71 size_t GetFileSize() const |
48befc2bf66d
ParseDicomFromWadoCommand
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
72 { |
48befc2bf66d
ParseDicomFromWadoCommand
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
73 return fileSize_; |
48befc2bf66d
ParseDicomFromWadoCommand
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
74 } |
48befc2bf66d
ParseDicomFromWadoCommand
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
75 |
48befc2bf66d
ParseDicomFromWadoCommand
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
76 bool HasPixelData() const |
48befc2bf66d
ParseDicomFromWadoCommand
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
77 { |
48befc2bf66d
ParseDicomFromWadoCommand
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
78 return hasPixelData_; |
48befc2bf66d
ParseDicomFromWadoCommand
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
79 } |
48befc2bf66d
ParseDicomFromWadoCommand
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
80 |
48befc2bf66d
ParseDicomFromWadoCommand
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
81 static Orthanc::ParsedDicomFile* ParseWadoAnswer(size_t& fileSize /* OUT */, |
48befc2bf66d
ParseDicomFromWadoCommand
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
82 const std::string& answer, |
48befc2bf66d
ParseDicomFromWadoCommand
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
83 const std::map<std::string, std::string>& headers); |
48befc2bf66d
ParseDicomFromWadoCommand
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
84 }; |
48befc2bf66d
ParseDicomFromWadoCommand
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
85 } |