annotate OrthancServer/Sources/QueryRetrieveHandler.h @ 4831:7053502fbf97

added copyright UCLouvain
author Sebastien Jodogne <s.jodogne@gmail.com>
date Thu, 25 Nov 2021 19:01:11 +0100
parents c494ee5d0101
children 2e71a08eea15 43e613a7756b
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
1368
b22ba8c5edbe query retrieve
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1 /**
b22ba8c5edbe query retrieve
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2 * Orthanc - A Lightweight, RESTful DICOM Store
1900
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1787
diff changeset
3 * Copyright (C) 2012-2016 Sebastien Jodogne, Medical Physics
1368
b22ba8c5edbe query retrieve
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4 * Department, University Hospital of Liege, Belgium
4437
d9473bd5ed43 upgrade to year 2021
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4205
diff changeset
5 * Copyright (C) 2017-2021 Osimis S.A., Belgium
4831
7053502fbf97 added copyright UCLouvain
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4517
diff changeset
6 * Copyright (C) 2021-2021 Sebastien Jodogne, ICTEAM UCLouvain, Belgium
1368
b22ba8c5edbe query retrieve
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7 *
b22ba8c5edbe query retrieve
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8 * This program is free software: you can redistribute it and/or
b22ba8c5edbe query retrieve
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
9 * modify it under the terms of the GNU General Public License as
b22ba8c5edbe query retrieve
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
10 * published by the Free Software Foundation, either version 3 of the
b22ba8c5edbe query retrieve
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
11 * License, or (at your option) any later version.
b22ba8c5edbe query retrieve
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
12 *
b22ba8c5edbe query retrieve
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
13 * In addition, as a special exception, the copyright holders of this
b22ba8c5edbe query retrieve
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
14 * program give permission to link the code of its release with the
b22ba8c5edbe query retrieve
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
15 * OpenSSL project's "OpenSSL" library (or with modified versions of it
b22ba8c5edbe query retrieve
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
16 * that use the same license as the "OpenSSL" library), and distribute
b22ba8c5edbe query retrieve
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
17 * the linked executables. You must obey the GNU General Public License
b22ba8c5edbe query retrieve
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
18 * in all respects for all of the code used other than "OpenSSL". If you
b22ba8c5edbe query retrieve
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
19 * modify file(s) with this exception, you may extend this exception to
b22ba8c5edbe query retrieve
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
20 * your version of the file(s), but you are not obligated to do so. If
b22ba8c5edbe query retrieve
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
21 * you do not wish to do so, delete this exception statement from your
b22ba8c5edbe query retrieve
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
22 * version. If you delete this exception statement from all source files
b22ba8c5edbe query retrieve
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
23 * in the program, then also delete it here.
b22ba8c5edbe query retrieve
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
24 *
b22ba8c5edbe query retrieve
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
25 * This program is distributed in the hope that it will be useful, but
b22ba8c5edbe query retrieve
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
26 * WITHOUT ANY WARRANTY; without even the implied warranty of
b22ba8c5edbe query retrieve
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
27 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
b22ba8c5edbe query retrieve
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
28 * General Public License for more details.
b22ba8c5edbe query retrieve
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
29 *
b22ba8c5edbe query retrieve
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
30 * You should have received a copy of the GNU General Public License
b22ba8c5edbe query retrieve
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
31 * along with this program. If not, see <http://www.gnu.org/licenses/>.
b22ba8c5edbe query retrieve
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
32 **/
b22ba8c5edbe query retrieve
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
33
b22ba8c5edbe query retrieve
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
34
b22ba8c5edbe query retrieve
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
35 #pragma once
b22ba8c5edbe query retrieve
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
36
4045
05b8fd21089c fix path
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4044
diff changeset
37 #include "../../OrthancFramework/Sources/DicomNetworking/DicomFindAnswers.h"
05b8fd21089c fix path
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4044
diff changeset
38 #include "../../OrthancFramework/Sources/DicomNetworking/RemoteModalityParameters.h"
1368
b22ba8c5edbe query retrieve
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
39
b22ba8c5edbe query retrieve
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
40 namespace Orthanc
b22ba8c5edbe query retrieve
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
41 {
3096
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3060
diff changeset
42 class ServerContext;
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3060
diff changeset
43
1368
b22ba8c5edbe query retrieve
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
44 class QueryRetrieveHandler : public IDynamicObject
b22ba8c5edbe query retrieve
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
45 {
b22ba8c5edbe query retrieve
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
46 private:
b22ba8c5edbe query retrieve
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
47 ServerContext& context_;
2867
251614c2edac DicomMoveScuJob
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2843
diff changeset
48 std::string localAet_;
1368
b22ba8c5edbe query retrieve
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
49 bool done_;
b22ba8c5edbe query retrieve
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
50 RemoteModalityParameters modality_;
b22ba8c5edbe query retrieve
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
51 ResourceType level_;
b22ba8c5edbe query retrieve
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
52 DicomMap query_;
b22ba8c5edbe query retrieve
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
53 DicomFindAnswers answers_;
b22ba8c5edbe query retrieve
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
54 std::string modalityName_;
3370
872bd3b6ec72 "/modalities/{id}/query": New argument "Normalize"
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3096
diff changeset
55 bool findNormalized_;
4517
c494ee5d0101 Added "Timeout" parameter everywhere in "/modalities/.../"
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4462
diff changeset
56 uint32_t timeout_; // New in Orthanc 1.9.1
1368
b22ba8c5edbe query retrieve
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
57
b22ba8c5edbe query retrieve
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
58 void Invalidate();
b22ba8c5edbe query retrieve
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
59
b22ba8c5edbe query retrieve
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
60 public:
4205
d962a2996637 cppcheck
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4045
diff changeset
61 explicit QueryRetrieveHandler(ServerContext& context);
1368
b22ba8c5edbe query retrieve
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
62
b22ba8c5edbe query retrieve
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
63 void SetModality(const std::string& symbolicName);
b22ba8c5edbe query retrieve
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
64
2867
251614c2edac DicomMoveScuJob
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2843
diff changeset
65 const RemoteModalityParameters& GetRemoteModality() const
1368
b22ba8c5edbe query retrieve
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
66 {
b22ba8c5edbe query retrieve
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
67 return modality_;
b22ba8c5edbe query retrieve
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
68 }
b22ba8c5edbe query retrieve
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
69
4462
da460bef88f8 "/modalities/{...}/query": New string argument "LocalAet"
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4437
diff changeset
70 void SetLocalAet(const std::string& localAet);
da460bef88f8 "/modalities/{...}/query": New string argument "LocalAet"
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4437
diff changeset
71
2867
251614c2edac DicomMoveScuJob
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2843
diff changeset
72 const std::string& GetLocalAet() const
251614c2edac DicomMoveScuJob
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2843
diff changeset
73 {
251614c2edac DicomMoveScuJob
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2843
diff changeset
74 return localAet_;
251614c2edac DicomMoveScuJob
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2843
diff changeset
75 }
251614c2edac DicomMoveScuJob
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2843
diff changeset
76
1368
b22ba8c5edbe query retrieve
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
77 const std::string& GetModalitySymbolicName() const
b22ba8c5edbe query retrieve
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
78 {
b22ba8c5edbe query retrieve
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
79 return modalityName_;
b22ba8c5edbe query retrieve
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
80 }
b22ba8c5edbe query retrieve
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
81
b22ba8c5edbe query retrieve
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
82 void SetLevel(ResourceType level);
b22ba8c5edbe query retrieve
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
83
b22ba8c5edbe query retrieve
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
84 ResourceType GetLevel() const
b22ba8c5edbe query retrieve
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
85 {
b22ba8c5edbe query retrieve
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
86 return level_;
b22ba8c5edbe query retrieve
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
87 }
b22ba8c5edbe query retrieve
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
88
b22ba8c5edbe query retrieve
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
89 void SetQuery(const DicomTag& tag,
b22ba8c5edbe query retrieve
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
90 const std::string& value);
b22ba8c5edbe query retrieve
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
91
b22ba8c5edbe query retrieve
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
92 const DicomMap& GetQuery() const
b22ba8c5edbe query retrieve
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
93 {
b22ba8c5edbe query retrieve
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
94 return query_;
b22ba8c5edbe query retrieve
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
95 }
b22ba8c5edbe query retrieve
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
96
2986
b1ba0a8311b5 exploring hierarchy of C-FIND answers finished
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2867
diff changeset
97 void CopyStringTag(const DicomMap& from,
b1ba0a8311b5 exploring hierarchy of C-FIND answers finished
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2867
diff changeset
98 const DicomTag& tag);
b1ba0a8311b5 exploring hierarchy of C-FIND answers finished
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2867
diff changeset
99
1368
b22ba8c5edbe query retrieve
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
100 void Run();
b22ba8c5edbe query retrieve
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
101
2867
251614c2edac DicomMoveScuJob
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2843
diff changeset
102 size_t GetAnswersCount();
1368
b22ba8c5edbe query retrieve
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
103
1787
1b1d5470233f refactoring of DicomFindAnswers
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1427
diff changeset
104 void GetAnswer(DicomMap& target,
1b1d5470233f refactoring of DicomFindAnswers
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1427
diff changeset
105 size_t i);
3370
872bd3b6ec72 "/modalities/{id}/query": New argument "Normalize"
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3096
diff changeset
106
872bd3b6ec72 "/modalities/{id}/query": New argument "Normalize"
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3096
diff changeset
107 bool IsFindNormalized() const
872bd3b6ec72 "/modalities/{id}/query": New argument "Normalize"
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3096
diff changeset
108 {
872bd3b6ec72 "/modalities/{id}/query": New argument "Normalize"
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3096
diff changeset
109 return findNormalized_;
872bd3b6ec72 "/modalities/{id}/query": New argument "Normalize"
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3096
diff changeset
110 }
872bd3b6ec72 "/modalities/{id}/query": New argument "Normalize"
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3096
diff changeset
111
872bd3b6ec72 "/modalities/{id}/query": New argument "Normalize"
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3096
diff changeset
112 void SetFindNormalized(bool normalized);
4517
c494ee5d0101 Added "Timeout" parameter everywhere in "/modalities/.../"
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4462
diff changeset
113
c494ee5d0101 Added "Timeout" parameter everywhere in "/modalities/.../"
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4462
diff changeset
114 void SetTimeout(uint32_t seconds)
c494ee5d0101 Added "Timeout" parameter everywhere in "/modalities/.../"
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4462
diff changeset
115 {
c494ee5d0101 Added "Timeout" parameter everywhere in "/modalities/.../"
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4462
diff changeset
116 timeout_ = seconds;
c494ee5d0101 Added "Timeout" parameter everywhere in "/modalities/.../"
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4462
diff changeset
117 }
c494ee5d0101 Added "Timeout" parameter everywhere in "/modalities/.../"
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4462
diff changeset
118
c494ee5d0101 Added "Timeout" parameter everywhere in "/modalities/.../"
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4462
diff changeset
119 uint32_t GetTimeout() const
c494ee5d0101 Added "Timeout" parameter everywhere in "/modalities/.../"
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4462
diff changeset
120 {
c494ee5d0101 Added "Timeout" parameter everywhere in "/modalities/.../"
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4462
diff changeset
121 return timeout_;
c494ee5d0101 Added "Timeout" parameter everywhere in "/modalities/.../"
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4462
diff changeset
122 }
c494ee5d0101 Added "Timeout" parameter everywhere in "/modalities/.../"
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4462
diff changeset
123
c494ee5d0101 Added "Timeout" parameter everywhere in "/modalities/.../"
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4462
diff changeset
124 bool HasTimeout() const
c494ee5d0101 Added "Timeout" parameter everywhere in "/modalities/.../"
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4462
diff changeset
125 {
c494ee5d0101 Added "Timeout" parameter everywhere in "/modalities/.../"
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4462
diff changeset
126 return timeout_ != 0;
c494ee5d0101 Added "Timeout" parameter everywhere in "/modalities/.../"
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4462
diff changeset
127 }
1368
b22ba8c5edbe query retrieve
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
128 };
b22ba8c5edbe query retrieve
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
129 }