annotate OrthancServer/OrthancFindRequestHandler.cpp @ 1969:5e40f88f4eba

fix for old versions of mingw
author Sebastien Jodogne <s.jodogne@gmail.com>
date Mon, 11 Apr 2016 12:53:42 +0200
parents b1291df2f780
children b5d4f9c156ad
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
565
c931ac02db82 refactoring of find class
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1 /**
c931ac02db82 refactoring of find class
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2 * Orthanc - A Lightweight, RESTful DICOM Store
1900
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1898
diff changeset
3 * Copyright (C) 2012-2016 Sebastien Jodogne, Medical Physics
1288
6e7e5ed91c2d upgrade to year 2015
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1162
diff changeset
4 * Department, University Hospital of Liege, Belgium
565
c931ac02db82 refactoring of find class
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
5 *
c931ac02db82 refactoring of find class
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6 * This program is free software: you can redistribute it and/or
c931ac02db82 refactoring of find class
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7 * modify it under the terms of the GNU General Public License as
c931ac02db82 refactoring of find class
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8 * published by the Free Software Foundation, either version 3 of the
c931ac02db82 refactoring of find class
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
9 * License, or (at your option) any later version.
c931ac02db82 refactoring of find class
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
10 *
c931ac02db82 refactoring of find class
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
11 * In addition, as a special exception, the copyright holders of this
c931ac02db82 refactoring of find class
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
12 * program give permission to link the code of its release with the
c931ac02db82 refactoring of find class
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
13 * OpenSSL project's "OpenSSL" library (or with modified versions of it
c931ac02db82 refactoring of find class
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
14 * that use the same license as the "OpenSSL" library), and distribute
c931ac02db82 refactoring of find class
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
15 * the linked executables. You must obey the GNU General Public License
c931ac02db82 refactoring of find class
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
16 * in all respects for all of the code used other than "OpenSSL". If you
c931ac02db82 refactoring of find class
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
17 * modify file(s) with this exception, you may extend this exception to
c931ac02db82 refactoring of find class
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
18 * your version of the file(s), but you are not obligated to do so. If
c931ac02db82 refactoring of find class
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
19 * you do not wish to do so, delete this exception statement from your
c931ac02db82 refactoring of find class
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
20 * version. If you delete this exception statement from all source files
c931ac02db82 refactoring of find class
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
21 * in the program, then also delete it here.
c931ac02db82 refactoring of find class
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
22 *
c931ac02db82 refactoring of find class
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
23 * This program is distributed in the hope that it will be useful, but
c931ac02db82 refactoring of find class
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
24 * WITHOUT ANY WARRANTY; without even the implied warranty of
c931ac02db82 refactoring of find class
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
25 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
c931ac02db82 refactoring of find class
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
26 * General Public License for more details.
c931ac02db82 refactoring of find class
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
27 *
c931ac02db82 refactoring of find class
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
28 * You should have received a copy of the GNU General Public License
c931ac02db82 refactoring of find class
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
29 * along with this program. If not, see <http://www.gnu.org/licenses/>.
c931ac02db82 refactoring of find class
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
30 **/
c931ac02db82 refactoring of find class
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
31
824
a811bdf8b8eb precompiled headers
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 810
diff changeset
32
831
84513f2ee1f3 pch for unit tests and server
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 824
diff changeset
33 #include "PrecompiledHeadersServer.h"
565
c931ac02db82 refactoring of find class
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
34 #include "OrthancFindRequestHandler.h"
c931ac02db82 refactoring of find class
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
35
1759
e268412adcf1 removal of old implementation of search
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1758
diff changeset
36 #include "../Core/DicomFormat/DicomArray.h"
1888
512b6e76f531 Lua: "IncomingFindRequestFilter()" to apply filters to incoming C-Find requests
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1859
diff changeset
37 #include "../Core/Lua/LuaFunctionCall.h"
1486
f967bdf8534e refactoring to Logging.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1429
diff changeset
38 #include "../Core/Logging.h"
795
d466b3606aca refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 722
diff changeset
39 #include "FromDcmtkBridge.h"
1759
e268412adcf1 removal of old implementation of search
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1758
diff changeset
40 #include "OrthancInitialization.h"
1751
fb569ee09a69 LookupResource complete
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1737
diff changeset
41 #include "Search/LookupResource.h"
1759
e268412adcf1 removal of old implementation of search
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1758
diff changeset
42 #include "ServerToolbox.h"
608
0bedf8ff9288 basic find scp
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 565
diff changeset
43
1486
f967bdf8534e refactoring to Logging.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1429
diff changeset
44 #include <boost/regex.hpp>
f967bdf8534e refactoring to Logging.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1429
diff changeset
45
608
0bedf8ff9288 basic find scp
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 565
diff changeset
46
1361
94ffb597d297 refactoring of C-Find SCP
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1354
diff changeset
47 namespace Orthanc
94ffb597d297 refactoring of C-Find SCP
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1354
diff changeset
48 {
1898
e018037d4d0e Support of optional tags for counting resources in C-Find
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1893
diff changeset
49 static void GetChildren(std::list<std::string>& target,
e018037d4d0e Support of optional tags for counting resources in C-Find
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1893
diff changeset
50 ServerIndex& index,
e018037d4d0e Support of optional tags for counting resources in C-Find
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1893
diff changeset
51 const std::list<std::string>& source)
e018037d4d0e Support of optional tags for counting resources in C-Find
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1893
diff changeset
52 {
e018037d4d0e Support of optional tags for counting resources in C-Find
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1893
diff changeset
53 target.clear();
e018037d4d0e Support of optional tags for counting resources in C-Find
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1893
diff changeset
54
e018037d4d0e Support of optional tags for counting resources in C-Find
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1893
diff changeset
55 for (std::list<std::string>::const_iterator
e018037d4d0e Support of optional tags for counting resources in C-Find
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1893
diff changeset
56 it = source.begin(); it != source.end(); ++it)
e018037d4d0e Support of optional tags for counting resources in C-Find
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1893
diff changeset
57 {
e018037d4d0e Support of optional tags for counting resources in C-Find
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1893
diff changeset
58 std::list<std::string> tmp;
e018037d4d0e Support of optional tags for counting resources in C-Find
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1893
diff changeset
59 index.GetChildren(tmp, *it);
e018037d4d0e Support of optional tags for counting resources in C-Find
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1893
diff changeset
60 target.splice(target.end(), tmp);
e018037d4d0e Support of optional tags for counting resources in C-Find
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1893
diff changeset
61 }
e018037d4d0e Support of optional tags for counting resources in C-Find
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1893
diff changeset
62 }
e018037d4d0e Support of optional tags for counting resources in C-Find
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1893
diff changeset
63
e018037d4d0e Support of optional tags for counting resources in C-Find
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1893
diff changeset
64
e018037d4d0e Support of optional tags for counting resources in C-Find
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1893
diff changeset
65 static void StoreSetOfStrings(DicomMap& result,
e018037d4d0e Support of optional tags for counting resources in C-Find
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1893
diff changeset
66 const DicomTag& tag,
e018037d4d0e Support of optional tags for counting resources in C-Find
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1893
diff changeset
67 const std::set<std::string>& values)
e018037d4d0e Support of optional tags for counting resources in C-Find
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1893
diff changeset
68 {
e018037d4d0e Support of optional tags for counting resources in C-Find
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1893
diff changeset
69 bool isFirst = true;
e018037d4d0e Support of optional tags for counting resources in C-Find
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1893
diff changeset
70
e018037d4d0e Support of optional tags for counting resources in C-Find
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1893
diff changeset
71 std::string s;
e018037d4d0e Support of optional tags for counting resources in C-Find
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1893
diff changeset
72 for (std::set<std::string>::const_iterator
e018037d4d0e Support of optional tags for counting resources in C-Find
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1893
diff changeset
73 it = values.begin(); it != values.end(); ++it)
e018037d4d0e Support of optional tags for counting resources in C-Find
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1893
diff changeset
74 {
e018037d4d0e Support of optional tags for counting resources in C-Find
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1893
diff changeset
75 if (isFirst)
e018037d4d0e Support of optional tags for counting resources in C-Find
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1893
diff changeset
76 {
e018037d4d0e Support of optional tags for counting resources in C-Find
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1893
diff changeset
77 isFirst = false;
e018037d4d0e Support of optional tags for counting resources in C-Find
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1893
diff changeset
78 }
e018037d4d0e Support of optional tags for counting resources in C-Find
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1893
diff changeset
79 else
e018037d4d0e Support of optional tags for counting resources in C-Find
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1893
diff changeset
80 {
e018037d4d0e Support of optional tags for counting resources in C-Find
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1893
diff changeset
81 s += "\\";
e018037d4d0e Support of optional tags for counting resources in C-Find
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1893
diff changeset
82 }
e018037d4d0e Support of optional tags for counting resources in C-Find
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1893
diff changeset
83
e018037d4d0e Support of optional tags for counting resources in C-Find
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1893
diff changeset
84 s += *it;
e018037d4d0e Support of optional tags for counting resources in C-Find
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1893
diff changeset
85 }
e018037d4d0e Support of optional tags for counting resources in C-Find
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1893
diff changeset
86
e018037d4d0e Support of optional tags for counting resources in C-Find
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1893
diff changeset
87 result.SetValue(tag, s);
e018037d4d0e Support of optional tags for counting resources in C-Find
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1893
diff changeset
88 }
e018037d4d0e Support of optional tags for counting resources in C-Find
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1893
diff changeset
89
e018037d4d0e Support of optional tags for counting resources in C-Find
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1893
diff changeset
90
e018037d4d0e Support of optional tags for counting resources in C-Find
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1893
diff changeset
91 static void ExtractTagFromMainDicomTags(std::set<std::string>& target,
e018037d4d0e Support of optional tags for counting resources in C-Find
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1893
diff changeset
92 ServerIndex& index,
e018037d4d0e Support of optional tags for counting resources in C-Find
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1893
diff changeset
93 const DicomTag& tag,
e018037d4d0e Support of optional tags for counting resources in C-Find
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1893
diff changeset
94 const std::list<std::string>& resources,
e018037d4d0e Support of optional tags for counting resources in C-Find
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1893
diff changeset
95 ResourceType level)
e018037d4d0e Support of optional tags for counting resources in C-Find
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1893
diff changeset
96 {
e018037d4d0e Support of optional tags for counting resources in C-Find
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1893
diff changeset
97 for (std::list<std::string>::const_iterator
e018037d4d0e Support of optional tags for counting resources in C-Find
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1893
diff changeset
98 it = resources.begin(); it != resources.end(); ++it)
e018037d4d0e Support of optional tags for counting resources in C-Find
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1893
diff changeset
99 {
e018037d4d0e Support of optional tags for counting resources in C-Find
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1893
diff changeset
100 DicomMap tags;
e018037d4d0e Support of optional tags for counting resources in C-Find
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1893
diff changeset
101 if (index.GetMainDicomTags(tags, *it, level, level) &&
e018037d4d0e Support of optional tags for counting resources in C-Find
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1893
diff changeset
102 tags.HasTag(tag))
e018037d4d0e Support of optional tags for counting resources in C-Find
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1893
diff changeset
103 {
e018037d4d0e Support of optional tags for counting resources in C-Find
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1893
diff changeset
104 target.insert(tags.GetValue(tag).GetContent());
e018037d4d0e Support of optional tags for counting resources in C-Find
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1893
diff changeset
105 }
e018037d4d0e Support of optional tags for counting resources in C-Find
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1893
diff changeset
106 }
e018037d4d0e Support of optional tags for counting resources in C-Find
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1893
diff changeset
107 }
e018037d4d0e Support of optional tags for counting resources in C-Find
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1893
diff changeset
108
e018037d4d0e Support of optional tags for counting resources in C-Find
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1893
diff changeset
109
e018037d4d0e Support of optional tags for counting resources in C-Find
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1893
diff changeset
110 static void ExtractTagFromInstances(std::set<std::string>& target,
e018037d4d0e Support of optional tags for counting resources in C-Find
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1893
diff changeset
111 ServerContext& context,
e018037d4d0e Support of optional tags for counting resources in C-Find
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1893
diff changeset
112 const DicomTag& tag,
e018037d4d0e Support of optional tags for counting resources in C-Find
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1893
diff changeset
113 const std::list<std::string>& instances)
e018037d4d0e Support of optional tags for counting resources in C-Find
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1893
diff changeset
114 {
e018037d4d0e Support of optional tags for counting resources in C-Find
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1893
diff changeset
115 std::string formatted = tag.Format();
e018037d4d0e Support of optional tags for counting resources in C-Find
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1893
diff changeset
116
e018037d4d0e Support of optional tags for counting resources in C-Find
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1893
diff changeset
117 for (std::list<std::string>::const_iterator
e018037d4d0e Support of optional tags for counting resources in C-Find
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1893
diff changeset
118 it = instances.begin(); it != instances.end(); ++it)
e018037d4d0e Support of optional tags for counting resources in C-Find
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1893
diff changeset
119 {
e018037d4d0e Support of optional tags for counting resources in C-Find
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1893
diff changeset
120 Json::Value dicom;
e018037d4d0e Support of optional tags for counting resources in C-Find
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1893
diff changeset
121 context.ReadJson(dicom, *it);
e018037d4d0e Support of optional tags for counting resources in C-Find
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1893
diff changeset
122
e018037d4d0e Support of optional tags for counting resources in C-Find
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1893
diff changeset
123 if (dicom.isMember(formatted))
e018037d4d0e Support of optional tags for counting resources in C-Find
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1893
diff changeset
124 {
e018037d4d0e Support of optional tags for counting resources in C-Find
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1893
diff changeset
125 const Json::Value& source = dicom[formatted];
e018037d4d0e Support of optional tags for counting resources in C-Find
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1893
diff changeset
126
e018037d4d0e Support of optional tags for counting resources in C-Find
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1893
diff changeset
127 if (source.type() == Json::objectValue &&
e018037d4d0e Support of optional tags for counting resources in C-Find
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1893
diff changeset
128 source.isMember("Type") &&
e018037d4d0e Support of optional tags for counting resources in C-Find
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1893
diff changeset
129 source.isMember("Value") &&
e018037d4d0e Support of optional tags for counting resources in C-Find
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1893
diff changeset
130 source["Type"].asString() == "String" &&
e018037d4d0e Support of optional tags for counting resources in C-Find
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1893
diff changeset
131 source["Value"].type() == Json::stringValue)
e018037d4d0e Support of optional tags for counting resources in C-Find
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1893
diff changeset
132 {
e018037d4d0e Support of optional tags for counting resources in C-Find
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1893
diff changeset
133 target.insert(source["Value"].asString());
e018037d4d0e Support of optional tags for counting resources in C-Find
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1893
diff changeset
134 }
e018037d4d0e Support of optional tags for counting resources in C-Find
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1893
diff changeset
135 }
e018037d4d0e Support of optional tags for counting resources in C-Find
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1893
diff changeset
136 }
e018037d4d0e Support of optional tags for counting resources in C-Find
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1893
diff changeset
137 }
e018037d4d0e Support of optional tags for counting resources in C-Find
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1893
diff changeset
138
e018037d4d0e Support of optional tags for counting resources in C-Find
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1893
diff changeset
139
e018037d4d0e Support of optional tags for counting resources in C-Find
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1893
diff changeset
140 static void ComputePatientCounters(DicomMap& result,
e018037d4d0e Support of optional tags for counting resources in C-Find
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1893
diff changeset
141 ServerIndex& index,
e018037d4d0e Support of optional tags for counting resources in C-Find
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1893
diff changeset
142 const std::string& patient,
e018037d4d0e Support of optional tags for counting resources in C-Find
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1893
diff changeset
143 const DicomMap& query)
e018037d4d0e Support of optional tags for counting resources in C-Find
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1893
diff changeset
144 {
e018037d4d0e Support of optional tags for counting resources in C-Find
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1893
diff changeset
145 std::list<std::string> studies;
e018037d4d0e Support of optional tags for counting resources in C-Find
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1893
diff changeset
146 index.GetChildren(studies, patient);
e018037d4d0e Support of optional tags for counting resources in C-Find
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1893
diff changeset
147
e018037d4d0e Support of optional tags for counting resources in C-Find
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1893
diff changeset
148 if (query.HasTag(DICOM_TAG_NUMBER_OF_PATIENT_RELATED_STUDIES))
e018037d4d0e Support of optional tags for counting resources in C-Find
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1893
diff changeset
149 {
e018037d4d0e Support of optional tags for counting resources in C-Find
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1893
diff changeset
150 result.SetValue(DICOM_TAG_NUMBER_OF_PATIENT_RELATED_STUDIES,
e018037d4d0e Support of optional tags for counting resources in C-Find
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1893
diff changeset
151 boost::lexical_cast<std::string>(studies.size()));
e018037d4d0e Support of optional tags for counting resources in C-Find
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1893
diff changeset
152 }
e018037d4d0e Support of optional tags for counting resources in C-Find
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1893
diff changeset
153
e018037d4d0e Support of optional tags for counting resources in C-Find
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1893
diff changeset
154 if (!query.HasTag(DICOM_TAG_NUMBER_OF_PATIENT_RELATED_SERIES) &&
e018037d4d0e Support of optional tags for counting resources in C-Find
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1893
diff changeset
155 !query.HasTag(DICOM_TAG_NUMBER_OF_PATIENT_RELATED_INSTANCES))
e018037d4d0e Support of optional tags for counting resources in C-Find
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1893
diff changeset
156 {
e018037d4d0e Support of optional tags for counting resources in C-Find
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1893
diff changeset
157 return;
e018037d4d0e Support of optional tags for counting resources in C-Find
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1893
diff changeset
158 }
e018037d4d0e Support of optional tags for counting resources in C-Find
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1893
diff changeset
159
e018037d4d0e Support of optional tags for counting resources in C-Find
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1893
diff changeset
160 std::list<std::string> series;
e018037d4d0e Support of optional tags for counting resources in C-Find
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1893
diff changeset
161 GetChildren(series, index, studies);
e018037d4d0e Support of optional tags for counting resources in C-Find
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1893
diff changeset
162 studies.clear(); // This information is useless below
e018037d4d0e Support of optional tags for counting resources in C-Find
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1893
diff changeset
163
e018037d4d0e Support of optional tags for counting resources in C-Find
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1893
diff changeset
164 if (query.HasTag(DICOM_TAG_NUMBER_OF_PATIENT_RELATED_SERIES))
e018037d4d0e Support of optional tags for counting resources in C-Find
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1893
diff changeset
165 {
e018037d4d0e Support of optional tags for counting resources in C-Find
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1893
diff changeset
166 result.SetValue(DICOM_TAG_NUMBER_OF_PATIENT_RELATED_SERIES,
e018037d4d0e Support of optional tags for counting resources in C-Find
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1893
diff changeset
167 boost::lexical_cast<std::string>(series.size()));
e018037d4d0e Support of optional tags for counting resources in C-Find
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1893
diff changeset
168 }
e018037d4d0e Support of optional tags for counting resources in C-Find
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1893
diff changeset
169
e018037d4d0e Support of optional tags for counting resources in C-Find
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1893
diff changeset
170 if (!query.HasTag(DICOM_TAG_NUMBER_OF_PATIENT_RELATED_INSTANCES))
e018037d4d0e Support of optional tags for counting resources in C-Find
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1893
diff changeset
171 {
e018037d4d0e Support of optional tags for counting resources in C-Find
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1893
diff changeset
172 return;
e018037d4d0e Support of optional tags for counting resources in C-Find
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1893
diff changeset
173 }
e018037d4d0e Support of optional tags for counting resources in C-Find
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1893
diff changeset
174
e018037d4d0e Support of optional tags for counting resources in C-Find
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1893
diff changeset
175 std::list<std::string> instances;
e018037d4d0e Support of optional tags for counting resources in C-Find
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1893
diff changeset
176 GetChildren(instances, index, series);
e018037d4d0e Support of optional tags for counting resources in C-Find
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1893
diff changeset
177
e018037d4d0e Support of optional tags for counting resources in C-Find
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1893
diff changeset
178 if (query.HasTag(DICOM_TAG_NUMBER_OF_PATIENT_RELATED_INSTANCES))
e018037d4d0e Support of optional tags for counting resources in C-Find
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1893
diff changeset
179 {
e018037d4d0e Support of optional tags for counting resources in C-Find
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1893
diff changeset
180 result.SetValue(DICOM_TAG_NUMBER_OF_PATIENT_RELATED_INSTANCES,
e018037d4d0e Support of optional tags for counting resources in C-Find
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1893
diff changeset
181 boost::lexical_cast<std::string>(instances.size()));
e018037d4d0e Support of optional tags for counting resources in C-Find
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1893
diff changeset
182 }
e018037d4d0e Support of optional tags for counting resources in C-Find
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1893
diff changeset
183 }
e018037d4d0e Support of optional tags for counting resources in C-Find
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1893
diff changeset
184
e018037d4d0e Support of optional tags for counting resources in C-Find
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1893
diff changeset
185
e018037d4d0e Support of optional tags for counting resources in C-Find
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1893
diff changeset
186 static void ComputeStudyCounters(DicomMap& result,
e018037d4d0e Support of optional tags for counting resources in C-Find
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1893
diff changeset
187 ServerContext& context,
e018037d4d0e Support of optional tags for counting resources in C-Find
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1893
diff changeset
188 const std::string& study,
e018037d4d0e Support of optional tags for counting resources in C-Find
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1893
diff changeset
189 const DicomMap& query)
e018037d4d0e Support of optional tags for counting resources in C-Find
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1893
diff changeset
190 {
e018037d4d0e Support of optional tags for counting resources in C-Find
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1893
diff changeset
191 ServerIndex& index = context.GetIndex();
e018037d4d0e Support of optional tags for counting resources in C-Find
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1893
diff changeset
192
e018037d4d0e Support of optional tags for counting resources in C-Find
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1893
diff changeset
193 std::list<std::string> series;
e018037d4d0e Support of optional tags for counting resources in C-Find
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1893
diff changeset
194 index.GetChildren(series, study);
e018037d4d0e Support of optional tags for counting resources in C-Find
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1893
diff changeset
195
e018037d4d0e Support of optional tags for counting resources in C-Find
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1893
diff changeset
196 if (query.HasTag(DICOM_TAG_NUMBER_OF_STUDY_RELATED_SERIES))
e018037d4d0e Support of optional tags for counting resources in C-Find
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1893
diff changeset
197 {
e018037d4d0e Support of optional tags for counting resources in C-Find
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1893
diff changeset
198 result.SetValue(DICOM_TAG_NUMBER_OF_STUDY_RELATED_SERIES,
e018037d4d0e Support of optional tags for counting resources in C-Find
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1893
diff changeset
199 boost::lexical_cast<std::string>(series.size()));
e018037d4d0e Support of optional tags for counting resources in C-Find
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1893
diff changeset
200 }
e018037d4d0e Support of optional tags for counting resources in C-Find
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1893
diff changeset
201
e018037d4d0e Support of optional tags for counting resources in C-Find
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1893
diff changeset
202 if (query.HasTag(DICOM_TAG_MODALITIES_IN_STUDY))
e018037d4d0e Support of optional tags for counting resources in C-Find
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1893
diff changeset
203 {
e018037d4d0e Support of optional tags for counting resources in C-Find
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1893
diff changeset
204 std::set<std::string> values;
e018037d4d0e Support of optional tags for counting resources in C-Find
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1893
diff changeset
205 ExtractTagFromMainDicomTags(values, index, DICOM_TAG_MODALITY, series, ResourceType_Series);
e018037d4d0e Support of optional tags for counting resources in C-Find
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1893
diff changeset
206 StoreSetOfStrings(result, DICOM_TAG_MODALITIES_IN_STUDY, values);
e018037d4d0e Support of optional tags for counting resources in C-Find
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1893
diff changeset
207 }
e018037d4d0e Support of optional tags for counting resources in C-Find
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1893
diff changeset
208
e018037d4d0e Support of optional tags for counting resources in C-Find
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1893
diff changeset
209 if (!query.HasTag(DICOM_TAG_NUMBER_OF_STUDY_RELATED_INSTANCES) &&
e018037d4d0e Support of optional tags for counting resources in C-Find
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1893
diff changeset
210 !query.HasTag(DICOM_TAG_SOP_CLASSES_IN_STUDY))
e018037d4d0e Support of optional tags for counting resources in C-Find
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1893
diff changeset
211 {
e018037d4d0e Support of optional tags for counting resources in C-Find
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1893
diff changeset
212 return;
e018037d4d0e Support of optional tags for counting resources in C-Find
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1893
diff changeset
213 }
e018037d4d0e Support of optional tags for counting resources in C-Find
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1893
diff changeset
214
e018037d4d0e Support of optional tags for counting resources in C-Find
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1893
diff changeset
215 std::list<std::string> instances;
e018037d4d0e Support of optional tags for counting resources in C-Find
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1893
diff changeset
216 GetChildren(instances, index, series);
e018037d4d0e Support of optional tags for counting resources in C-Find
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1893
diff changeset
217
e018037d4d0e Support of optional tags for counting resources in C-Find
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1893
diff changeset
218 if (query.HasTag(DICOM_TAG_NUMBER_OF_STUDY_RELATED_INSTANCES))
e018037d4d0e Support of optional tags for counting resources in C-Find
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1893
diff changeset
219 {
e018037d4d0e Support of optional tags for counting resources in C-Find
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1893
diff changeset
220 result.SetValue(DICOM_TAG_NUMBER_OF_STUDY_RELATED_INSTANCES,
e018037d4d0e Support of optional tags for counting resources in C-Find
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1893
diff changeset
221 boost::lexical_cast<std::string>(instances.size()));
e018037d4d0e Support of optional tags for counting resources in C-Find
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1893
diff changeset
222 }
e018037d4d0e Support of optional tags for counting resources in C-Find
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1893
diff changeset
223
e018037d4d0e Support of optional tags for counting resources in C-Find
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1893
diff changeset
224 if (query.HasTag(DICOM_TAG_SOP_CLASSES_IN_STUDY))
e018037d4d0e Support of optional tags for counting resources in C-Find
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1893
diff changeset
225 {
e018037d4d0e Support of optional tags for counting resources in C-Find
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1893
diff changeset
226 std::set<std::string> values;
e018037d4d0e Support of optional tags for counting resources in C-Find
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1893
diff changeset
227 ExtractTagFromInstances(values, context, DICOM_TAG_SOP_CLASS_UID, instances);
e018037d4d0e Support of optional tags for counting resources in C-Find
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1893
diff changeset
228 StoreSetOfStrings(result, DICOM_TAG_SOP_CLASSES_IN_STUDY, values);
e018037d4d0e Support of optional tags for counting resources in C-Find
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1893
diff changeset
229 }
e018037d4d0e Support of optional tags for counting resources in C-Find
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1893
diff changeset
230 }
e018037d4d0e Support of optional tags for counting resources in C-Find
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1893
diff changeset
231
e018037d4d0e Support of optional tags for counting resources in C-Find
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1893
diff changeset
232
e018037d4d0e Support of optional tags for counting resources in C-Find
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1893
diff changeset
233 static void ComputeSeriesCounters(DicomMap& result,
e018037d4d0e Support of optional tags for counting resources in C-Find
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1893
diff changeset
234 ServerIndex& index,
e018037d4d0e Support of optional tags for counting resources in C-Find
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1893
diff changeset
235 const std::string& series,
e018037d4d0e Support of optional tags for counting resources in C-Find
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1893
diff changeset
236 const DicomMap& query)
e018037d4d0e Support of optional tags for counting resources in C-Find
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1893
diff changeset
237 {
e018037d4d0e Support of optional tags for counting resources in C-Find
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1893
diff changeset
238 std::list<std::string> instances;
e018037d4d0e Support of optional tags for counting resources in C-Find
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1893
diff changeset
239 index.GetChildren(instances, series);
e018037d4d0e Support of optional tags for counting resources in C-Find
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1893
diff changeset
240
e018037d4d0e Support of optional tags for counting resources in C-Find
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1893
diff changeset
241 if (query.HasTag(DICOM_TAG_NUMBER_OF_SERIES_RELATED_INSTANCES))
e018037d4d0e Support of optional tags for counting resources in C-Find
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1893
diff changeset
242 {
e018037d4d0e Support of optional tags for counting resources in C-Find
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1893
diff changeset
243 result.SetValue(DICOM_TAG_NUMBER_OF_SERIES_RELATED_INSTANCES,
e018037d4d0e Support of optional tags for counting resources in C-Find
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1893
diff changeset
244 boost::lexical_cast<std::string>(instances.size()));
e018037d4d0e Support of optional tags for counting resources in C-Find
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1893
diff changeset
245 }
e018037d4d0e Support of optional tags for counting resources in C-Find
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1893
diff changeset
246 }
e018037d4d0e Support of optional tags for counting resources in C-Find
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1893
diff changeset
247
e018037d4d0e Support of optional tags for counting resources in C-Find
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1893
diff changeset
248
e018037d4d0e Support of optional tags for counting resources in C-Find
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1893
diff changeset
249 static DicomMap* ComputeCounters(ServerContext& context,
e018037d4d0e Support of optional tags for counting resources in C-Find
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1893
diff changeset
250 const std::string& instanceId,
e018037d4d0e Support of optional tags for counting resources in C-Find
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1893
diff changeset
251 ResourceType level,
e018037d4d0e Support of optional tags for counting resources in C-Find
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1893
diff changeset
252 const DicomMap& query)
e018037d4d0e Support of optional tags for counting resources in C-Find
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1893
diff changeset
253 {
e018037d4d0e Support of optional tags for counting resources in C-Find
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1893
diff changeset
254 switch (level)
e018037d4d0e Support of optional tags for counting resources in C-Find
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1893
diff changeset
255 {
e018037d4d0e Support of optional tags for counting resources in C-Find
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1893
diff changeset
256 case ResourceType_Patient:
e018037d4d0e Support of optional tags for counting resources in C-Find
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1893
diff changeset
257 if (!query.HasTag(DICOM_TAG_NUMBER_OF_PATIENT_RELATED_STUDIES) &&
e018037d4d0e Support of optional tags for counting resources in C-Find
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1893
diff changeset
258 !query.HasTag(DICOM_TAG_NUMBER_OF_PATIENT_RELATED_SERIES) &&
e018037d4d0e Support of optional tags for counting resources in C-Find
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1893
diff changeset
259 !query.HasTag(DICOM_TAG_NUMBER_OF_PATIENT_RELATED_INSTANCES))
e018037d4d0e Support of optional tags for counting resources in C-Find
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1893
diff changeset
260 {
e018037d4d0e Support of optional tags for counting resources in C-Find
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1893
diff changeset
261 return NULL;
e018037d4d0e Support of optional tags for counting resources in C-Find
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1893
diff changeset
262 }
e018037d4d0e Support of optional tags for counting resources in C-Find
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1893
diff changeset
263
e018037d4d0e Support of optional tags for counting resources in C-Find
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1893
diff changeset
264 break;
e018037d4d0e Support of optional tags for counting resources in C-Find
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1893
diff changeset
265
e018037d4d0e Support of optional tags for counting resources in C-Find
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1893
diff changeset
266 case ResourceType_Study:
e018037d4d0e Support of optional tags for counting resources in C-Find
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1893
diff changeset
267 if (!query.HasTag(DICOM_TAG_NUMBER_OF_STUDY_RELATED_SERIES) &&
e018037d4d0e Support of optional tags for counting resources in C-Find
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1893
diff changeset
268 !query.HasTag(DICOM_TAG_NUMBER_OF_STUDY_RELATED_INSTANCES) &&
e018037d4d0e Support of optional tags for counting resources in C-Find
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1893
diff changeset
269 !query.HasTag(DICOM_TAG_SOP_CLASSES_IN_STUDY) &&
e018037d4d0e Support of optional tags for counting resources in C-Find
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1893
diff changeset
270 !query.HasTag(DICOM_TAG_MODALITIES_IN_STUDY))
e018037d4d0e Support of optional tags for counting resources in C-Find
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1893
diff changeset
271 {
e018037d4d0e Support of optional tags for counting resources in C-Find
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1893
diff changeset
272 return NULL;
e018037d4d0e Support of optional tags for counting resources in C-Find
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1893
diff changeset
273 }
e018037d4d0e Support of optional tags for counting resources in C-Find
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1893
diff changeset
274
e018037d4d0e Support of optional tags for counting resources in C-Find
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1893
diff changeset
275 break;
e018037d4d0e Support of optional tags for counting resources in C-Find
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1893
diff changeset
276
e018037d4d0e Support of optional tags for counting resources in C-Find
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1893
diff changeset
277 case ResourceType_Series:
e018037d4d0e Support of optional tags for counting resources in C-Find
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1893
diff changeset
278 if (!query.HasTag(DICOM_TAG_NUMBER_OF_SERIES_RELATED_INSTANCES))
e018037d4d0e Support of optional tags for counting resources in C-Find
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1893
diff changeset
279 {
e018037d4d0e Support of optional tags for counting resources in C-Find
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1893
diff changeset
280 return NULL;
e018037d4d0e Support of optional tags for counting resources in C-Find
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1893
diff changeset
281 }
e018037d4d0e Support of optional tags for counting resources in C-Find
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1893
diff changeset
282
e018037d4d0e Support of optional tags for counting resources in C-Find
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1893
diff changeset
283 break;
e018037d4d0e Support of optional tags for counting resources in C-Find
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1893
diff changeset
284
e018037d4d0e Support of optional tags for counting resources in C-Find
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1893
diff changeset
285 default:
e018037d4d0e Support of optional tags for counting resources in C-Find
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1893
diff changeset
286 return NULL;
e018037d4d0e Support of optional tags for counting resources in C-Find
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1893
diff changeset
287 }
e018037d4d0e Support of optional tags for counting resources in C-Find
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1893
diff changeset
288
e018037d4d0e Support of optional tags for counting resources in C-Find
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1893
diff changeset
289 std::string parent;
e018037d4d0e Support of optional tags for counting resources in C-Find
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1893
diff changeset
290 if (!context.GetIndex().LookupParent(parent, instanceId, level))
e018037d4d0e Support of optional tags for counting resources in C-Find
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1893
diff changeset
291 {
e018037d4d0e Support of optional tags for counting resources in C-Find
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1893
diff changeset
292 throw OrthancException(ErrorCode_UnknownResource); // The resource was deleted in between
e018037d4d0e Support of optional tags for counting resources in C-Find
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1893
diff changeset
293 }
e018037d4d0e Support of optional tags for counting resources in C-Find
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1893
diff changeset
294
e018037d4d0e Support of optional tags for counting resources in C-Find
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1893
diff changeset
295 std::auto_ptr<DicomMap> result(new DicomMap);
e018037d4d0e Support of optional tags for counting resources in C-Find
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1893
diff changeset
296
e018037d4d0e Support of optional tags for counting resources in C-Find
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1893
diff changeset
297 switch (level)
e018037d4d0e Support of optional tags for counting resources in C-Find
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1893
diff changeset
298 {
e018037d4d0e Support of optional tags for counting resources in C-Find
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1893
diff changeset
299 case ResourceType_Patient:
e018037d4d0e Support of optional tags for counting resources in C-Find
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1893
diff changeset
300 ComputePatientCounters(*result, context.GetIndex(), parent, query);
e018037d4d0e Support of optional tags for counting resources in C-Find
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1893
diff changeset
301 break;
e018037d4d0e Support of optional tags for counting resources in C-Find
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1893
diff changeset
302
e018037d4d0e Support of optional tags for counting resources in C-Find
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1893
diff changeset
303 case ResourceType_Study:
e018037d4d0e Support of optional tags for counting resources in C-Find
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1893
diff changeset
304 ComputeStudyCounters(*result, context, parent, query);
e018037d4d0e Support of optional tags for counting resources in C-Find
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1893
diff changeset
305 break;
e018037d4d0e Support of optional tags for counting resources in C-Find
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1893
diff changeset
306
e018037d4d0e Support of optional tags for counting resources in C-Find
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1893
diff changeset
307 case ResourceType_Series:
e018037d4d0e Support of optional tags for counting resources in C-Find
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1893
diff changeset
308 ComputeSeriesCounters(*result, context.GetIndex(), parent, query);
e018037d4d0e Support of optional tags for counting resources in C-Find
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1893
diff changeset
309 break;
e018037d4d0e Support of optional tags for counting resources in C-Find
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1893
diff changeset
310
e018037d4d0e Support of optional tags for counting resources in C-Find
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1893
diff changeset
311 default:
e018037d4d0e Support of optional tags for counting resources in C-Find
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1893
diff changeset
312 throw OrthancException(ErrorCode_InternalError);
e018037d4d0e Support of optional tags for counting resources in C-Find
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1893
diff changeset
313 }
e018037d4d0e Support of optional tags for counting resources in C-Find
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1893
diff changeset
314
e018037d4d0e Support of optional tags for counting resources in C-Find
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1893
diff changeset
315 return result.release();
e018037d4d0e Support of optional tags for counting resources in C-Find
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1893
diff changeset
316 }
e018037d4d0e Support of optional tags for counting resources in C-Find
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1893
diff changeset
317
e018037d4d0e Support of optional tags for counting resources in C-Find
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1893
diff changeset
318
608
0bedf8ff9288 basic find scp
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 565
diff changeset
319 static void AddAnswer(DicomFindAnswers& answers,
0bedf8ff9288 basic find scp
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 565
diff changeset
320 const Json::Value& resource,
1859
4e7c318a3f69 C-FIND SCP will return tags with sequence value representation
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1856
diff changeset
321 const DicomArray& query,
1898
e018037d4d0e Support of optional tags for counting resources in C-Find
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1893
diff changeset
322 const std::list<DicomTag>& sequencesToReturn,
e018037d4d0e Support of optional tags for counting resources in C-Find
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1893
diff changeset
323 const DicomMap* counters)
608
0bedf8ff9288 basic find scp
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 565
diff changeset
324 {
0bedf8ff9288 basic find scp
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 565
diff changeset
325 DicomMap result;
0bedf8ff9288 basic find scp
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 565
diff changeset
326
0bedf8ff9288 basic find scp
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 565
diff changeset
327 for (size_t i = 0; i < query.GetSize(); i++)
0bedf8ff9288 basic find scp
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 565
diff changeset
328 {
1346
911a1ad5ebe8 re-fix issue 30
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1332
diff changeset
329 if (query.GetElement(i).GetTag() == DICOM_TAG_QUERY_RETRIEVE_LEVEL)
911a1ad5ebe8 re-fix issue 30
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1332
diff changeset
330 {
1859
4e7c318a3f69 C-FIND SCP will return tags with sequence value representation
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1856
diff changeset
331 // Fix issue 30 on Google Code (QR response missing "Query/Retrieve Level" (008,0052))
1346
911a1ad5ebe8 re-fix issue 30
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1332
diff changeset
332 result.SetValue(query.GetElement(i).GetTag(), query.GetElement(i).GetValue());
911a1ad5ebe8 re-fix issue 30
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1332
diff changeset
333 }
911a1ad5ebe8 re-fix issue 30
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1332
diff changeset
334 else if (query.GetElement(i).GetTag() == DICOM_TAG_SPECIFIC_CHARACTER_SET)
911a1ad5ebe8 re-fix issue 30
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1332
diff changeset
335 {
1859
4e7c318a3f69 C-FIND SCP will return tags with sequence value representation
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1856
diff changeset
336 // Do not include the encoding, this is handled by class ParsedDicomFile
1346
911a1ad5ebe8 re-fix issue 30
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1332
diff changeset
337 }
911a1ad5ebe8 re-fix issue 30
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1332
diff changeset
338 else
608
0bedf8ff9288 basic find scp
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 565
diff changeset
339 {
0bedf8ff9288 basic find scp
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 565
diff changeset
340 std::string tag = query.GetElement(i).GetTag().Format();
0bedf8ff9288 basic find scp
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 565
diff changeset
341 std::string value;
0bedf8ff9288 basic find scp
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 565
diff changeset
342 if (resource.isMember(tag))
0bedf8ff9288 basic find scp
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 565
diff changeset
343 {
0bedf8ff9288 basic find scp
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 565
diff changeset
344 value = resource.get(tag, Json::arrayValue).get("Value", "").asString();
0bedf8ff9288 basic find scp
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 565
diff changeset
345 result.SetValue(query.GetElement(i).GetTag(), value);
0bedf8ff9288 basic find scp
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 565
diff changeset
346 }
722
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 716
diff changeset
347 else
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 716
diff changeset
348 {
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 716
diff changeset
349 result.SetValue(query.GetElement(i).GetTag(), "");
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 716
diff changeset
350 }
608
0bedf8ff9288 basic find scp
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 565
diff changeset
351 }
0bedf8ff9288 basic find scp
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 565
diff changeset
352 }
0bedf8ff9288 basic find scp
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 565
diff changeset
353
1898
e018037d4d0e Support of optional tags for counting resources in C-Find
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1893
diff changeset
354 if (counters != NULL)
e018037d4d0e Support of optional tags for counting resources in C-Find
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1893
diff changeset
355 {
e018037d4d0e Support of optional tags for counting resources in C-Find
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1893
diff changeset
356 DicomArray tmp(*counters);
e018037d4d0e Support of optional tags for counting resources in C-Find
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1893
diff changeset
357 for (size_t i = 0; i < tmp.GetSize(); i++)
e018037d4d0e Support of optional tags for counting resources in C-Find
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1893
diff changeset
358 {
e018037d4d0e Support of optional tags for counting resources in C-Find
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1893
diff changeset
359 result.SetValue(tmp.GetElement(i).GetTag(), tmp.GetElement(i).GetValue().GetContent());
e018037d4d0e Support of optional tags for counting resources in C-Find
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1893
diff changeset
360 }
e018037d4d0e Support of optional tags for counting resources in C-Find
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1893
diff changeset
361 }
e018037d4d0e Support of optional tags for counting resources in C-Find
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1893
diff changeset
362
1859
4e7c318a3f69 C-FIND SCP will return tags with sequence value representation
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1856
diff changeset
363 if (result.GetSize() == 0 &&
4e7c318a3f69 C-FIND SCP will return tags with sequence value representation
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1856
diff changeset
364 sequencesToReturn.empty())
1331
77e129ba64e4 Prevent freeze on C-FIND if no DICOM tag is to be returned
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1288
diff changeset
365 {
1361
94ffb597d297 refactoring of C-Find SCP
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1354
diff changeset
366 LOG(WARNING) << "The C-FIND request does not return any DICOM tag";
1331
77e129ba64e4 Prevent freeze on C-FIND if no DICOM tag is to be returned
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1288
diff changeset
367 }
1859
4e7c318a3f69 C-FIND SCP will return tags with sequence value representation
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1856
diff changeset
368 else if (sequencesToReturn.empty())
4e7c318a3f69 C-FIND SCP will return tags with sequence value representation
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1856
diff changeset
369 {
4e7c318a3f69 C-FIND SCP will return tags with sequence value representation
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1856
diff changeset
370 answers.Add(result);
4e7c318a3f69 C-FIND SCP will return tags with sequence value representation
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1856
diff changeset
371 }
1331
77e129ba64e4 Prevent freeze on C-FIND if no DICOM tag is to be returned
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1288
diff changeset
372 else
77e129ba64e4 Prevent freeze on C-FIND if no DICOM tag is to be returned
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1288
diff changeset
373 {
1859
4e7c318a3f69 C-FIND SCP will return tags with sequence value representation
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1856
diff changeset
374 ParsedDicomFile dicom(result);
4e7c318a3f69 C-FIND SCP will return tags with sequence value representation
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1856
diff changeset
375
4e7c318a3f69 C-FIND SCP will return tags with sequence value representation
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1856
diff changeset
376 for (std::list<DicomTag>::const_iterator tag = sequencesToReturn.begin();
4e7c318a3f69 C-FIND SCP will return tags with sequence value representation
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1856
diff changeset
377 tag != sequencesToReturn.end(); ++tag)
4e7c318a3f69 C-FIND SCP will return tags with sequence value representation
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1856
diff changeset
378 {
4e7c318a3f69 C-FIND SCP will return tags with sequence value representation
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1856
diff changeset
379 const Json::Value& source = resource[tag->Format()];
4e7c318a3f69 C-FIND SCP will return tags with sequence value representation
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1856
diff changeset
380
4e7c318a3f69 C-FIND SCP will return tags with sequence value representation
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1856
diff changeset
381 if (source.type() == Json::objectValue &&
4e7c318a3f69 C-FIND SCP will return tags with sequence value representation
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1856
diff changeset
382 source.isMember("Type") &&
4e7c318a3f69 C-FIND SCP will return tags with sequence value representation
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1856
diff changeset
383 source.isMember("Value") &&
4e7c318a3f69 C-FIND SCP will return tags with sequence value representation
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1856
diff changeset
384 source["Type"].asString() == "Sequence" &&
4e7c318a3f69 C-FIND SCP will return tags with sequence value representation
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1856
diff changeset
385 source["Value"].type() == Json::arrayValue)
4e7c318a3f69 C-FIND SCP will return tags with sequence value representation
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1856
diff changeset
386 {
4e7c318a3f69 C-FIND SCP will return tags with sequence value representation
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1856
diff changeset
387 Json::Value content = Json::arrayValue;
4e7c318a3f69 C-FIND SCP will return tags with sequence value representation
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1856
diff changeset
388
4e7c318a3f69 C-FIND SCP will return tags with sequence value representation
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1856
diff changeset
389 for (Json::Value::ArrayIndex i = 0; i < source["Value"].size(); i++)
4e7c318a3f69 C-FIND SCP will return tags with sequence value representation
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1856
diff changeset
390 {
4e7c318a3f69 C-FIND SCP will return tags with sequence value representation
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1856
diff changeset
391 Json::Value item;
4e7c318a3f69 C-FIND SCP will return tags with sequence value representation
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1856
diff changeset
392 Toolbox::SimplifyTags(item, source["Value"][i], DicomToJsonFormat_Short);
4e7c318a3f69 C-FIND SCP will return tags with sequence value representation
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1856
diff changeset
393 content.append(item);
4e7c318a3f69 C-FIND SCP will return tags with sequence value representation
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1856
diff changeset
394 }
4e7c318a3f69 C-FIND SCP will return tags with sequence value representation
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1856
diff changeset
395
4e7c318a3f69 C-FIND SCP will return tags with sequence value representation
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1856
diff changeset
396 dicom.Replace(*tag, content, false);
4e7c318a3f69 C-FIND SCP will return tags with sequence value representation
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1856
diff changeset
397 }
4e7c318a3f69 C-FIND SCP will return tags with sequence value representation
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1856
diff changeset
398 }
4e7c318a3f69 C-FIND SCP will return tags with sequence value representation
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1856
diff changeset
399
4e7c318a3f69 C-FIND SCP will return tags with sequence value representation
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1856
diff changeset
400 answers.Add(dicom);
1331
77e129ba64e4 Prevent freeze on C-FIND if no DICOM tag is to be returned
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1288
diff changeset
401 }
608
0bedf8ff9288 basic find scp
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 565
diff changeset
402 }
0bedf8ff9288 basic find scp
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 565
diff changeset
403
0bedf8ff9288 basic find scp
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 565
diff changeset
404
1851
d364926389e0 OrthancFindRequestHandler::FilterQueryTag
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1800
diff changeset
405
d364926389e0 OrthancFindRequestHandler::FilterQueryTag
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1800
diff changeset
406 bool OrthancFindRequestHandler::FilterQueryTag(std::string& value /* can be modified */,
d364926389e0 OrthancFindRequestHandler::FilterQueryTag
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1800
diff changeset
407 ResourceType level,
d364926389e0 OrthancFindRequestHandler::FilterQueryTag
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1800
diff changeset
408 const DicomTag& tag,
d364926389e0 OrthancFindRequestHandler::FilterQueryTag
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1800
diff changeset
409 ModalityManufacturer manufacturer)
d364926389e0 OrthancFindRequestHandler::FilterQueryTag
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1800
diff changeset
410 {
1853
b7d3d3b182cf two patches for manufacturers Efilm and Vitrea
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1851
diff changeset
411 switch (manufacturer)
b7d3d3b182cf two patches for manufacturers Efilm and Vitrea
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1851
diff changeset
412 {
1856
36ab170733d6 Made eFilm version explicit
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1853
diff changeset
413 case ModalityManufacturer_EFilm2:
1853
b7d3d3b182cf two patches for manufacturers Efilm and Vitrea
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1851
diff changeset
414 // Following Denis Nesterov's mail on 2015-11-30
b7d3d3b182cf two patches for manufacturers Efilm and Vitrea
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1851
diff changeset
415 if (tag == DicomTag(0x0008, 0x0000) || // "GenericGroupLength"
b7d3d3b182cf two patches for manufacturers Efilm and Vitrea
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1851
diff changeset
416 tag == DicomTag(0x0010, 0x0000) || // "GenericGroupLength"
b7d3d3b182cf two patches for manufacturers Efilm and Vitrea
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1851
diff changeset
417 tag == DicomTag(0x0020, 0x0000)) // "GenericGroupLength"
b7d3d3b182cf two patches for manufacturers Efilm and Vitrea
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1851
diff changeset
418 {
b7d3d3b182cf two patches for manufacturers Efilm and Vitrea
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1851
diff changeset
419 return false;
b7d3d3b182cf two patches for manufacturers Efilm and Vitrea
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1851
diff changeset
420 }
b7d3d3b182cf two patches for manufacturers Efilm and Vitrea
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1851
diff changeset
421
b7d3d3b182cf two patches for manufacturers Efilm and Vitrea
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1851
diff changeset
422 break;
b7d3d3b182cf two patches for manufacturers Efilm and Vitrea
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1851
diff changeset
423
b7d3d3b182cf two patches for manufacturers Efilm and Vitrea
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1851
diff changeset
424 case ModalityManufacturer_Vitrea:
b7d3d3b182cf two patches for manufacturers Efilm and Vitrea
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1851
diff changeset
425 // Following Denis Nesterov's mail on 2015-11-30
b7d3d3b182cf two patches for manufacturers Efilm and Vitrea
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1851
diff changeset
426 if (tag == DicomTag(0x5653, 0x0010)) // "PrivateCreator = Vital Images SW 3.4"
b7d3d3b182cf two patches for manufacturers Efilm and Vitrea
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1851
diff changeset
427 {
b7d3d3b182cf two patches for manufacturers Efilm and Vitrea
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1851
diff changeset
428 return false;
b7d3d3b182cf two patches for manufacturers Efilm and Vitrea
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1851
diff changeset
429 }
b7d3d3b182cf two patches for manufacturers Efilm and Vitrea
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1851
diff changeset
430
b7d3d3b182cf two patches for manufacturers Efilm and Vitrea
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1851
diff changeset
431 break;
b7d3d3b182cf two patches for manufacturers Efilm and Vitrea
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1851
diff changeset
432
b7d3d3b182cf two patches for manufacturers Efilm and Vitrea
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1851
diff changeset
433 default:
b7d3d3b182cf two patches for manufacturers Efilm and Vitrea
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1851
diff changeset
434 break;
b7d3d3b182cf two patches for manufacturers Efilm and Vitrea
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1851
diff changeset
435 }
b7d3d3b182cf two patches for manufacturers Efilm and Vitrea
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1851
diff changeset
436
1851
d364926389e0 OrthancFindRequestHandler::FilterQueryTag
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1800
diff changeset
437 return true;
d364926389e0 OrthancFindRequestHandler::FilterQueryTag
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1800
diff changeset
438 }
d364926389e0 OrthancFindRequestHandler::FilterQueryTag
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1800
diff changeset
439
d364926389e0 OrthancFindRequestHandler::FilterQueryTag
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1800
diff changeset
440
1888
512b6e76f531 Lua: "IncomingFindRequestFilter()" to apply filters to incoming C-Find requests
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1859
diff changeset
441 bool OrthancFindRequestHandler::ApplyLuaFilter(DicomMap& target,
512b6e76f531 Lua: "IncomingFindRequestFilter()" to apply filters to incoming C-Find requests
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1859
diff changeset
442 const DicomMap& source,
512b6e76f531 Lua: "IncomingFindRequestFilter()" to apply filters to incoming C-Find requests
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1859
diff changeset
443 const std::string& remoteIp,
512b6e76f531 Lua: "IncomingFindRequestFilter()" to apply filters to incoming C-Find requests
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1859
diff changeset
444 const std::string& remoteAet,
512b6e76f531 Lua: "IncomingFindRequestFilter()" to apply filters to incoming C-Find requests
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1859
diff changeset
445 const std::string& calledAet)
512b6e76f531 Lua: "IncomingFindRequestFilter()" to apply filters to incoming C-Find requests
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1859
diff changeset
446 {
512b6e76f531 Lua: "IncomingFindRequestFilter()" to apply filters to incoming C-Find requests
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1859
diff changeset
447 Json::Value output;
512b6e76f531 Lua: "IncomingFindRequestFilter()" to apply filters to incoming C-Find requests
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1859
diff changeset
448
512b6e76f531 Lua: "IncomingFindRequestFilter()" to apply filters to incoming C-Find requests
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1859
diff changeset
449 {
512b6e76f531 Lua: "IncomingFindRequestFilter()" to apply filters to incoming C-Find requests
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1859
diff changeset
450 LuaScripting::Locker locker(context_.GetLua());
1893
d7f63122c7f3 cppcheck
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1888
diff changeset
451 static const char* NAME = "IncomingFindRequestFilter";
1888
512b6e76f531 Lua: "IncomingFindRequestFilter()" to apply filters to incoming C-Find requests
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1859
diff changeset
452
512b6e76f531 Lua: "IncomingFindRequestFilter()" to apply filters to incoming C-Find requests
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1859
diff changeset
453 if (!locker.GetLua().IsExistingFunction(NAME))
512b6e76f531 Lua: "IncomingFindRequestFilter()" to apply filters to incoming C-Find requests
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1859
diff changeset
454 {
512b6e76f531 Lua: "IncomingFindRequestFilter()" to apply filters to incoming C-Find requests
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1859
diff changeset
455 return false;
512b6e76f531 Lua: "IncomingFindRequestFilter()" to apply filters to incoming C-Find requests
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1859
diff changeset
456 }
512b6e76f531 Lua: "IncomingFindRequestFilter()" to apply filters to incoming C-Find requests
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1859
diff changeset
457
512b6e76f531 Lua: "IncomingFindRequestFilter()" to apply filters to incoming C-Find requests
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1859
diff changeset
458 Json::Value tmp = Json::objectValue;
512b6e76f531 Lua: "IncomingFindRequestFilter()" to apply filters to incoming C-Find requests
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1859
diff changeset
459 DicomArray a(source);
512b6e76f531 Lua: "IncomingFindRequestFilter()" to apply filters to incoming C-Find requests
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1859
diff changeset
460
512b6e76f531 Lua: "IncomingFindRequestFilter()" to apply filters to incoming C-Find requests
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1859
diff changeset
461 for (size_t i = 0; i < a.GetSize(); i++)
512b6e76f531 Lua: "IncomingFindRequestFilter()" to apply filters to incoming C-Find requests
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1859
diff changeset
462 {
512b6e76f531 Lua: "IncomingFindRequestFilter()" to apply filters to incoming C-Find requests
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1859
diff changeset
463 const DicomValue& v = a.GetElement(i).GetValue();
512b6e76f531 Lua: "IncomingFindRequestFilter()" to apply filters to incoming C-Find requests
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1859
diff changeset
464 std::string s = (v.IsNull() || v.IsBinary()) ? "" : v.GetContent();
512b6e76f531 Lua: "IncomingFindRequestFilter()" to apply filters to incoming C-Find requests
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1859
diff changeset
465 tmp[a.GetElement(i).GetTag().Format()] = s;
512b6e76f531 Lua: "IncomingFindRequestFilter()" to apply filters to incoming C-Find requests
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1859
diff changeset
466 }
512b6e76f531 Lua: "IncomingFindRequestFilter()" to apply filters to incoming C-Find requests
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1859
diff changeset
467
512b6e76f531 Lua: "IncomingFindRequestFilter()" to apply filters to incoming C-Find requests
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1859
diff changeset
468 Json::Value origin = Json::objectValue;
512b6e76f531 Lua: "IncomingFindRequestFilter()" to apply filters to incoming C-Find requests
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1859
diff changeset
469 origin["RemoteIp"] = remoteIp;
512b6e76f531 Lua: "IncomingFindRequestFilter()" to apply filters to incoming C-Find requests
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1859
diff changeset
470 origin["RemoteAet"] = remoteAet;
512b6e76f531 Lua: "IncomingFindRequestFilter()" to apply filters to incoming C-Find requests
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1859
diff changeset
471 origin["CalledAet"] = calledAet;
512b6e76f531 Lua: "IncomingFindRequestFilter()" to apply filters to incoming C-Find requests
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1859
diff changeset
472
512b6e76f531 Lua: "IncomingFindRequestFilter()" to apply filters to incoming C-Find requests
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1859
diff changeset
473 LuaFunctionCall call(locker.GetLua(), NAME);
512b6e76f531 Lua: "IncomingFindRequestFilter()" to apply filters to incoming C-Find requests
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1859
diff changeset
474 call.PushJson(tmp);
512b6e76f531 Lua: "IncomingFindRequestFilter()" to apply filters to incoming C-Find requests
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1859
diff changeset
475 call.PushJson(origin);
512b6e76f531 Lua: "IncomingFindRequestFilter()" to apply filters to incoming C-Find requests
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1859
diff changeset
476
512b6e76f531 Lua: "IncomingFindRequestFilter()" to apply filters to incoming C-Find requests
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1859
diff changeset
477 call.ExecuteToJson(output, true);
512b6e76f531 Lua: "IncomingFindRequestFilter()" to apply filters to incoming C-Find requests
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1859
diff changeset
478 }
512b6e76f531 Lua: "IncomingFindRequestFilter()" to apply filters to incoming C-Find requests
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1859
diff changeset
479
512b6e76f531 Lua: "IncomingFindRequestFilter()" to apply filters to incoming C-Find requests
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1859
diff changeset
480 // The Lua context is released at this point
512b6e76f531 Lua: "IncomingFindRequestFilter()" to apply filters to incoming C-Find requests
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1859
diff changeset
481
512b6e76f531 Lua: "IncomingFindRequestFilter()" to apply filters to incoming C-Find requests
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1859
diff changeset
482 if (output.type() != Json::objectValue)
512b6e76f531 Lua: "IncomingFindRequestFilter()" to apply filters to incoming C-Find requests
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1859
diff changeset
483 {
512b6e76f531 Lua: "IncomingFindRequestFilter()" to apply filters to incoming C-Find requests
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1859
diff changeset
484 LOG(ERROR) << "Lua: IncomingFindRequestFilter must return a table";
512b6e76f531 Lua: "IncomingFindRequestFilter()" to apply filters to incoming C-Find requests
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1859
diff changeset
485 throw OrthancException(ErrorCode_LuaBadOutput);
512b6e76f531 Lua: "IncomingFindRequestFilter()" to apply filters to incoming C-Find requests
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1859
diff changeset
486 }
512b6e76f531 Lua: "IncomingFindRequestFilter()" to apply filters to incoming C-Find requests
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1859
diff changeset
487
512b6e76f531 Lua: "IncomingFindRequestFilter()" to apply filters to incoming C-Find requests
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1859
diff changeset
488 Json::Value::Members members = output.getMemberNames();
512b6e76f531 Lua: "IncomingFindRequestFilter()" to apply filters to incoming C-Find requests
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1859
diff changeset
489
512b6e76f531 Lua: "IncomingFindRequestFilter()" to apply filters to incoming C-Find requests
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1859
diff changeset
490 for (size_t i = 0; i < members.size(); i++)
512b6e76f531 Lua: "IncomingFindRequestFilter()" to apply filters to incoming C-Find requests
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1859
diff changeset
491 {
512b6e76f531 Lua: "IncomingFindRequestFilter()" to apply filters to incoming C-Find requests
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1859
diff changeset
492 if (output[members[i]].type() != Json::stringValue)
512b6e76f531 Lua: "IncomingFindRequestFilter()" to apply filters to incoming C-Find requests
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1859
diff changeset
493 {
512b6e76f531 Lua: "IncomingFindRequestFilter()" to apply filters to incoming C-Find requests
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1859
diff changeset
494 LOG(ERROR) << "Lua: IncomingFindRequestFilter must return a table mapping names of DICOM tags to strings";
512b6e76f531 Lua: "IncomingFindRequestFilter()" to apply filters to incoming C-Find requests
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1859
diff changeset
495 throw OrthancException(ErrorCode_LuaBadOutput);
512b6e76f531 Lua: "IncomingFindRequestFilter()" to apply filters to incoming C-Find requests
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1859
diff changeset
496 }
512b6e76f531 Lua: "IncomingFindRequestFilter()" to apply filters to incoming C-Find requests
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1859
diff changeset
497
512b6e76f531 Lua: "IncomingFindRequestFilter()" to apply filters to incoming C-Find requests
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1859
diff changeset
498 DicomTag tag(FromDcmtkBridge::ParseTag(members[i]));
512b6e76f531 Lua: "IncomingFindRequestFilter()" to apply filters to incoming C-Find requests
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1859
diff changeset
499 target.SetValue(tag, output[members[i]].asString());
512b6e76f531 Lua: "IncomingFindRequestFilter()" to apply filters to incoming C-Find requests
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1859
diff changeset
500 }
512b6e76f531 Lua: "IncomingFindRequestFilter()" to apply filters to incoming C-Find requests
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1859
diff changeset
501
512b6e76f531 Lua: "IncomingFindRequestFilter()" to apply filters to incoming C-Find requests
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1859
diff changeset
502 return true;
512b6e76f531 Lua: "IncomingFindRequestFilter()" to apply filters to incoming C-Find requests
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1859
diff changeset
503 }
512b6e76f531 Lua: "IncomingFindRequestFilter()" to apply filters to incoming C-Find requests
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1859
diff changeset
504
512b6e76f531 Lua: "IncomingFindRequestFilter()" to apply filters to incoming C-Find requests
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1859
diff changeset
505
1800
30e97a1f4093 callback for handling worklists with plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1799
diff changeset
506 void OrthancFindRequestHandler::Handle(DicomFindAnswers& answers,
665
41b3e5ccb291 fix for medInria
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 656
diff changeset
507 const DicomMap& input,
1859
4e7c318a3f69 C-FIND SCP will return tags with sequence value representation
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1856
diff changeset
508 const std::list<DicomTag>& sequencesToReturn,
1573
3309878b3e16 more information about the origin of requests submitted to the DICOM handlers
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1486
diff changeset
509 const std::string& remoteIp,
1799
4f01c9d73f02 calledAet made available to all the handlers
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1759
diff changeset
510 const std::string& remoteAet,
4f01c9d73f02 calledAet made available to all the handlers
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1759
diff changeset
511 const std::string& calledAet)
565
c931ac02db82 refactoring of find class
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
512 {
c931ac02db82 refactoring of find class
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
513 /**
1799
4f01c9d73f02 calledAet made available to all the handlers
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1759
diff changeset
514 * Ensure that the remote modality is known to Orthanc.
665
41b3e5ccb291 fix for medInria
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 656
diff changeset
515 **/
41b3e5ccb291 fix for medInria
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 656
diff changeset
516
1361
94ffb597d297 refactoring of C-Find SCP
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1354
diff changeset
517 RemoteModalityParameters modality;
665
41b3e5ccb291 fix for medInria
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 656
diff changeset
518
1573
3309878b3e16 more information about the origin of requests submitted to the DICOM handlers
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1486
diff changeset
519 if (!Configuration::LookupDicomModalityUsingAETitle(modality, remoteAet))
1361
94ffb597d297 refactoring of C-Find SCP
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1354
diff changeset
520 {
1582
bd1889029cbb encoding of exceptions
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1573
diff changeset
521 throw OrthancException(ErrorCode_UnknownModality);
1361
94ffb597d297 refactoring of C-Find SCP
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1354
diff changeset
522 }
806
557575fd93e9 refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 795
diff changeset
523
1382
1cd2e09cb0e5 case insensitive search by default
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1374
diff changeset
524 bool caseSensitivePN = Configuration::GetGlobalBoolParameter("CaseSensitivePN", false);
1374
a1745d9be6e9 CaseSensitivePN configuration option
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1361
diff changeset
525
665
41b3e5ccb291 fix for medInria
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 656
diff changeset
526
41b3e5ccb291 fix for medInria
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 656
diff changeset
527 /**
1888
512b6e76f531 Lua: "IncomingFindRequestFilter()" to apply filters to incoming C-Find requests
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1859
diff changeset
528 * Possibly apply the user-supplied Lua filter.
512b6e76f531 Lua: "IncomingFindRequestFilter()" to apply filters to incoming C-Find requests
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1859
diff changeset
529 **/
512b6e76f531 Lua: "IncomingFindRequestFilter()" to apply filters to incoming C-Find requests
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1859
diff changeset
530
512b6e76f531 Lua: "IncomingFindRequestFilter()" to apply filters to incoming C-Find requests
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1859
diff changeset
531 DicomMap lua;
512b6e76f531 Lua: "IncomingFindRequestFilter()" to apply filters to incoming C-Find requests
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1859
diff changeset
532 const DicomMap* filteredInput = &input;
512b6e76f531 Lua: "IncomingFindRequestFilter()" to apply filters to incoming C-Find requests
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1859
diff changeset
533
512b6e76f531 Lua: "IncomingFindRequestFilter()" to apply filters to incoming C-Find requests
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1859
diff changeset
534 if (ApplyLuaFilter(lua, input, remoteIp, remoteAet, calledAet))
512b6e76f531 Lua: "IncomingFindRequestFilter()" to apply filters to incoming C-Find requests
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1859
diff changeset
535 {
512b6e76f531 Lua: "IncomingFindRequestFilter()" to apply filters to incoming C-Find requests
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1859
diff changeset
536 filteredInput = &lua;
512b6e76f531 Lua: "IncomingFindRequestFilter()" to apply filters to incoming C-Find requests
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1859
diff changeset
537 }
512b6e76f531 Lua: "IncomingFindRequestFilter()" to apply filters to incoming C-Find requests
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1859
diff changeset
538
512b6e76f531 Lua: "IncomingFindRequestFilter()" to apply filters to incoming C-Find requests
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1859
diff changeset
539
512b6e76f531 Lua: "IncomingFindRequestFilter()" to apply filters to incoming C-Find requests
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1859
diff changeset
540 /**
565
c931ac02db82 refactoring of find class
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
541 * Retrieve the query level.
c931ac02db82 refactoring of find class
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
542 **/
c931ac02db82 refactoring of find class
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
543
1888
512b6e76f531 Lua: "IncomingFindRequestFilter()" to apply filters to incoming C-Find requests
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1859
diff changeset
544 assert(filteredInput != NULL);
512b6e76f531 Lua: "IncomingFindRequestFilter()" to apply filters to incoming C-Find requests
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1859
diff changeset
545 const DicomValue* levelTmp = filteredInput->TestAndGetValue(DICOM_TAG_QUERY_RETRIEVE_LEVEL);
1737
ec66a16aa398 removal of DicomStringValue and DicomNullValue
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1582
diff changeset
546 if (levelTmp == NULL ||
ec66a16aa398 removal of DicomStringValue and DicomNullValue
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1582
diff changeset
547 levelTmp->IsNull() ||
ec66a16aa398 removal of DicomStringValue and DicomNullValue
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1582
diff changeset
548 levelTmp->IsBinary())
565
c931ac02db82 refactoring of find class
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
549 {
1851
d364926389e0 OrthancFindRequestHandler::FilterQueryTag
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1800
diff changeset
550 LOG(ERROR) << "C-FIND request without the tag 0008,0052 (QueryRetrieveLevel)";
565
c931ac02db82 refactoring of find class
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
551 throw OrthancException(ErrorCode_BadRequest);
c931ac02db82 refactoring of find class
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
552 }
c931ac02db82 refactoring of find class
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
553
1737
ec66a16aa398 removal of DicomStringValue and DicomNullValue
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1582
diff changeset
554 ResourceType level = StringToResourceType(levelTmp->GetContent().c_str());
565
c931ac02db82 refactoring of find class
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
555
714
6a1dbba0cca7 new implementation of C-Find handler
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 690
diff changeset
556 if (level != ResourceType_Patient &&
6a1dbba0cca7 new implementation of C-Find handler
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 690
diff changeset
557 level != ResourceType_Study &&
6a1dbba0cca7 new implementation of C-Find handler
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 690
diff changeset
558 level != ResourceType_Series &&
6a1dbba0cca7 new implementation of C-Find handler
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 690
diff changeset
559 level != ResourceType_Instance)
565
c931ac02db82 refactoring of find class
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
560 {
714
6a1dbba0cca7 new implementation of C-Find handler
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 690
diff changeset
561 throw OrthancException(ErrorCode_NotImplemented);
6a1dbba0cca7 new implementation of C-Find handler
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 690
diff changeset
562 }
6a1dbba0cca7 new implementation of C-Find handler
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 690
diff changeset
563
665
41b3e5ccb291 fix for medInria
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 656
diff changeset
564
1888
512b6e76f531 Lua: "IncomingFindRequestFilter()" to apply filters to incoming C-Find requests
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1859
diff changeset
565 DicomArray query(*filteredInput);
714
6a1dbba0cca7 new implementation of C-Find handler
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 690
diff changeset
566 LOG(INFO) << "DICOM C-Find request at level: " << EnumerationToString(level);
6a1dbba0cca7 new implementation of C-Find handler
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 690
diff changeset
567
6a1dbba0cca7 new implementation of C-Find handler
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 690
diff changeset
568 for (size_t i = 0; i < query.GetSize(); i++)
6a1dbba0cca7 new implementation of C-Find handler
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 690
diff changeset
569 {
6a1dbba0cca7 new implementation of C-Find handler
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 690
diff changeset
570 if (!query.GetElement(i).GetValue().IsNull())
6a1dbba0cca7 new implementation of C-Find handler
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 690
diff changeset
571 {
6a1dbba0cca7 new implementation of C-Find handler
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 690
diff changeset
572 LOG(INFO) << " " << query.GetElement(i).GetTag()
6a1dbba0cca7 new implementation of C-Find handler
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 690
diff changeset
573 << " " << FromDcmtkBridge::GetName(query.GetElement(i).GetTag())
1737
ec66a16aa398 removal of DicomStringValue and DicomNullValue
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1582
diff changeset
574 << " = " << query.GetElement(i).GetValue().GetContent();
714
6a1dbba0cca7 new implementation of C-Find handler
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 690
diff changeset
575 }
565
c931ac02db82 refactoring of find class
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
576 }
c931ac02db82 refactoring of find class
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
577
1859
4e7c318a3f69 C-FIND SCP will return tags with sequence value representation
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1856
diff changeset
578 for (std::list<DicomTag>::const_iterator it = sequencesToReturn.begin();
4e7c318a3f69 C-FIND SCP will return tags with sequence value representation
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1856
diff changeset
579 it != sequencesToReturn.end(); ++it)
4e7c318a3f69 C-FIND SCP will return tags with sequence value representation
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1856
diff changeset
580 {
4e7c318a3f69 C-FIND SCP will return tags with sequence value representation
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1856
diff changeset
581 LOG(INFO) << " (" << it->Format()
4e7c318a3f69 C-FIND SCP will return tags with sequence value representation
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1856
diff changeset
582 << ") " << FromDcmtkBridge::GetName(*it)
4e7c318a3f69 C-FIND SCP will return tags with sequence value representation
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1856
diff changeset
583 << " : sequence tag whose content will be copied";
4e7c318a3f69 C-FIND SCP will return tags with sequence value representation
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1856
diff changeset
584 }
4e7c318a3f69 C-FIND SCP will return tags with sequence value representation
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1856
diff changeset
585
565
c931ac02db82 refactoring of find class
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
586
c931ac02db82 refactoring of find class
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
587 /**
1361
94ffb597d297 refactoring of C-Find SCP
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1354
diff changeset
588 * Build up the query object.
608
0bedf8ff9288 basic find scp
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 565
diff changeset
589 **/
0bedf8ff9288 basic find scp
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 565
diff changeset
590
1751
fb569ee09a69 LookupResource complete
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1737
diff changeset
591 LookupResource finder(level);
1759
e268412adcf1 removal of old implementation of search
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1758
diff changeset
592
1361
94ffb597d297 refactoring of C-Find SCP
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1354
diff changeset
593 for (size_t i = 0; i < query.GetSize(); i++)
714
6a1dbba0cca7 new implementation of C-Find handler
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 690
diff changeset
594 {
1361
94ffb597d297 refactoring of C-Find SCP
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1354
diff changeset
595 const DicomTag tag = query.GetElement(i).GetTag();
714
6a1dbba0cca7 new implementation of C-Find handler
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 690
diff changeset
596
1361
94ffb597d297 refactoring of C-Find SCP
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1354
diff changeset
597 if (query.GetElement(i).GetValue().IsNull() ||
94ffb597d297 refactoring of C-Find SCP
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1354
diff changeset
598 tag == DICOM_TAG_QUERY_RETRIEVE_LEVEL ||
94ffb597d297 refactoring of C-Find SCP
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1354
diff changeset
599 tag == DICOM_TAG_SPECIFIC_CHARACTER_SET)
714
6a1dbba0cca7 new implementation of C-Find handler
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 690
diff changeset
600 {
1361
94ffb597d297 refactoring of C-Find SCP
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1354
diff changeset
601 continue;
714
6a1dbba0cca7 new implementation of C-Find handler
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 690
diff changeset
602 }
6a1dbba0cca7 new implementation of C-Find handler
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 690
diff changeset
603
1737
ec66a16aa398 removal of DicomStringValue and DicomNullValue
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1582
diff changeset
604 std::string value = query.GetElement(i).GetValue().GetContent();
1429
7366a0bdda6a attempt of fix for Syngo.Via
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1383
diff changeset
605 if (value.size() == 0)
7366a0bdda6a attempt of fix for Syngo.Via
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1383
diff changeset
606 {
7366a0bdda6a attempt of fix for Syngo.Via
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1383
diff changeset
607 // An empty string corresponds to a "*" wildcard constraint, so we ignore it
7366a0bdda6a attempt of fix for Syngo.Via
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1383
diff changeset
608 continue;
7366a0bdda6a attempt of fix for Syngo.Via
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1383
diff changeset
609 }
611
9924aec1d694 filtering on modalities
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 610
diff changeset
610
1851
d364926389e0 OrthancFindRequestHandler::FilterQueryTag
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1800
diff changeset
611 if (FilterQueryTag(value, level, tag, modality.GetManufacturer()))
d364926389e0 OrthancFindRequestHandler::FilterQueryTag
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1800
diff changeset
612 {
d364926389e0 OrthancFindRequestHandler::FilterQueryTag
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1800
diff changeset
613 ValueRepresentation vr = FromDcmtkBridge::GetValueRepresentation(tag);
1758
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1757
diff changeset
614
1851
d364926389e0 OrthancFindRequestHandler::FilterQueryTag
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1800
diff changeset
615 // DICOM specifies that searches must be case sensitive, except
d364926389e0 OrthancFindRequestHandler::FilterQueryTag
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1800
diff changeset
616 // for tags with a PN value representation
d364926389e0 OrthancFindRequestHandler::FilterQueryTag
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1800
diff changeset
617 bool sensitive = true;
d364926389e0 OrthancFindRequestHandler::FilterQueryTag
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1800
diff changeset
618 if (vr == ValueRepresentation_PatientName)
d364926389e0 OrthancFindRequestHandler::FilterQueryTag
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1800
diff changeset
619 {
d364926389e0 OrthancFindRequestHandler::FilterQueryTag
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1800
diff changeset
620 sensitive = caseSensitivePN;
d364926389e0 OrthancFindRequestHandler::FilterQueryTag
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1800
diff changeset
621 }
d364926389e0 OrthancFindRequestHandler::FilterQueryTag
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1800
diff changeset
622
d364926389e0 OrthancFindRequestHandler::FilterQueryTag
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1800
diff changeset
623 finder.AddDicomConstraint(tag, value, sensitive);
d364926389e0 OrthancFindRequestHandler::FilterQueryTag
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1800
diff changeset
624 }
d364926389e0 OrthancFindRequestHandler::FilterQueryTag
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1800
diff changeset
625 else
1758
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1757
diff changeset
626 {
1851
d364926389e0 OrthancFindRequestHandler::FilterQueryTag
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1800
diff changeset
627 LOG(INFO) << "Because of a patch for the manufacturer of the remote modality, "
d364926389e0 OrthancFindRequestHandler::FilterQueryTag
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1800
diff changeset
628 << "ignoring constraint on tag (" << tag.Format() << ") " << FromDcmtkBridge::GetName(tag);
1759
e268412adcf1 removal of old implementation of search
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1758
diff changeset
629 }
611
9924aec1d694 filtering on modalities
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 610
diff changeset
630 }
9924aec1d694 filtering on modalities
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 610
diff changeset
631
1361
94ffb597d297 refactoring of C-Find SCP
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1354
diff changeset
632
608
0bedf8ff9288 basic find scp
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 565
diff changeset
633 /**
1361
94ffb597d297 refactoring of C-Find SCP
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1354
diff changeset
634 * Run the query.
565
c931ac02db82 refactoring of find class
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
635 **/
c931ac02db82 refactoring of find class
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
636
1753
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1752
diff changeset
637 size_t maxResults = (level == ResourceType_Instance) ? maxInstances_ : maxResults_;
941
83489fddd8c5 Options to limit the number of results for an incoming C-FIND query
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 831
diff changeset
638
1753
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1752
diff changeset
639 std::vector<std::string> resources, instances;
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1752
diff changeset
640 context_.GetIndex().FindCandidates(resources, instances, finder);
1752
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1751
diff changeset
641
1753
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1752
diff changeset
642 assert(resources.size() == instances.size());
1800
30e97a1f4093 callback for handling worklists with plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1799
diff changeset
643 bool complete = true;
1753
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1752
diff changeset
644
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1752
diff changeset
645 for (size_t i = 0; i < instances.size(); i++)
1752
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1751
diff changeset
646 {
1753
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1752
diff changeset
647 Json::Value dicom;
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1752
diff changeset
648 context_.ReadJson(dicom, instances[i]);
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1752
diff changeset
649
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1752
diff changeset
650 if (finder.IsMatch(dicom))
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1752
diff changeset
651 {
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1752
diff changeset
652 if (maxResults != 0 &&
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1752
diff changeset
653 answers.GetSize() >= maxResults)
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1752
diff changeset
654 {
1800
30e97a1f4093 callback for handling worklists with plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1799
diff changeset
655 complete = false;
1753
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1752
diff changeset
656 break;
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1752
diff changeset
657 }
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1752
diff changeset
658 else
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1752
diff changeset
659 {
1898
e018037d4d0e Support of optional tags for counting resources in C-Find
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1893
diff changeset
660 std::auto_ptr<DicomMap> counters(ComputeCounters(context_, instances[i], level, input));
e018037d4d0e Support of optional tags for counting resources in C-Find
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1893
diff changeset
661 AddAnswer(answers, dicom, query, sequencesToReturn, counters.get());
1753
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1752
diff changeset
662 }
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1752
diff changeset
663 }
1752
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1751
diff changeset
664 }
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1751
diff changeset
665
1753
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1752
diff changeset
666 LOG(INFO) << "Number of matching resources: " << answers.GetSize();
1361
94ffb597d297 refactoring of C-Find SCP
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1354
diff changeset
667
1800
30e97a1f4093 callback for handling worklists with plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1799
diff changeset
668 answers.SetComplete(complete);
565
c931ac02db82 refactoring of find class
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
669 }
c931ac02db82 refactoring of find class
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
670 }