annotate OrthancStone/Sources/Oracle/ParseDicomSuccessMessage.h @ 1623:74be0f498b08

Updated mechanism to avoid using deleted objects in RequestAnimationFrame callbacks.
author Benjamin Golinvaux <bgo@osimis.io>
date Wed, 04 Nov 2020 11:39:15 +0100
parents 8563ea5d8ae4
children 9ac2a65d4172
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
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
1271
0ca50d275b9a upgrade to year 2020
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1151
diff changeset
5 * Copyright (C) 2017-2020 Osimis S.A., Belgium
1151
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
1598
8563ea5d8ae4 relicensing some files, cf. osimis bm26 and chu agreement on 2020-05-20
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1596
diff changeset
8 * modify it under the terms of the GNU Lesser General Public License
1151
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
1598
8563ea5d8ae4 relicensing some files, cf. osimis bm26 and chu agreement on 2020-05-20
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1596
diff changeset
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
8563ea5d8ae4 relicensing some files, cf. osimis bm26 and chu agreement on 2020-05-20
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1596
diff changeset
15 * Lesser General Public License for more details.
1596
4fb8fdf03314 removed annoying whitespace
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1512
diff changeset
16 *
1598
8563ea5d8ae4 relicensing some files, cf. osimis bm26 and chu agreement on 2020-05-20
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1596
diff changeset
17 * You should have received a copy of the GNU Lesser General Public
8563ea5d8ae4 relicensing some files, cf. osimis bm26 and chu agreement on 2020-05-20
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1596
diff changeset
18 * License along with this program. If not, see
8563ea5d8ae4 relicensing some files, cf. osimis bm26 and chu agreement on 2020-05-20
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1596
diff changeset
19 * <http://www.gnu.org/licenses/>.
1151
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
48befc2bf66d ParseDicomFromWadoCommand
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
23 #pragma once
48befc2bf66d ParseDicomFromWadoCommand
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
24
1471
28c64c246312 working on a shared library
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1271
diff changeset
25 #include "../OrthancStone.h"
28c64c246312 working on a shared library
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1271
diff changeset
26
1151
48befc2bf66d ParseDicomFromWadoCommand
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
27 #if !defined(ORTHANC_ENABLE_DCMTK)
48befc2bf66d ParseDicomFromWadoCommand
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
28 # error The macro ORTHANC_ENABLE_DCMTK must be defined
48befc2bf66d ParseDicomFromWadoCommand
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
29 #endif
48befc2bf66d ParseDicomFromWadoCommand
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
30
48befc2bf66d ParseDicomFromWadoCommand
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
31 #if ORTHANC_ENABLE_DCMTK != 1
48befc2bf66d ParseDicomFromWadoCommand
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
32 # error Support for DCMTK must be enabled to use ParseDicomFromFileCommand
48befc2bf66d ParseDicomFromWadoCommand
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
33 #endif
48befc2bf66d ParseDicomFromWadoCommand
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
34
48befc2bf66d ParseDicomFromWadoCommand
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
35 #include "OracleCommandBase.h"
48befc2bf66d ParseDicomFromWadoCommand
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
36 #include "../Messages/IMessageEmitter.h"
48befc2bf66d ParseDicomFromWadoCommand
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
37 #include "../Messages/IObserver.h"
48befc2bf66d ParseDicomFromWadoCommand
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
38
48befc2bf66d ParseDicomFromWadoCommand
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
39 #include <map>
48befc2bf66d ParseDicomFromWadoCommand
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
40
48befc2bf66d ParseDicomFromWadoCommand
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
41 namespace Orthanc
48befc2bf66d ParseDicomFromWadoCommand
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
42 {
48befc2bf66d ParseDicomFromWadoCommand
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
43 class ParsedDicomFile;
48befc2bf66d ParseDicomFromWadoCommand
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
44 }
48befc2bf66d ParseDicomFromWadoCommand
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
45
48befc2bf66d ParseDicomFromWadoCommand
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
46 namespace OrthancStone
48befc2bf66d ParseDicomFromWadoCommand
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
47 {
1484
121d01aa328e SeriesThumbnailsLoader working on raw dicom files
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1471
diff changeset
48 class DicomSource;
121d01aa328e SeriesThumbnailsLoader working on raw dicom files
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1471
diff changeset
49
1151
48befc2bf66d ParseDicomFromWadoCommand
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
50 class ParseDicomSuccessMessage : public OriginMessage<OracleCommandBase>
48befc2bf66d ParseDicomFromWadoCommand
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
51 {
48befc2bf66d ParseDicomFromWadoCommand
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
52 ORTHANC_STONE_MESSAGE(__FILE__, __LINE__);
48befc2bf66d ParseDicomFromWadoCommand
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
53
48befc2bf66d ParseDicomFromWadoCommand
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
54 private:
1484
121d01aa328e SeriesThumbnailsLoader working on raw dicom files
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1471
diff changeset
55 const DicomSource& source_;
1151
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
48befc2bf66d ParseDicomFromWadoCommand
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
60 public:
48befc2bf66d ParseDicomFromWadoCommand
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
61 ParseDicomSuccessMessage(const OracleCommandBase& command,
1484
121d01aa328e SeriesThumbnailsLoader working on raw dicom files
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1471
diff changeset
62 const DicomSource& source,
1151
48befc2bf66d ParseDicomFromWadoCommand
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
63 Orthanc::ParsedDicomFile& dicom,
48befc2bf66d ParseDicomFromWadoCommand
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
64 size_t fileSize,
48befc2bf66d ParseDicomFromWadoCommand
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
65 bool hasPixelData) :
48befc2bf66d ParseDicomFromWadoCommand
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
66 OriginMessage(command),
1484
121d01aa328e SeriesThumbnailsLoader working on raw dicom files
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1471
diff changeset
67 source_(source),
1151
48befc2bf66d ParseDicomFromWadoCommand
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
68 dicom_(dicom),
48befc2bf66d ParseDicomFromWadoCommand
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
69 fileSize_(fileSize),
48befc2bf66d ParseDicomFromWadoCommand
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
70 hasPixelData_(hasPixelData)
48befc2bf66d ParseDicomFromWadoCommand
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
71 {
48befc2bf66d ParseDicomFromWadoCommand
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
72 }
1484
121d01aa328e SeriesThumbnailsLoader working on raw dicom files
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1471
diff changeset
73
121d01aa328e SeriesThumbnailsLoader working on raw dicom files
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1471
diff changeset
74 const DicomSource& GetSource() const
121d01aa328e SeriesThumbnailsLoader working on raw dicom files
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1471
diff changeset
75 {
121d01aa328e SeriesThumbnailsLoader working on raw dicom files
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1471
diff changeset
76 return source_;
121d01aa328e SeriesThumbnailsLoader working on raw dicom files
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1471
diff changeset
77 }
121d01aa328e SeriesThumbnailsLoader working on raw dicom files
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1471
diff changeset
78
1151
48befc2bf66d ParseDicomFromWadoCommand
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
79 Orthanc::ParsedDicomFile& GetDicom() const
48befc2bf66d ParseDicomFromWadoCommand
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
80 {
48befc2bf66d ParseDicomFromWadoCommand
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
81 return dicom_;
48befc2bf66d ParseDicomFromWadoCommand
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
82 }
48befc2bf66d ParseDicomFromWadoCommand
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
83
48befc2bf66d ParseDicomFromWadoCommand
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
84 size_t GetFileSize() const
48befc2bf66d ParseDicomFromWadoCommand
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
85 {
48befc2bf66d ParseDicomFromWadoCommand
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
86 return fileSize_;
48befc2bf66d ParseDicomFromWadoCommand
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
87 }
48befc2bf66d ParseDicomFromWadoCommand
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
88
48befc2bf66d ParseDicomFromWadoCommand
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
89 bool HasPixelData() const
48befc2bf66d ParseDicomFromWadoCommand
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
90 {
48befc2bf66d ParseDicomFromWadoCommand
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
91 return hasPixelData_;
48befc2bf66d ParseDicomFromWadoCommand
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
92 }
48befc2bf66d ParseDicomFromWadoCommand
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
93
48befc2bf66d ParseDicomFromWadoCommand
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
94 static Orthanc::ParsedDicomFile* ParseWadoAnswer(size_t& fileSize /* OUT */,
48befc2bf66d ParseDicomFromWadoCommand
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
95 const std::string& answer,
48befc2bf66d ParseDicomFromWadoCommand
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
96 const std::map<std::string, std::string>& headers);
48befc2bf66d ParseDicomFromWadoCommand
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
97 };
48befc2bf66d ParseDicomFromWadoCommand
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
98 }