Mercurial > hg > orthanc
annotate OrthancServer/Sources/Database/Compatibility/GenericFind.cpp @ 5847:70a879a7b658 find-refactoring
introduction of IDatabaseWrapper::ICompatibilityTransaction
author | Sebastien Jodogne <s.jodogne@gmail.com> |
---|---|
date | Tue, 29 Oct 2024 13:46:29 +0000 |
parents | b24b61331566 |
children | 0f4345cbe558 |
rev | line source |
---|---|
5554
12d8a1a266e9
introduction of FindRequest and FindResponse
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1 /** |
12d8a1a266e9
introduction of FindRequest and FindResponse
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
2 * Orthanc - A Lightweight, RESTful DICOM Store |
12d8a1a266e9
introduction of FindRequest and FindResponse
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
3 * Copyright (C) 2012-2016 Sebastien Jodogne, Medical Physics |
12d8a1a266e9
introduction of FindRequest and FindResponse
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
4 * Department, University Hospital of Liege, Belgium |
5641
3f13db27b399
integration mainline->find-refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5621
diff
changeset
|
5 * Copyright (C) 2017-2023 Osimis S.A., Belgium |
3f13db27b399
integration mainline->find-refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5621
diff
changeset
|
6 * Copyright (C) 2024-2024 Orthanc Team SRL, Belgium |
5554
12d8a1a266e9
introduction of FindRequest and FindResponse
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
7 * Copyright (C) 2021-2024 Sebastien Jodogne, ICTEAM UCLouvain, Belgium |
12d8a1a266e9
introduction of FindRequest and FindResponse
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
8 * |
12d8a1a266e9
introduction of FindRequest and FindResponse
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
9 * This program is free software: you can redistribute it and/or |
12d8a1a266e9
introduction of FindRequest and FindResponse
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
10 * modify it under the terms of the GNU General Public License as |
12d8a1a266e9
introduction of FindRequest and FindResponse
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
11 * published by the Free Software Foundation, either version 3 of the |
12d8a1a266e9
introduction of FindRequest and FindResponse
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
12 * License, or (at your option) any later version. |
12d8a1a266e9
introduction of FindRequest and FindResponse
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
13 * |
12d8a1a266e9
introduction of FindRequest and FindResponse
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
14 * This program is distributed in the hope that it will be useful, but |
12d8a1a266e9
introduction of FindRequest and FindResponse
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
15 * WITHOUT ANY WARRANTY; without even the implied warranty of |
12d8a1a266e9
introduction of FindRequest and FindResponse
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
12d8a1a266e9
introduction of FindRequest and FindResponse
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
17 * General Public License for more details. |
12d8a1a266e9
introduction of FindRequest and FindResponse
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
18 * |
12d8a1a266e9
introduction of FindRequest and FindResponse
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
19 * You should have received a copy of the GNU General Public License |
12d8a1a266e9
introduction of FindRequest and FindResponse
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
20 * along with this program. If not, see <http://www.gnu.org/licenses/>. |
12d8a1a266e9
introduction of FindRequest and FindResponse
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
21 **/ |
12d8a1a266e9
introduction of FindRequest and FindResponse
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
22 |
12d8a1a266e9
introduction of FindRequest and FindResponse
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
23 |
12d8a1a266e9
introduction of FindRequest and FindResponse
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
24 #include "GenericFind.h" |
12d8a1a266e9
introduction of FindRequest and FindResponse
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
25 |
5592
1e2631b8b9af
GenericFind::Execute() is working for a basic request
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5590
diff
changeset
|
26 #include "../../../../OrthancFramework/Sources/DicomFormat/DicomArray.h" |
5554
12d8a1a266e9
introduction of FindRequest and FindResponse
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
27 #include "../../../../OrthancFramework/Sources/OrthancException.h" |
12d8a1a266e9
introduction of FindRequest and FindResponse
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
28 |
5596
81a29ad7fb4b
added possibility to retrieve main DICOM tags and metadata at any level
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5595
diff
changeset
|
29 #include <stack> |
81a29ad7fb4b
added possibility to retrieve main DICOM tags and metadata at any level
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5595
diff
changeset
|
30 |
5554
12d8a1a266e9
introduction of FindRequest and FindResponse
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
31 |
12d8a1a266e9
introduction of FindRequest and FindResponse
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
32 namespace Orthanc |
12d8a1a266e9
introduction of FindRequest and FindResponse
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
33 { |
12d8a1a266e9
introduction of FindRequest and FindResponse
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
34 namespace Compatibility |
12d8a1a266e9
introduction of FindRequest and FindResponse
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
35 { |
5615
a10978a5e65c
expansion of single resources using ResourceFinder
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5614
diff
changeset
|
36 static bool IsRequestWithoutContraint(const FindRequest& request) |
a10978a5e65c
expansion of single resources using ResourceFinder
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5614
diff
changeset
|
37 { |
5681
77875b51cf95
integration mainline->find-refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5677
diff
changeset
|
38 return (request.GetDicomTagConstraints().IsEmpty() && |
5615
a10978a5e65c
expansion of single resources using ResourceFinder
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5614
diff
changeset
|
39 request.GetMetadataConstraintsCount() == 0 && |
a10978a5e65c
expansion of single resources using ResourceFinder
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5614
diff
changeset
|
40 request.GetLabels().empty() && |
a10978a5e65c
expansion of single resources using ResourceFinder
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5614
diff
changeset
|
41 request.GetOrdering().empty()); |
a10978a5e65c
expansion of single resources using ResourceFinder
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5614
diff
changeset
|
42 } |
a10978a5e65c
expansion of single resources using ResourceFinder
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5614
diff
changeset
|
43 |
5617
8905ffa45fc2
started listing of children resources
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5616
diff
changeset
|
44 static void GetChildren(std::list<int64_t>& target, |
8905ffa45fc2
started listing of children resources
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5616
diff
changeset
|
45 IDatabaseWrapper::ITransaction& transaction, |
8905ffa45fc2
started listing of children resources
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5616
diff
changeset
|
46 const std::list<int64_t>& resources) |
8905ffa45fc2
started listing of children resources
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5616
diff
changeset
|
47 { |
8905ffa45fc2
started listing of children resources
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5616
diff
changeset
|
48 target.clear(); |
8905ffa45fc2
started listing of children resources
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5616
diff
changeset
|
49 |
8905ffa45fc2
started listing of children resources
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5616
diff
changeset
|
50 for (std::list<int64_t>::const_iterator it = resources.begin(); it != resources.end(); ++it) |
8905ffa45fc2
started listing of children resources
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5616
diff
changeset
|
51 { |
8905ffa45fc2
started listing of children resources
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5616
diff
changeset
|
52 std::list<int64_t> tmp; |
8905ffa45fc2
started listing of children resources
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5616
diff
changeset
|
53 transaction.GetChildrenInternalId(tmp, *it); |
8905ffa45fc2
started listing of children resources
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5616
diff
changeset
|
54 target.splice(target.begin(), tmp); |
8905ffa45fc2
started listing of children resources
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5616
diff
changeset
|
55 } |
8905ffa45fc2
started listing of children resources
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5616
diff
changeset
|
56 } |
8905ffa45fc2
started listing of children resources
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5616
diff
changeset
|
57 |
8905ffa45fc2
started listing of children resources
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5616
diff
changeset
|
58 static void GetChildren(std::list<std::string>& target, |
8905ffa45fc2
started listing of children resources
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5616
diff
changeset
|
59 IDatabaseWrapper::ITransaction& transaction, |
8905ffa45fc2
started listing of children resources
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5616
diff
changeset
|
60 const std::list<int64_t>& resources) |
8905ffa45fc2
started listing of children resources
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5616
diff
changeset
|
61 { |
8905ffa45fc2
started listing of children resources
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5616
diff
changeset
|
62 target.clear(); |
8905ffa45fc2
started listing of children resources
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5616
diff
changeset
|
63 |
8905ffa45fc2
started listing of children resources
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5616
diff
changeset
|
64 for (std::list<int64_t>::const_iterator it = resources.begin(); it != resources.end(); ++it) |
8905ffa45fc2
started listing of children resources
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5616
diff
changeset
|
65 { |
8905ffa45fc2
started listing of children resources
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5616
diff
changeset
|
66 std::list<std::string> tmp; |
8905ffa45fc2
started listing of children resources
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5616
diff
changeset
|
67 transaction.GetChildrenPublicId(tmp, *it); |
8905ffa45fc2
started listing of children resources
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5616
diff
changeset
|
68 target.splice(target.begin(), tmp); |
8905ffa45fc2
started listing of children resources
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5616
diff
changeset
|
69 } |
8905ffa45fc2
started listing of children resources
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5616
diff
changeset
|
70 } |
8905ffa45fc2
started listing of children resources
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5616
diff
changeset
|
71 |
8905ffa45fc2
started listing of children resources
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5616
diff
changeset
|
72 static void GetChildrenIdentifiers(std::list<std::string>& children, |
8905ffa45fc2
started listing of children resources
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5616
diff
changeset
|
73 IDatabaseWrapper::ITransaction& transaction, |
8905ffa45fc2
started listing of children resources
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5616
diff
changeset
|
74 const OrthancIdentifiers& identifiers, |
8905ffa45fc2
started listing of children resources
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5616
diff
changeset
|
75 ResourceType topLevel, |
8905ffa45fc2
started listing of children resources
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5616
diff
changeset
|
76 ResourceType bottomLevel) |
8905ffa45fc2
started listing of children resources
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5616
diff
changeset
|
77 { |
8905ffa45fc2
started listing of children resources
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5616
diff
changeset
|
78 if (!IsResourceLevelAboveOrEqual(topLevel, bottomLevel) || |
8905ffa45fc2
started listing of children resources
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5616
diff
changeset
|
79 topLevel == bottomLevel) |
8905ffa45fc2
started listing of children resources
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5616
diff
changeset
|
80 { |
8905ffa45fc2
started listing of children resources
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5616
diff
changeset
|
81 throw OrthancException(ErrorCode_InternalError); |
8905ffa45fc2
started listing of children resources
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5616
diff
changeset
|
82 } |
8905ffa45fc2
started listing of children resources
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5616
diff
changeset
|
83 |
8905ffa45fc2
started listing of children resources
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5616
diff
changeset
|
84 std::list<int64_t> currentResources; |
8905ffa45fc2
started listing of children resources
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5616
diff
changeset
|
85 ResourceType currentLevel; |
8905ffa45fc2
started listing of children resources
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5616
diff
changeset
|
86 |
8905ffa45fc2
started listing of children resources
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5616
diff
changeset
|
87 { |
8905ffa45fc2
started listing of children resources
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5616
diff
changeset
|
88 int64_t id; |
8905ffa45fc2
started listing of children resources
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5616
diff
changeset
|
89 if (!transaction.LookupResource(id, currentLevel, identifiers.GetLevel(topLevel)) || |
8905ffa45fc2
started listing of children resources
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5616
diff
changeset
|
90 currentLevel != topLevel) |
8905ffa45fc2
started listing of children resources
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5616
diff
changeset
|
91 { |
8905ffa45fc2
started listing of children resources
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5616
diff
changeset
|
92 throw OrthancException(ErrorCode_InexistentItem); |
8905ffa45fc2
started listing of children resources
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5616
diff
changeset
|
93 } |
8905ffa45fc2
started listing of children resources
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5616
diff
changeset
|
94 |
8905ffa45fc2
started listing of children resources
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5616
diff
changeset
|
95 currentResources.push_back(id); |
8905ffa45fc2
started listing of children resources
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5616
diff
changeset
|
96 } |
8905ffa45fc2
started listing of children resources
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5616
diff
changeset
|
97 |
8905ffa45fc2
started listing of children resources
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5616
diff
changeset
|
98 while (currentLevel != bottomLevel) |
8905ffa45fc2
started listing of children resources
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5616
diff
changeset
|
99 { |
8905ffa45fc2
started listing of children resources
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5616
diff
changeset
|
100 ResourceType nextLevel = GetChildResourceType(currentLevel); |
8905ffa45fc2
started listing of children resources
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5616
diff
changeset
|
101 if (nextLevel == bottomLevel) |
8905ffa45fc2
started listing of children resources
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5616
diff
changeset
|
102 { |
8905ffa45fc2
started listing of children resources
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5616
diff
changeset
|
103 GetChildren(children, transaction, currentResources); |
8905ffa45fc2
started listing of children resources
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5616
diff
changeset
|
104 } |
8905ffa45fc2
started listing of children resources
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5616
diff
changeset
|
105 else |
8905ffa45fc2
started listing of children resources
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5616
diff
changeset
|
106 { |
8905ffa45fc2
started listing of children resources
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5616
diff
changeset
|
107 std::list<int64_t> nextResources; |
8905ffa45fc2
started listing of children resources
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5616
diff
changeset
|
108 GetChildren(nextResources, transaction, currentResources); |
8905ffa45fc2
started listing of children resources
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5616
diff
changeset
|
109 currentResources.swap(nextResources); |
8905ffa45fc2
started listing of children resources
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5616
diff
changeset
|
110 } |
8905ffa45fc2
started listing of children resources
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5616
diff
changeset
|
111 |
8905ffa45fc2
started listing of children resources
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5616
diff
changeset
|
112 currentLevel = nextLevel; |
8905ffa45fc2
started listing of children resources
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5616
diff
changeset
|
113 } |
8905ffa45fc2
started listing of children resources
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5616
diff
changeset
|
114 } |
8905ffa45fc2
started listing of children resources
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5616
diff
changeset
|
115 |
5593
862b54b4cfe2
implemented the default multi-stage find/expand
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5592
diff
changeset
|
116 void GenericFind::ExecuteFind(std::list<std::string>& identifiers, |
5720
89d559e67b03
fix compatibility with old database plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5682
diff
changeset
|
117 const IDatabaseWrapper::Capabilities& capabilities, |
89d559e67b03
fix compatibility with old database plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5682
diff
changeset
|
118 const FindRequest& request) |
5554
12d8a1a266e9
introduction of FindRequest and FindResponse
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
119 { |
5677
dc96401dbe88
starting the refactoring of /tools/find
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5676
diff
changeset
|
120 if (!request.GetLabels().empty() && |
dc96401dbe88
starting the refactoring of /tools/find
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5676
diff
changeset
|
121 !capabilities.HasLabelsSupport()) |
dc96401dbe88
starting the refactoring of /tools/find
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5676
diff
changeset
|
122 { |
dc96401dbe88
starting the refactoring of /tools/find
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5676
diff
changeset
|
123 throw OrthancException(ErrorCode_NotImplemented, "The database backend doesn't support labels"); |
dc96401dbe88
starting the refactoring of /tools/find
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5676
diff
changeset
|
124 } |
dc96401dbe88
starting the refactoring of /tools/find
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5676
diff
changeset
|
125 |
5840
b24b61331566
pagination: fixed compat with ODBC that does not support ExtendedFind
Alain Mazy <am@orthanc.team>
parents:
5773
diff
changeset
|
126 if (!request.GetOrdering().empty()) |
b24b61331566
pagination: fixed compat with ODBC that does not support ExtendedFind
Alain Mazy <am@orthanc.team>
parents:
5773
diff
changeset
|
127 { |
b24b61331566
pagination: fixed compat with ODBC that does not support ExtendedFind
Alain Mazy <am@orthanc.team>
parents:
5773
diff
changeset
|
128 throw OrthancException(ErrorCode_NotImplemented, "The database backend doesn't support ordering"); |
b24b61331566
pagination: fixed compat with ODBC that does not support ExtendedFind
Alain Mazy <am@orthanc.team>
parents:
5773
diff
changeset
|
129 } |
b24b61331566
pagination: fixed compat with ODBC that does not support ExtendedFind
Alain Mazy <am@orthanc.team>
parents:
5773
diff
changeset
|
130 |
5615
a10978a5e65c
expansion of single resources using ResourceFinder
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5614
diff
changeset
|
131 if (IsRequestWithoutContraint(request) && |
a10978a5e65c
expansion of single resources using ResourceFinder
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5614
diff
changeset
|
132 !request.GetOrthancIdentifiers().HasPatientId() && |
5554
12d8a1a266e9
introduction of FindRequest and FindResponse
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
133 !request.GetOrthancIdentifiers().HasStudyId() && |
12d8a1a266e9
introduction of FindRequest and FindResponse
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
134 !request.GetOrthancIdentifiers().HasSeriesId() && |
5615
a10978a5e65c
expansion of single resources using ResourceFinder
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5614
diff
changeset
|
135 !request.GetOrthancIdentifiers().HasInstanceId()) |
5554
12d8a1a266e9
introduction of FindRequest and FindResponse
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
136 { |
5773
3b7dce0e43c6
handling of case limit=0
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5772
diff
changeset
|
137 if (!request.HasLimits()) |
3b7dce0e43c6
handling of case limit=0
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5772
diff
changeset
|
138 { |
3b7dce0e43c6
handling of case limit=0
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5772
diff
changeset
|
139 transaction_.GetAllPublicIds(identifiers, request.GetLevel()); |
3b7dce0e43c6
handling of case limit=0
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5772
diff
changeset
|
140 } |
3b7dce0e43c6
handling of case limit=0
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5772
diff
changeset
|
141 else if (request.GetLimitsCount() != 0) |
5554
12d8a1a266e9
introduction of FindRequest and FindResponse
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
142 { |
5847
70a879a7b658
introduction of IDatabaseWrapper::ICompatibilityTransaction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5840
diff
changeset
|
143 compatibilityTransaction_.GetAllPublicIdsCompatibility(identifiers, request.GetLevel(), request.GetLimitsSince(), request.GetLimitsCount()); |
5554
12d8a1a266e9
introduction of FindRequest and FindResponse
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
144 } |
12d8a1a266e9
introduction of FindRequest and FindResponse
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
145 else |
12d8a1a266e9
introduction of FindRequest and FindResponse
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
146 { |
5773
3b7dce0e43c6
handling of case limit=0
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5772
diff
changeset
|
147 // Starting with Orthanc 1.12.5, "limit=0" means "no limit" |
3b7dce0e43c6
handling of case limit=0
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5772
diff
changeset
|
148 std::list<std::string> tmp; |
3b7dce0e43c6
handling of case limit=0
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5772
diff
changeset
|
149 transaction_.GetAllPublicIds(tmp, request.GetLevel()); |
3b7dce0e43c6
handling of case limit=0
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5772
diff
changeset
|
150 |
3b7dce0e43c6
handling of case limit=0
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5772
diff
changeset
|
151 size_t count = 0; |
3b7dce0e43c6
handling of case limit=0
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5772
diff
changeset
|
152 for (std::list<std::string>::const_iterator it = tmp.begin(); it != tmp.end(); ++it) |
3b7dce0e43c6
handling of case limit=0
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5772
diff
changeset
|
153 { |
3b7dce0e43c6
handling of case limit=0
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5772
diff
changeset
|
154 if (count >= request.GetLimitsSince()) |
3b7dce0e43c6
handling of case limit=0
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5772
diff
changeset
|
155 { |
3b7dce0e43c6
handling of case limit=0
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5772
diff
changeset
|
156 identifiers.push_back(*it); |
3b7dce0e43c6
handling of case limit=0
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5772
diff
changeset
|
157 } |
3b7dce0e43c6
handling of case limit=0
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5772
diff
changeset
|
158 |
3b7dce0e43c6
handling of case limit=0
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5772
diff
changeset
|
159 count++; |
3b7dce0e43c6
handling of case limit=0
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5772
diff
changeset
|
160 } |
5554
12d8a1a266e9
introduction of FindRequest and FindResponse
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
161 } |
12d8a1a266e9
introduction of FindRequest and FindResponse
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
162 } |
5615
a10978a5e65c
expansion of single resources using ResourceFinder
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5614
diff
changeset
|
163 else if (IsRequestWithoutContraint(request) && |
5616 | 164 request.GetLevel() == ResourceType_Patient && |
5615
a10978a5e65c
expansion of single resources using ResourceFinder
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5614
diff
changeset
|
165 request.GetOrthancIdentifiers().HasPatientId() && |
a10978a5e65c
expansion of single resources using ResourceFinder
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5614
diff
changeset
|
166 !request.GetOrthancIdentifiers().HasStudyId() && |
a10978a5e65c
expansion of single resources using ResourceFinder
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5614
diff
changeset
|
167 !request.GetOrthancIdentifiers().HasSeriesId() && |
a10978a5e65c
expansion of single resources using ResourceFinder
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5614
diff
changeset
|
168 !request.GetOrthancIdentifiers().HasInstanceId()) |
a10978a5e65c
expansion of single resources using ResourceFinder
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5614
diff
changeset
|
169 { |
5617
8905ffa45fc2
started listing of children resources
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5616
diff
changeset
|
170 // TODO-FIND: This is a trivial case for which no transaction is needed |
5615
a10978a5e65c
expansion of single resources using ResourceFinder
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5614
diff
changeset
|
171 identifiers.push_back(request.GetOrthancIdentifiers().GetPatientId()); |
a10978a5e65c
expansion of single resources using ResourceFinder
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5614
diff
changeset
|
172 } |
a10978a5e65c
expansion of single resources using ResourceFinder
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5614
diff
changeset
|
173 else if (IsRequestWithoutContraint(request) && |
5616 | 174 request.GetLevel() == ResourceType_Study && |
5615
a10978a5e65c
expansion of single resources using ResourceFinder
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5614
diff
changeset
|
175 !request.GetOrthancIdentifiers().HasPatientId() && |
a10978a5e65c
expansion of single resources using ResourceFinder
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5614
diff
changeset
|
176 request.GetOrthancIdentifiers().HasStudyId() && |
a10978a5e65c
expansion of single resources using ResourceFinder
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5614
diff
changeset
|
177 !request.GetOrthancIdentifiers().HasSeriesId() && |
a10978a5e65c
expansion of single resources using ResourceFinder
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5614
diff
changeset
|
178 !request.GetOrthancIdentifiers().HasInstanceId()) |
a10978a5e65c
expansion of single resources using ResourceFinder
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5614
diff
changeset
|
179 { |
5617
8905ffa45fc2
started listing of children resources
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5616
diff
changeset
|
180 // TODO-FIND: This is a trivial case for which no transaction is needed |
5615
a10978a5e65c
expansion of single resources using ResourceFinder
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5614
diff
changeset
|
181 identifiers.push_back(request.GetOrthancIdentifiers().GetStudyId()); |
a10978a5e65c
expansion of single resources using ResourceFinder
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5614
diff
changeset
|
182 } |
a10978a5e65c
expansion of single resources using ResourceFinder
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5614
diff
changeset
|
183 else if (IsRequestWithoutContraint(request) && |
5616 | 184 request.GetLevel() == ResourceType_Series && |
5615
a10978a5e65c
expansion of single resources using ResourceFinder
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5614
diff
changeset
|
185 !request.GetOrthancIdentifiers().HasPatientId() && |
a10978a5e65c
expansion of single resources using ResourceFinder
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5614
diff
changeset
|
186 !request.GetOrthancIdentifiers().HasStudyId() && |
a10978a5e65c
expansion of single resources using ResourceFinder
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5614
diff
changeset
|
187 request.GetOrthancIdentifiers().HasSeriesId() && |
a10978a5e65c
expansion of single resources using ResourceFinder
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5614
diff
changeset
|
188 !request.GetOrthancIdentifiers().HasInstanceId()) |
a10978a5e65c
expansion of single resources using ResourceFinder
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5614
diff
changeset
|
189 { |
5617
8905ffa45fc2
started listing of children resources
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5616
diff
changeset
|
190 // TODO-FIND: This is a trivial case for which no transaction is needed |
5615
a10978a5e65c
expansion of single resources using ResourceFinder
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5614
diff
changeset
|
191 identifiers.push_back(request.GetOrthancIdentifiers().GetSeriesId()); |
a10978a5e65c
expansion of single resources using ResourceFinder
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5614
diff
changeset
|
192 } |
a10978a5e65c
expansion of single resources using ResourceFinder
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5614
diff
changeset
|
193 else if (IsRequestWithoutContraint(request) && |
5616 | 194 request.GetLevel() == ResourceType_Instance && |
5615
a10978a5e65c
expansion of single resources using ResourceFinder
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5614
diff
changeset
|
195 !request.GetOrthancIdentifiers().HasPatientId() && |
a10978a5e65c
expansion of single resources using ResourceFinder
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5614
diff
changeset
|
196 !request.GetOrthancIdentifiers().HasStudyId() && |
a10978a5e65c
expansion of single resources using ResourceFinder
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5614
diff
changeset
|
197 !request.GetOrthancIdentifiers().HasSeriesId() && |
a10978a5e65c
expansion of single resources using ResourceFinder
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5614
diff
changeset
|
198 request.GetOrthancIdentifiers().HasInstanceId()) |
a10978a5e65c
expansion of single resources using ResourceFinder
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5614
diff
changeset
|
199 { |
5617
8905ffa45fc2
started listing of children resources
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5616
diff
changeset
|
200 // TODO-FIND: This is a trivial case for which no transaction is needed |
5615
a10978a5e65c
expansion of single resources using ResourceFinder
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5614
diff
changeset
|
201 identifiers.push_back(request.GetOrthancIdentifiers().GetInstanceId()); |
a10978a5e65c
expansion of single resources using ResourceFinder
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5614
diff
changeset
|
202 } |
5617
8905ffa45fc2
started listing of children resources
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5616
diff
changeset
|
203 else if (IsRequestWithoutContraint(request) && |
8905ffa45fc2
started listing of children resources
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5616
diff
changeset
|
204 (request.GetLevel() == ResourceType_Study || |
8905ffa45fc2
started listing of children resources
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5616
diff
changeset
|
205 request.GetLevel() == ResourceType_Series || |
8905ffa45fc2
started listing of children resources
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5616
diff
changeset
|
206 request.GetLevel() == ResourceType_Instance) && |
8905ffa45fc2
started listing of children resources
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5616
diff
changeset
|
207 request.GetOrthancIdentifiers().HasPatientId() && |
8905ffa45fc2
started listing of children resources
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5616
diff
changeset
|
208 !request.GetOrthancIdentifiers().HasStudyId() && |
8905ffa45fc2
started listing of children resources
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5616
diff
changeset
|
209 !request.GetOrthancIdentifiers().HasSeriesId() && |
8905ffa45fc2
started listing of children resources
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5616
diff
changeset
|
210 !request.GetOrthancIdentifiers().HasInstanceId()) |
8905ffa45fc2
started listing of children resources
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5616
diff
changeset
|
211 { |
8905ffa45fc2
started listing of children resources
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5616
diff
changeset
|
212 GetChildrenIdentifiers(identifiers, transaction_, request.GetOrthancIdentifiers(), ResourceType_Patient, request.GetLevel()); |
8905ffa45fc2
started listing of children resources
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5616
diff
changeset
|
213 } |
8905ffa45fc2
started listing of children resources
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5616
diff
changeset
|
214 else if (IsRequestWithoutContraint(request) && |
8905ffa45fc2
started listing of children resources
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5616
diff
changeset
|
215 (request.GetLevel() == ResourceType_Series || |
8905ffa45fc2
started listing of children resources
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5616
diff
changeset
|
216 request.GetLevel() == ResourceType_Instance) && |
8905ffa45fc2
started listing of children resources
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5616
diff
changeset
|
217 !request.GetOrthancIdentifiers().HasPatientId() && |
8905ffa45fc2
started listing of children resources
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5616
diff
changeset
|
218 request.GetOrthancIdentifiers().HasStudyId() && |
8905ffa45fc2
started listing of children resources
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5616
diff
changeset
|
219 !request.GetOrthancIdentifiers().HasSeriesId() && |
8905ffa45fc2
started listing of children resources
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5616
diff
changeset
|
220 !request.GetOrthancIdentifiers().HasInstanceId()) |
8905ffa45fc2
started listing of children resources
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5616
diff
changeset
|
221 { |
8905ffa45fc2
started listing of children resources
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5616
diff
changeset
|
222 GetChildrenIdentifiers(identifiers, transaction_, request.GetOrthancIdentifiers(), ResourceType_Study, request.GetLevel()); |
8905ffa45fc2
started listing of children resources
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5616
diff
changeset
|
223 } |
8905ffa45fc2
started listing of children resources
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5616
diff
changeset
|
224 else if (IsRequestWithoutContraint(request) && |
8905ffa45fc2
started listing of children resources
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5616
diff
changeset
|
225 request.GetLevel() == ResourceType_Instance && |
8905ffa45fc2
started listing of children resources
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5616
diff
changeset
|
226 !request.GetOrthancIdentifiers().HasPatientId() && |
8905ffa45fc2
started listing of children resources
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5616
diff
changeset
|
227 !request.GetOrthancIdentifiers().HasStudyId() && |
8905ffa45fc2
started listing of children resources
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5616
diff
changeset
|
228 request.GetOrthancIdentifiers().HasSeriesId() && |
8905ffa45fc2
started listing of children resources
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5616
diff
changeset
|
229 !request.GetOrthancIdentifiers().HasInstanceId()) |
8905ffa45fc2
started listing of children resources
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5616
diff
changeset
|
230 { |
8905ffa45fc2
started listing of children resources
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5616
diff
changeset
|
231 GetChildrenIdentifiers(identifiers, transaction_, request.GetOrthancIdentifiers(), ResourceType_Series, request.GetLevel()); |
8905ffa45fc2
started listing of children resources
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5616
diff
changeset
|
232 } |
5682
fd4c5e064cbe
started refactoring of ServerContext::Apply()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5681
diff
changeset
|
233 else if (request.GetMetadataConstraintsCount() == 0 && |
5724 | 234 request.GetOrdering().empty() && |
235 !request.GetOrthancIdentifiers().HasPatientId() && | |
236 !request.GetOrthancIdentifiers().HasStudyId() && | |
237 !request.GetOrthancIdentifiers().HasSeriesId() && | |
238 !request.GetOrthancIdentifiers().HasInstanceId()) | |
5682
fd4c5e064cbe
started refactoring of ServerContext::Apply()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5681
diff
changeset
|
239 { |
fd4c5e064cbe
started refactoring of ServerContext::Apply()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5681
diff
changeset
|
240 transaction_.ApplyLookupResources(identifiers, NULL /* TODO-FIND: Could the "instancesId" information be exploited? */, |
fd4c5e064cbe
started refactoring of ServerContext::Apply()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5681
diff
changeset
|
241 request.GetDicomTagConstraints(), request.GetLevel(), request.GetLabels(), |
fd4c5e064cbe
started refactoring of ServerContext::Apply()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5681
diff
changeset
|
242 request.GetLabelsConstraint(), request.HasLimits() ? request.GetLimitsCount() : 0); |
fd4c5e064cbe
started refactoring of ServerContext::Apply()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5681
diff
changeset
|
243 } |
5554
12d8a1a266e9
introduction of FindRequest and FindResponse
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
244 else |
12d8a1a266e9
introduction of FindRequest and FindResponse
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
245 { |
5677
dc96401dbe88
starting the refactoring of /tools/find
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5676
diff
changeset
|
246 throw OrthancException(ErrorCode_NotImplemented); |
5593
862b54b4cfe2
implemented the default multi-stage find/expand
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5592
diff
changeset
|
247 } |
862b54b4cfe2
implemented the default multi-stage find/expand
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5592
diff
changeset
|
248 } |
862b54b4cfe2
implemented the default multi-stage find/expand
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5592
diff
changeset
|
249 |
862b54b4cfe2
implemented the default multi-stage find/expand
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5592
diff
changeset
|
250 |
5596
81a29ad7fb4b
added possibility to retrieve main DICOM tags and metadata at any level
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5595
diff
changeset
|
251 void GenericFind::RetrieveMainDicomTags(FindResponse::Resource& target, |
81a29ad7fb4b
added possibility to retrieve main DICOM tags and metadata at any level
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5595
diff
changeset
|
252 ResourceType level, |
81a29ad7fb4b
added possibility to retrieve main DICOM tags and metadata at any level
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5595
diff
changeset
|
253 int64_t internalId) |
81a29ad7fb4b
added possibility to retrieve main DICOM tags and metadata at any level
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5595
diff
changeset
|
254 { |
81a29ad7fb4b
added possibility to retrieve main DICOM tags and metadata at any level
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5595
diff
changeset
|
255 DicomMap m; |
81a29ad7fb4b
added possibility to retrieve main DICOM tags and metadata at any level
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5595
diff
changeset
|
256 transaction_.GetMainDicomTags(m, internalId); |
81a29ad7fb4b
added possibility to retrieve main DICOM tags and metadata at any level
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5595
diff
changeset
|
257 |
81a29ad7fb4b
added possibility to retrieve main DICOM tags and metadata at any level
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5595
diff
changeset
|
258 DicomArray a(m); |
81a29ad7fb4b
added possibility to retrieve main DICOM tags and metadata at any level
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5595
diff
changeset
|
259 for (size_t i = 0; i < a.GetSize(); i++) |
81a29ad7fb4b
added possibility to retrieve main DICOM tags and metadata at any level
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5595
diff
changeset
|
260 { |
81a29ad7fb4b
added possibility to retrieve main DICOM tags and metadata at any level
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5595
diff
changeset
|
261 const DicomElement& element = a.GetElement(i); |
81a29ad7fb4b
added possibility to retrieve main DICOM tags and metadata at any level
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5595
diff
changeset
|
262 if (element.GetValue().IsString()) |
81a29ad7fb4b
added possibility to retrieve main DICOM tags and metadata at any level
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5595
diff
changeset
|
263 { |
81a29ad7fb4b
added possibility to retrieve main DICOM tags and metadata at any level
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5595
diff
changeset
|
264 target.AddStringDicomTag(level, element.GetTag().GetGroup(), |
81a29ad7fb4b
added possibility to retrieve main DICOM tags and metadata at any level
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5595
diff
changeset
|
265 element.GetTag().GetElement(), element.GetValue().GetContent()); |
81a29ad7fb4b
added possibility to retrieve main DICOM tags and metadata at any level
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5595
diff
changeset
|
266 } |
81a29ad7fb4b
added possibility to retrieve main DICOM tags and metadata at any level
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5595
diff
changeset
|
267 else |
81a29ad7fb4b
added possibility to retrieve main DICOM tags and metadata at any level
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5595
diff
changeset
|
268 { |
81a29ad7fb4b
added possibility to retrieve main DICOM tags and metadata at any level
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5595
diff
changeset
|
269 throw OrthancException(ErrorCode_BadParameterType); |
81a29ad7fb4b
added possibility to retrieve main DICOM tags and metadata at any level
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5595
diff
changeset
|
270 } |
81a29ad7fb4b
added possibility to retrieve main DICOM tags and metadata at any level
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5595
diff
changeset
|
271 } |
81a29ad7fb4b
added possibility to retrieve main DICOM tags and metadata at any level
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5595
diff
changeset
|
272 } |
81a29ad7fb4b
added possibility to retrieve main DICOM tags and metadata at any level
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5595
diff
changeset
|
273 |
81a29ad7fb4b
added possibility to retrieve main DICOM tags and metadata at any level
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5595
diff
changeset
|
274 |
81a29ad7fb4b
added possibility to retrieve main DICOM tags and metadata at any level
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5595
diff
changeset
|
275 static ResourceType GetTopLevelOfInterest(const FindRequest& request) |
81a29ad7fb4b
added possibility to retrieve main DICOM tags and metadata at any level
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5595
diff
changeset
|
276 { |
81a29ad7fb4b
added possibility to retrieve main DICOM tags and metadata at any level
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5595
diff
changeset
|
277 switch (request.GetLevel()) |
81a29ad7fb4b
added possibility to retrieve main DICOM tags and metadata at any level
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5595
diff
changeset
|
278 { |
81a29ad7fb4b
added possibility to retrieve main DICOM tags and metadata at any level
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5595
diff
changeset
|
279 case ResourceType_Patient: |
81a29ad7fb4b
added possibility to retrieve main DICOM tags and metadata at any level
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5595
diff
changeset
|
280 return ResourceType_Patient; |
81a29ad7fb4b
added possibility to retrieve main DICOM tags and metadata at any level
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5595
diff
changeset
|
281 |
81a29ad7fb4b
added possibility to retrieve main DICOM tags and metadata at any level
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5595
diff
changeset
|
282 case ResourceType_Study: |
5676
b744a2cf408a
shorten ParentRetrieveSpecification/ChildrenRetrieveSpecification as ParentSpecification/ChildrenSpecification
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5674
diff
changeset
|
283 if (request.GetParentSpecification(ResourceType_Patient).IsOfInterest()) |
5596
81a29ad7fb4b
added possibility to retrieve main DICOM tags and metadata at any level
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5595
diff
changeset
|
284 { |
81a29ad7fb4b
added possibility to retrieve main DICOM tags and metadata at any level
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5595
diff
changeset
|
285 return ResourceType_Patient; |
81a29ad7fb4b
added possibility to retrieve main DICOM tags and metadata at any level
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5595
diff
changeset
|
286 } |
81a29ad7fb4b
added possibility to retrieve main DICOM tags and metadata at any level
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5595
diff
changeset
|
287 else |
81a29ad7fb4b
added possibility to retrieve main DICOM tags and metadata at any level
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5595
diff
changeset
|
288 { |
81a29ad7fb4b
added possibility to retrieve main DICOM tags and metadata at any level
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5595
diff
changeset
|
289 return ResourceType_Study; |
81a29ad7fb4b
added possibility to retrieve main DICOM tags and metadata at any level
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5595
diff
changeset
|
290 } |
81a29ad7fb4b
added possibility to retrieve main DICOM tags and metadata at any level
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5595
diff
changeset
|
291 |
81a29ad7fb4b
added possibility to retrieve main DICOM tags and metadata at any level
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5595
diff
changeset
|
292 case ResourceType_Series: |
5676
b744a2cf408a
shorten ParentRetrieveSpecification/ChildrenRetrieveSpecification as ParentSpecification/ChildrenSpecification
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5674
diff
changeset
|
293 if (request.GetParentSpecification(ResourceType_Patient).IsOfInterest()) |
5596
81a29ad7fb4b
added possibility to retrieve main DICOM tags and metadata at any level
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5595
diff
changeset
|
294 { |
81a29ad7fb4b
added possibility to retrieve main DICOM tags and metadata at any level
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5595
diff
changeset
|
295 return ResourceType_Patient; |
81a29ad7fb4b
added possibility to retrieve main DICOM tags and metadata at any level
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5595
diff
changeset
|
296 } |
5676
b744a2cf408a
shorten ParentRetrieveSpecification/ChildrenRetrieveSpecification as ParentSpecification/ChildrenSpecification
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5674
diff
changeset
|
297 else if (request.GetParentSpecification(ResourceType_Study).IsOfInterest()) |
5596
81a29ad7fb4b
added possibility to retrieve main DICOM tags and metadata at any level
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5595
diff
changeset
|
298 { |
81a29ad7fb4b
added possibility to retrieve main DICOM tags and metadata at any level
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5595
diff
changeset
|
299 return ResourceType_Study; |
81a29ad7fb4b
added possibility to retrieve main DICOM tags and metadata at any level
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5595
diff
changeset
|
300 } |
81a29ad7fb4b
added possibility to retrieve main DICOM tags and metadata at any level
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5595
diff
changeset
|
301 else |
81a29ad7fb4b
added possibility to retrieve main DICOM tags and metadata at any level
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5595
diff
changeset
|
302 { |
81a29ad7fb4b
added possibility to retrieve main DICOM tags and metadata at any level
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5595
diff
changeset
|
303 return ResourceType_Series; |
81a29ad7fb4b
added possibility to retrieve main DICOM tags and metadata at any level
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5595
diff
changeset
|
304 } |
81a29ad7fb4b
added possibility to retrieve main DICOM tags and metadata at any level
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5595
diff
changeset
|
305 |
81a29ad7fb4b
added possibility to retrieve main DICOM tags and metadata at any level
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5595
diff
changeset
|
306 case ResourceType_Instance: |
5676
b744a2cf408a
shorten ParentRetrieveSpecification/ChildrenRetrieveSpecification as ParentSpecification/ChildrenSpecification
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5674
diff
changeset
|
307 if (request.GetParentSpecification(ResourceType_Patient).IsOfInterest()) |
5596
81a29ad7fb4b
added possibility to retrieve main DICOM tags and metadata at any level
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5595
diff
changeset
|
308 { |
81a29ad7fb4b
added possibility to retrieve main DICOM tags and metadata at any level
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5595
diff
changeset
|
309 return ResourceType_Patient; |
81a29ad7fb4b
added possibility to retrieve main DICOM tags and metadata at any level
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5595
diff
changeset
|
310 } |
5676
b744a2cf408a
shorten ParentRetrieveSpecification/ChildrenRetrieveSpecification as ParentSpecification/ChildrenSpecification
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5674
diff
changeset
|
311 else if (request.GetParentSpecification(ResourceType_Study).IsOfInterest()) |
5596
81a29ad7fb4b
added possibility to retrieve main DICOM tags and metadata at any level
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5595
diff
changeset
|
312 { |
81a29ad7fb4b
added possibility to retrieve main DICOM tags and metadata at any level
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5595
diff
changeset
|
313 return ResourceType_Study; |
81a29ad7fb4b
added possibility to retrieve main DICOM tags and metadata at any level
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5595
diff
changeset
|
314 } |
5676
b744a2cf408a
shorten ParentRetrieveSpecification/ChildrenRetrieveSpecification as ParentSpecification/ChildrenSpecification
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5674
diff
changeset
|
315 else if (request.GetParentSpecification(ResourceType_Series).IsOfInterest()) |
5596
81a29ad7fb4b
added possibility to retrieve main DICOM tags and metadata at any level
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5595
diff
changeset
|
316 { |
81a29ad7fb4b
added possibility to retrieve main DICOM tags and metadata at any level
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5595
diff
changeset
|
317 return ResourceType_Series; |
81a29ad7fb4b
added possibility to retrieve main DICOM tags and metadata at any level
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5595
diff
changeset
|
318 } |
81a29ad7fb4b
added possibility to retrieve main DICOM tags and metadata at any level
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5595
diff
changeset
|
319 else |
81a29ad7fb4b
added possibility to retrieve main DICOM tags and metadata at any level
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5595
diff
changeset
|
320 { |
81a29ad7fb4b
added possibility to retrieve main DICOM tags and metadata at any level
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5595
diff
changeset
|
321 return ResourceType_Instance; |
81a29ad7fb4b
added possibility to retrieve main DICOM tags and metadata at any level
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5595
diff
changeset
|
322 } |
81a29ad7fb4b
added possibility to retrieve main DICOM tags and metadata at any level
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5595
diff
changeset
|
323 |
81a29ad7fb4b
added possibility to retrieve main DICOM tags and metadata at any level
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5595
diff
changeset
|
324 default: |
81a29ad7fb4b
added possibility to retrieve main DICOM tags and metadata at any level
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5595
diff
changeset
|
325 throw OrthancException(ErrorCode_ParameterOutOfRange); |
81a29ad7fb4b
added possibility to retrieve main DICOM tags and metadata at any level
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5595
diff
changeset
|
326 } |
81a29ad7fb4b
added possibility to retrieve main DICOM tags and metadata at any level
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5595
diff
changeset
|
327 } |
81a29ad7fb4b
added possibility to retrieve main DICOM tags and metadata at any level
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5595
diff
changeset
|
328 |
81a29ad7fb4b
added possibility to retrieve main DICOM tags and metadata at any level
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5595
diff
changeset
|
329 |
5667
93dff1fccf36
recursive descent to the children
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5666
diff
changeset
|
330 static ResourceType GetBottomLevelOfInterest(const FindRequest& request) |
93dff1fccf36
recursive descent to the children
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5666
diff
changeset
|
331 { |
93dff1fccf36
recursive descent to the children
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5666
diff
changeset
|
332 switch (request.GetLevel()) |
93dff1fccf36
recursive descent to the children
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5666
diff
changeset
|
333 { |
93dff1fccf36
recursive descent to the children
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5666
diff
changeset
|
334 case ResourceType_Patient: |
5676
b744a2cf408a
shorten ParentRetrieveSpecification/ChildrenRetrieveSpecification as ParentSpecification/ChildrenSpecification
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5674
diff
changeset
|
335 if (request.GetChildrenSpecification(ResourceType_Instance).IsOfInterest()) |
5667
93dff1fccf36
recursive descent to the children
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5666
diff
changeset
|
336 { |
93dff1fccf36
recursive descent to the children
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5666
diff
changeset
|
337 return ResourceType_Instance; |
93dff1fccf36
recursive descent to the children
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5666
diff
changeset
|
338 } |
5676
b744a2cf408a
shorten ParentRetrieveSpecification/ChildrenRetrieveSpecification as ParentSpecification/ChildrenSpecification
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5674
diff
changeset
|
339 else if (request.GetChildrenSpecification(ResourceType_Series).IsOfInterest()) |
5667
93dff1fccf36
recursive descent to the children
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5666
diff
changeset
|
340 { |
93dff1fccf36
recursive descent to the children
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5666
diff
changeset
|
341 return ResourceType_Series; |
93dff1fccf36
recursive descent to the children
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5666
diff
changeset
|
342 } |
5676
b744a2cf408a
shorten ParentRetrieveSpecification/ChildrenRetrieveSpecification as ParentSpecification/ChildrenSpecification
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5674
diff
changeset
|
343 else if (request.GetChildrenSpecification(ResourceType_Study).IsOfInterest()) |
5667
93dff1fccf36
recursive descent to the children
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5666
diff
changeset
|
344 { |
93dff1fccf36
recursive descent to the children
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5666
diff
changeset
|
345 return ResourceType_Study; |
93dff1fccf36
recursive descent to the children
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5666
diff
changeset
|
346 } |
93dff1fccf36
recursive descent to the children
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5666
diff
changeset
|
347 else |
93dff1fccf36
recursive descent to the children
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5666
diff
changeset
|
348 { |
93dff1fccf36
recursive descent to the children
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5666
diff
changeset
|
349 return ResourceType_Patient; |
93dff1fccf36
recursive descent to the children
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5666
diff
changeset
|
350 } |
93dff1fccf36
recursive descent to the children
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5666
diff
changeset
|
351 |
93dff1fccf36
recursive descent to the children
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5666
diff
changeset
|
352 case ResourceType_Study: |
5676
b744a2cf408a
shorten ParentRetrieveSpecification/ChildrenRetrieveSpecification as ParentSpecification/ChildrenSpecification
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5674
diff
changeset
|
353 if (request.GetChildrenSpecification(ResourceType_Instance).IsOfInterest()) |
5667
93dff1fccf36
recursive descent to the children
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5666
diff
changeset
|
354 { |
93dff1fccf36
recursive descent to the children
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5666
diff
changeset
|
355 return ResourceType_Instance; |
93dff1fccf36
recursive descent to the children
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5666
diff
changeset
|
356 } |
5676
b744a2cf408a
shorten ParentRetrieveSpecification/ChildrenRetrieveSpecification as ParentSpecification/ChildrenSpecification
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5674
diff
changeset
|
357 else if (request.GetChildrenSpecification(ResourceType_Series).IsOfInterest()) |
5667
93dff1fccf36
recursive descent to the children
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5666
diff
changeset
|
358 { |
93dff1fccf36
recursive descent to the children
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5666
diff
changeset
|
359 return ResourceType_Series; |
93dff1fccf36
recursive descent to the children
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5666
diff
changeset
|
360 } |
93dff1fccf36
recursive descent to the children
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5666
diff
changeset
|
361 else |
93dff1fccf36
recursive descent to the children
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5666
diff
changeset
|
362 { |
93dff1fccf36
recursive descent to the children
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5666
diff
changeset
|
363 return ResourceType_Study; |
93dff1fccf36
recursive descent to the children
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5666
diff
changeset
|
364 } |
93dff1fccf36
recursive descent to the children
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5666
diff
changeset
|
365 |
93dff1fccf36
recursive descent to the children
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5666
diff
changeset
|
366 case ResourceType_Series: |
5676
b744a2cf408a
shorten ParentRetrieveSpecification/ChildrenRetrieveSpecification as ParentSpecification/ChildrenSpecification
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5674
diff
changeset
|
367 if (request.GetChildrenSpecification(ResourceType_Instance).IsOfInterest()) |
5667
93dff1fccf36
recursive descent to the children
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5666
diff
changeset
|
368 { |
93dff1fccf36
recursive descent to the children
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5666
diff
changeset
|
369 return ResourceType_Instance; |
93dff1fccf36
recursive descent to the children
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5666
diff
changeset
|
370 } |
93dff1fccf36
recursive descent to the children
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5666
diff
changeset
|
371 else |
93dff1fccf36
recursive descent to the children
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5666
diff
changeset
|
372 { |
93dff1fccf36
recursive descent to the children
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5666
diff
changeset
|
373 return ResourceType_Series; |
93dff1fccf36
recursive descent to the children
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5666
diff
changeset
|
374 } |
93dff1fccf36
recursive descent to the children
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5666
diff
changeset
|
375 |
93dff1fccf36
recursive descent to the children
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5666
diff
changeset
|
376 case ResourceType_Instance: |
93dff1fccf36
recursive descent to the children
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5666
diff
changeset
|
377 return ResourceType_Instance; |
93dff1fccf36
recursive descent to the children
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5666
diff
changeset
|
378 |
93dff1fccf36
recursive descent to the children
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5666
diff
changeset
|
379 default: |
93dff1fccf36
recursive descent to the children
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5666
diff
changeset
|
380 throw OrthancException(ErrorCode_ParameterOutOfRange); |
93dff1fccf36
recursive descent to the children
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5666
diff
changeset
|
381 } |
93dff1fccf36
recursive descent to the children
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5666
diff
changeset
|
382 } |
93dff1fccf36
recursive descent to the children
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5666
diff
changeset
|
383 |
93dff1fccf36
recursive descent to the children
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5666
diff
changeset
|
384 |
5593
862b54b4cfe2
implemented the default multi-stage find/expand
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5592
diff
changeset
|
385 void GenericFind::ExecuteExpand(FindResponse& response, |
5720
89d559e67b03
fix compatibility with old database plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5682
diff
changeset
|
386 const IDatabaseWrapper::Capabilities& capabilities, |
5593
862b54b4cfe2
implemented the default multi-stage find/expand
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5592
diff
changeset
|
387 const FindRequest& request, |
862b54b4cfe2
implemented the default multi-stage find/expand
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5592
diff
changeset
|
388 const std::string& identifier) |
862b54b4cfe2
implemented the default multi-stage find/expand
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5592
diff
changeset
|
389 { |
862b54b4cfe2
implemented the default multi-stage find/expand
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5592
diff
changeset
|
390 int64_t internalId; |
5594
a906dc19264c
created FindResponse::Resource::Format()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5593
diff
changeset
|
391 ResourceType level; |
5595
a87f2a56257d
implemented FindRequest::retrieveChildrenMetadata_
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5594
diff
changeset
|
392 std::string parent; |
a87f2a56257d
implemented FindRequest::retrieveChildrenMetadata_
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5594
diff
changeset
|
393 |
a87f2a56257d
implemented FindRequest::retrieveChildrenMetadata_
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5594
diff
changeset
|
394 if (request.IsRetrieveParentIdentifier()) |
5593
862b54b4cfe2
implemented the default multi-stage find/expand
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5592
diff
changeset
|
395 { |
5595
a87f2a56257d
implemented FindRequest::retrieveChildrenMetadata_
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5594
diff
changeset
|
396 if (!transaction_.LookupResourceAndParent(internalId, level, parent, identifier)) |
a87f2a56257d
implemented FindRequest::retrieveChildrenMetadata_
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5594
diff
changeset
|
397 { |
a87f2a56257d
implemented FindRequest::retrieveChildrenMetadata_
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5594
diff
changeset
|
398 return; // The resource is not available anymore |
a87f2a56257d
implemented FindRequest::retrieveChildrenMetadata_
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5594
diff
changeset
|
399 } |
a87f2a56257d
implemented FindRequest::retrieveChildrenMetadata_
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5594
diff
changeset
|
400 |
a87f2a56257d
implemented FindRequest::retrieveChildrenMetadata_
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5594
diff
changeset
|
401 if (level == ResourceType_Patient) |
a87f2a56257d
implemented FindRequest::retrieveChildrenMetadata_
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5594
diff
changeset
|
402 { |
a87f2a56257d
implemented FindRequest::retrieveChildrenMetadata_
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5594
diff
changeset
|
403 if (!parent.empty()) |
a87f2a56257d
implemented FindRequest::retrieveChildrenMetadata_
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5594
diff
changeset
|
404 { |
a87f2a56257d
implemented FindRequest::retrieveChildrenMetadata_
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5594
diff
changeset
|
405 throw OrthancException(ErrorCode_DatabasePlugin); |
a87f2a56257d
implemented FindRequest::retrieveChildrenMetadata_
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5594
diff
changeset
|
406 } |
a87f2a56257d
implemented FindRequest::retrieveChildrenMetadata_
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5594
diff
changeset
|
407 } |
a87f2a56257d
implemented FindRequest::retrieveChildrenMetadata_
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5594
diff
changeset
|
408 else |
a87f2a56257d
implemented FindRequest::retrieveChildrenMetadata_
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5594
diff
changeset
|
409 { |
a87f2a56257d
implemented FindRequest::retrieveChildrenMetadata_
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5594
diff
changeset
|
410 if (parent.empty()) |
a87f2a56257d
implemented FindRequest::retrieveChildrenMetadata_
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5594
diff
changeset
|
411 { |
a87f2a56257d
implemented FindRequest::retrieveChildrenMetadata_
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5594
diff
changeset
|
412 throw OrthancException(ErrorCode_DatabasePlugin); |
a87f2a56257d
implemented FindRequest::retrieveChildrenMetadata_
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5594
diff
changeset
|
413 } |
a87f2a56257d
implemented FindRequest::retrieveChildrenMetadata_
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5594
diff
changeset
|
414 } |
a87f2a56257d
implemented FindRequest::retrieveChildrenMetadata_
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5594
diff
changeset
|
415 } |
a87f2a56257d
implemented FindRequest::retrieveChildrenMetadata_
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5594
diff
changeset
|
416 else |
a87f2a56257d
implemented FindRequest::retrieveChildrenMetadata_
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5594
diff
changeset
|
417 { |
a87f2a56257d
implemented FindRequest::retrieveChildrenMetadata_
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5594
diff
changeset
|
418 if (!transaction_.LookupResource(internalId, level, identifier)) |
a87f2a56257d
implemented FindRequest::retrieveChildrenMetadata_
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5594
diff
changeset
|
419 { |
a87f2a56257d
implemented FindRequest::retrieveChildrenMetadata_
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5594
diff
changeset
|
420 return; // The resource is not available anymore |
a87f2a56257d
implemented FindRequest::retrieveChildrenMetadata_
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5594
diff
changeset
|
421 } |
a87f2a56257d
implemented FindRequest::retrieveChildrenMetadata_
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5594
diff
changeset
|
422 } |
a87f2a56257d
implemented FindRequest::retrieveChildrenMetadata_
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5594
diff
changeset
|
423 |
a87f2a56257d
implemented FindRequest::retrieveChildrenMetadata_
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5594
diff
changeset
|
424 if (level != request.GetLevel()) |
a87f2a56257d
implemented FindRequest::retrieveChildrenMetadata_
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5594
diff
changeset
|
425 { |
5771 | 426 throw OrthancException(ErrorCode_UnknownResource, "Wrong resource level for this ID"); // this might happen e.g if you call /instances/... with a series instance id |
5554
12d8a1a266e9
introduction of FindRequest and FindResponse
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
427 } |
12d8a1a266e9
introduction of FindRequest and FindResponse
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
428 |
5606
6e2dad336446
added "IsStable" field in expanded resources
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5596
diff
changeset
|
429 std::unique_ptr<FindResponse::Resource> resource(new FindResponse::Resource(request.GetLevel(), internalId, identifier)); |
5593
862b54b4cfe2
implemented the default multi-stage find/expand
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5592
diff
changeset
|
430 |
5595
a87f2a56257d
implemented FindRequest::retrieveChildrenMetadata_
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5594
diff
changeset
|
431 if (request.IsRetrieveParentIdentifier()) |
a87f2a56257d
implemented FindRequest::retrieveChildrenMetadata_
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5594
diff
changeset
|
432 { |
a87f2a56257d
implemented FindRequest::retrieveChildrenMetadata_
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5594
diff
changeset
|
433 assert(!parent.empty()); |
a87f2a56257d
implemented FindRequest::retrieveChildrenMetadata_
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5594
diff
changeset
|
434 resource->SetParentIdentifier(parent); |
a87f2a56257d
implemented FindRequest::retrieveChildrenMetadata_
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5594
diff
changeset
|
435 } |
a87f2a56257d
implemented FindRequest::retrieveChildrenMetadata_
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5594
diff
changeset
|
436 |
5619
1864b16bc7b1
added FindRequest::ParentRetrieveSpecification
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5617
diff
changeset
|
437 if (request.IsRetrieveMainDicomTags()) |
5593
862b54b4cfe2
implemented the default multi-stage find/expand
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5592
diff
changeset
|
438 { |
5619
1864b16bc7b1
added FindRequest::ParentRetrieveSpecification
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5617
diff
changeset
|
439 RetrieveMainDicomTags(*resource, level, internalId); |
1864b16bc7b1
added FindRequest::ParentRetrieveSpecification
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5617
diff
changeset
|
440 } |
1864b16bc7b1
added FindRequest::ParentRetrieveSpecification
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5617
diff
changeset
|
441 |
1864b16bc7b1
added FindRequest::ParentRetrieveSpecification
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5617
diff
changeset
|
442 if (request.IsRetrieveMetadata()) |
1864b16bc7b1
added FindRequest::ParentRetrieveSpecification
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5617
diff
changeset
|
443 { |
1864b16bc7b1
added FindRequest::ParentRetrieveSpecification
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5617
diff
changeset
|
444 transaction_.GetAllMetadata(resource->GetMetadata(level), internalId); |
1864b16bc7b1
added FindRequest::ParentRetrieveSpecification
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5617
diff
changeset
|
445 } |
1864b16bc7b1
added FindRequest::ParentRetrieveSpecification
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5617
diff
changeset
|
446 |
1864b16bc7b1
added FindRequest::ParentRetrieveSpecification
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5617
diff
changeset
|
447 { |
1864b16bc7b1
added FindRequest::ParentRetrieveSpecification
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5617
diff
changeset
|
448 const ResourceType topLevel = GetTopLevelOfInterest(request); |
1864b16bc7b1
added FindRequest::ParentRetrieveSpecification
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5617
diff
changeset
|
449 |
5596
81a29ad7fb4b
added possibility to retrieve main DICOM tags and metadata at any level
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5595
diff
changeset
|
450 int64_t currentId = internalId; |
81a29ad7fb4b
added possibility to retrieve main DICOM tags and metadata at any level
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5595
diff
changeset
|
451 ResourceType currentLevel = level; |
5593
862b54b4cfe2
implemented the default multi-stage find/expand
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5592
diff
changeset
|
452 |
5619
1864b16bc7b1
added FindRequest::ParentRetrieveSpecification
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5617
diff
changeset
|
453 while (currentLevel != topLevel) |
5593
862b54b4cfe2
implemented the default multi-stage find/expand
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5592
diff
changeset
|
454 { |
5619
1864b16bc7b1
added FindRequest::ParentRetrieveSpecification
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5617
diff
changeset
|
455 int64_t parentId; |
1864b16bc7b1
added FindRequest::ParentRetrieveSpecification
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5617
diff
changeset
|
456 if (transaction_.LookupParent(parentId, currentId)) |
1864b16bc7b1
added FindRequest::ParentRetrieveSpecification
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5617
diff
changeset
|
457 { |
1864b16bc7b1
added FindRequest::ParentRetrieveSpecification
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5617
diff
changeset
|
458 currentId = parentId; |
1864b16bc7b1
added FindRequest::ParentRetrieveSpecification
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5617
diff
changeset
|
459 currentLevel = GetParentResourceType(currentLevel); |
1864b16bc7b1
added FindRequest::ParentRetrieveSpecification
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5617
diff
changeset
|
460 } |
1864b16bc7b1
added FindRequest::ParentRetrieveSpecification
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5617
diff
changeset
|
461 else |
1864b16bc7b1
added FindRequest::ParentRetrieveSpecification
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5617
diff
changeset
|
462 { |
1864b16bc7b1
added FindRequest::ParentRetrieveSpecification
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5617
diff
changeset
|
463 throw OrthancException(ErrorCode_DatabasePlugin); |
1864b16bc7b1
added FindRequest::ParentRetrieveSpecification
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5617
diff
changeset
|
464 } |
1864b16bc7b1
added FindRequest::ParentRetrieveSpecification
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5617
diff
changeset
|
465 |
5676
b744a2cf408a
shorten ParentRetrieveSpecification/ChildrenRetrieveSpecification as ParentSpecification/ChildrenSpecification
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5674
diff
changeset
|
466 if (request.GetParentSpecification(currentLevel).IsRetrieveMainDicomTags()) |
5596
81a29ad7fb4b
added possibility to retrieve main DICOM tags and metadata at any level
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5595
diff
changeset
|
467 { |
81a29ad7fb4b
added possibility to retrieve main DICOM tags and metadata at any level
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5595
diff
changeset
|
468 RetrieveMainDicomTags(*resource, currentLevel, currentId); |
81a29ad7fb4b
added possibility to retrieve main DICOM tags and metadata at any level
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5595
diff
changeset
|
469 } |
81a29ad7fb4b
added possibility to retrieve main DICOM tags and metadata at any level
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5595
diff
changeset
|
470 |
5676
b744a2cf408a
shorten ParentRetrieveSpecification/ChildrenRetrieveSpecification as ParentSpecification/ChildrenSpecification
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5674
diff
changeset
|
471 if (request.GetParentSpecification(currentLevel).IsRetrieveMetadata()) |
5593
862b54b4cfe2
implemented the default multi-stage find/expand
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5592
diff
changeset
|
472 { |
5596
81a29ad7fb4b
added possibility to retrieve main DICOM tags and metadata at any level
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5595
diff
changeset
|
473 transaction_.GetAllMetadata(resource->GetMetadata(currentLevel), currentId); |
81a29ad7fb4b
added possibility to retrieve main DICOM tags and metadata at any level
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5595
diff
changeset
|
474 } |
5593
862b54b4cfe2
implemented the default multi-stage find/expand
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5592
diff
changeset
|
475 } |
862b54b4cfe2
implemented the default multi-stage find/expand
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5592
diff
changeset
|
476 } |
862b54b4cfe2
implemented the default multi-stage find/expand
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5592
diff
changeset
|
477 |
5720
89d559e67b03
fix compatibility with old database plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5682
diff
changeset
|
478 if (capabilities.HasLabelsSupport() && |
89d559e67b03
fix compatibility with old database plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5682
diff
changeset
|
479 request.IsRetrieveLabels()) |
5594
a906dc19264c
created FindResponse::Resource::Format()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5593
diff
changeset
|
480 { |
a906dc19264c
created FindResponse::Resource::Format()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5593
diff
changeset
|
481 transaction_.ListLabels(resource->GetLabels(), internalId); |
a906dc19264c
created FindResponse::Resource::Format()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5593
diff
changeset
|
482 } |
a906dc19264c
created FindResponse::Resource::Format()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5593
diff
changeset
|
483 |
a906dc19264c
created FindResponse::Resource::Format()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5593
diff
changeset
|
484 if (request.IsRetrieveAttachments()) |
a906dc19264c
created FindResponse::Resource::Format()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5593
diff
changeset
|
485 { |
a906dc19264c
created FindResponse::Resource::Format()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5593
diff
changeset
|
486 std::set<FileContentType> attachments; |
a906dc19264c
created FindResponse::Resource::Format()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5593
diff
changeset
|
487 transaction_.ListAvailableAttachments(attachments, internalId); |
a906dc19264c
created FindResponse::Resource::Format()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5593
diff
changeset
|
488 |
a906dc19264c
created FindResponse::Resource::Format()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5593
diff
changeset
|
489 for (std::set<FileContentType>::const_iterator it = attachments.begin(); it != attachments.end(); ++it) |
a906dc19264c
created FindResponse::Resource::Format()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5593
diff
changeset
|
490 { |
a906dc19264c
created FindResponse::Resource::Format()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5593
diff
changeset
|
491 FileInfo info; |
a906dc19264c
created FindResponse::Resource::Format()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5593
diff
changeset
|
492 int64_t revision; |
a906dc19264c
created FindResponse::Resource::Format()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5593
diff
changeset
|
493 if (transaction_.LookupAttachment(info, revision, internalId, *it) && |
a906dc19264c
created FindResponse::Resource::Format()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5593
diff
changeset
|
494 info.GetContentType() == *it) |
a906dc19264c
created FindResponse::Resource::Format()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5593
diff
changeset
|
495 { |
a906dc19264c
created FindResponse::Resource::Format()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5593
diff
changeset
|
496 resource->AddAttachment(info); |
a906dc19264c
created FindResponse::Resource::Format()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5593
diff
changeset
|
497 } |
a906dc19264c
created FindResponse::Resource::Format()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5593
diff
changeset
|
498 else |
a906dc19264c
created FindResponse::Resource::Format()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5593
diff
changeset
|
499 { |
5595
a87f2a56257d
implemented FindRequest::retrieveChildrenMetadata_
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5594
diff
changeset
|
500 throw OrthancException(ErrorCode_DatabasePlugin); |
5594
a906dc19264c
created FindResponse::Resource::Format()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5593
diff
changeset
|
501 } |
a906dc19264c
created FindResponse::Resource::Format()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5593
diff
changeset
|
502 } |
a906dc19264c
created FindResponse::Resource::Format()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5593
diff
changeset
|
503 } |
a906dc19264c
created FindResponse::Resource::Format()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5593
diff
changeset
|
504 |
a906dc19264c
created FindResponse::Resource::Format()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5593
diff
changeset
|
505 { |
5667
93dff1fccf36
recursive descent to the children
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5666
diff
changeset
|
506 const ResourceType bottomLevel = GetBottomLevelOfInterest(request); |
5554
12d8a1a266e9
introduction of FindRequest and FindResponse
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
507 |
5667
93dff1fccf36
recursive descent to the children
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5666
diff
changeset
|
508 std::list<int64_t> currentIds; |
93dff1fccf36
recursive descent to the children
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5666
diff
changeset
|
509 currentIds.push_back(internalId); |
93dff1fccf36
recursive descent to the children
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5666
diff
changeset
|
510 |
93dff1fccf36
recursive descent to the children
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5666
diff
changeset
|
511 ResourceType currentLevel = level; |
93dff1fccf36
recursive descent to the children
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5666
diff
changeset
|
512 |
93dff1fccf36
recursive descent to the children
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5666
diff
changeset
|
513 while (currentLevel != bottomLevel) |
5554
12d8a1a266e9
introduction of FindRequest and FindResponse
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
514 { |
5667
93dff1fccf36
recursive descent to the children
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5666
diff
changeset
|
515 ResourceType childrenLevel = GetChildResourceType(currentLevel); |
93dff1fccf36
recursive descent to the children
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5666
diff
changeset
|
516 |
5676
b744a2cf408a
shorten ParentRetrieveSpecification/ChildrenRetrieveSpecification as ParentSpecification/ChildrenSpecification
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5674
diff
changeset
|
517 if (request.GetChildrenSpecification(childrenLevel).IsRetrieveIdentifiers()) |
5667
93dff1fccf36
recursive descent to the children
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5666
diff
changeset
|
518 { |
5668
bd1352bd9d82
configuring requests for ModalitiesInStudy and SOPClassesInStudy
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5667
diff
changeset
|
519 for (std::list<int64_t>::const_iterator it = currentIds.begin(); it != currentIds.end(); ++it) |
5667
93dff1fccf36
recursive descent to the children
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5666
diff
changeset
|
520 { |
93dff1fccf36
recursive descent to the children
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5666
diff
changeset
|
521 std::list<std::string> ids; |
93dff1fccf36
recursive descent to the children
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5666
diff
changeset
|
522 transaction_.GetChildrenPublicId(ids, *it); |
93dff1fccf36
recursive descent to the children
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5666
diff
changeset
|
523 |
93dff1fccf36
recursive descent to the children
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5666
diff
changeset
|
524 for (std::list<std::string>::const_iterator it2 = ids.begin(); it2 != ids.end(); ++it2) |
93dff1fccf36
recursive descent to the children
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5666
diff
changeset
|
525 { |
93dff1fccf36
recursive descent to the children
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5666
diff
changeset
|
526 resource->AddChildIdentifier(childrenLevel, *it2); |
93dff1fccf36
recursive descent to the children
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5666
diff
changeset
|
527 } |
93dff1fccf36
recursive descent to the children
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5666
diff
changeset
|
528 } |
93dff1fccf36
recursive descent to the children
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5666
diff
changeset
|
529 } |
5666
aa231c18b9d2
adding computed tags
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5641
diff
changeset
|
530 |
5676
b744a2cf408a
shorten ParentRetrieveSpecification/ChildrenRetrieveSpecification as ParentSpecification/ChildrenSpecification
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5674
diff
changeset
|
531 const std::set<MetadataType>& metadata = request.GetChildrenSpecification(childrenLevel).GetMetadata(); |
5668
bd1352bd9d82
configuring requests for ModalitiesInStudy and SOPClassesInStudy
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5667
diff
changeset
|
532 |
bd1352bd9d82
configuring requests for ModalitiesInStudy and SOPClassesInStudy
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5667
diff
changeset
|
533 for (std::set<MetadataType>::const_iterator it = metadata.begin(); it != metadata.end(); ++it) |
bd1352bd9d82
configuring requests for ModalitiesInStudy and SOPClassesInStudy
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5667
diff
changeset
|
534 { |
bd1352bd9d82
configuring requests for ModalitiesInStudy and SOPClassesInStudy
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5667
diff
changeset
|
535 for (std::list<int64_t>::const_iterator it2 = currentIds.begin(); it2 != currentIds.end(); ++it2) |
bd1352bd9d82
configuring requests for ModalitiesInStudy and SOPClassesInStudy
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5667
diff
changeset
|
536 { |
bd1352bd9d82
configuring requests for ModalitiesInStudy and SOPClassesInStudy
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5667
diff
changeset
|
537 std::list<std::string> values; |
bd1352bd9d82
configuring requests for ModalitiesInStudy and SOPClassesInStudy
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5667
diff
changeset
|
538 transaction_.GetChildrenMetadata(values, *it2, *it); |
bd1352bd9d82
configuring requests for ModalitiesInStudy and SOPClassesInStudy
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5667
diff
changeset
|
539 |
bd1352bd9d82
configuring requests for ModalitiesInStudy and SOPClassesInStudy
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5667
diff
changeset
|
540 for (std::list<std::string>::const_iterator it3 = values.begin(); it3 != values.end(); ++it3) |
bd1352bd9d82
configuring requests for ModalitiesInStudy and SOPClassesInStudy
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5667
diff
changeset
|
541 { |
5672
e300f22a46f0
implemented computed tags
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5668
diff
changeset
|
542 resource->AddChildrenMetadataValue(childrenLevel, *it, *it3); |
5668
bd1352bd9d82
configuring requests for ModalitiesInStudy and SOPClassesInStudy
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5667
diff
changeset
|
543 } |
bd1352bd9d82
configuring requests for ModalitiesInStudy and SOPClassesInStudy
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5667
diff
changeset
|
544 } |
bd1352bd9d82
configuring requests for ModalitiesInStudy and SOPClassesInStudy
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5667
diff
changeset
|
545 } |
bd1352bd9d82
configuring requests for ModalitiesInStudy and SOPClassesInStudy
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5667
diff
changeset
|
546 |
5676
b744a2cf408a
shorten ParentRetrieveSpecification/ChildrenRetrieveSpecification as ParentSpecification/ChildrenSpecification
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5674
diff
changeset
|
547 const std::set<DicomTag>& mainDicomTags = request.GetChildrenSpecification(childrenLevel).GetMainDicomTags(); |
5668
bd1352bd9d82
configuring requests for ModalitiesInStudy and SOPClassesInStudy
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5667
diff
changeset
|
548 |
bd1352bd9d82
configuring requests for ModalitiesInStudy and SOPClassesInStudy
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5667
diff
changeset
|
549 if (childrenLevel != bottomLevel || |
bd1352bd9d82
configuring requests for ModalitiesInStudy and SOPClassesInStudy
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5667
diff
changeset
|
550 !mainDicomTags.empty()) |
5666
aa231c18b9d2
adding computed tags
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5641
diff
changeset
|
551 { |
5667
93dff1fccf36
recursive descent to the children
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5666
diff
changeset
|
552 std::list<int64_t> childrenIds; |
93dff1fccf36
recursive descent to the children
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5666
diff
changeset
|
553 |
93dff1fccf36
recursive descent to the children
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5666
diff
changeset
|
554 for (std::list<int64_t>::const_iterator it = currentIds.begin(); it != currentIds.end(); ++it) |
93dff1fccf36
recursive descent to the children
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5666
diff
changeset
|
555 { |
93dff1fccf36
recursive descent to the children
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5666
diff
changeset
|
556 std::list<int64_t> tmp; |
93dff1fccf36
recursive descent to the children
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5666
diff
changeset
|
557 transaction_.GetChildrenInternalId(tmp, *it); |
93dff1fccf36
recursive descent to the children
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5666
diff
changeset
|
558 |
93dff1fccf36
recursive descent to the children
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5666
diff
changeset
|
559 childrenIds.splice(childrenIds.end(), tmp); |
93dff1fccf36
recursive descent to the children
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5666
diff
changeset
|
560 } |
93dff1fccf36
recursive descent to the children
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5666
diff
changeset
|
561 |
5668
bd1352bd9d82
configuring requests for ModalitiesInStudy and SOPClassesInStudy
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5667
diff
changeset
|
562 if (!mainDicomTags.empty()) |
bd1352bd9d82
configuring requests for ModalitiesInStudy and SOPClassesInStudy
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5667
diff
changeset
|
563 { |
bd1352bd9d82
configuring requests for ModalitiesInStudy and SOPClassesInStudy
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5667
diff
changeset
|
564 for (std::list<int64_t>::const_iterator it = childrenIds.begin(); it != childrenIds.end(); ++it) |
bd1352bd9d82
configuring requests for ModalitiesInStudy and SOPClassesInStudy
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5667
diff
changeset
|
565 { |
bd1352bd9d82
configuring requests for ModalitiesInStudy and SOPClassesInStudy
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5667
diff
changeset
|
566 DicomMap m; |
bd1352bd9d82
configuring requests for ModalitiesInStudy and SOPClassesInStudy
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5667
diff
changeset
|
567 transaction_.GetMainDicomTags(m, *it); |
bd1352bd9d82
configuring requests for ModalitiesInStudy and SOPClassesInStudy
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5667
diff
changeset
|
568 |
bd1352bd9d82
configuring requests for ModalitiesInStudy and SOPClassesInStudy
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5667
diff
changeset
|
569 for (std::set<DicomTag>::const_iterator it2 = mainDicomTags.begin(); it2 != mainDicomTags.end(); ++it2) |
bd1352bd9d82
configuring requests for ModalitiesInStudy and SOPClassesInStudy
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5667
diff
changeset
|
570 { |
bd1352bd9d82
configuring requests for ModalitiesInStudy and SOPClassesInStudy
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5667
diff
changeset
|
571 std::string value; |
bd1352bd9d82
configuring requests for ModalitiesInStudy and SOPClassesInStudy
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5667
diff
changeset
|
572 if (m.LookupStringValue(value, *it2, false /* no binary allowed */)) |
bd1352bd9d82
configuring requests for ModalitiesInStudy and SOPClassesInStudy
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5667
diff
changeset
|
573 { |
5672
e300f22a46f0
implemented computed tags
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5668
diff
changeset
|
574 resource->AddChildrenMainDicomTagValue(childrenLevel, *it2, value); |
5668
bd1352bd9d82
configuring requests for ModalitiesInStudy and SOPClassesInStudy
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5667
diff
changeset
|
575 } |
bd1352bd9d82
configuring requests for ModalitiesInStudy and SOPClassesInStudy
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5667
diff
changeset
|
576 } |
bd1352bd9d82
configuring requests for ModalitiesInStudy and SOPClassesInStudy
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5667
diff
changeset
|
577 } |
bd1352bd9d82
configuring requests for ModalitiesInStudy and SOPClassesInStudy
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5667
diff
changeset
|
578 } |
bd1352bd9d82
configuring requests for ModalitiesInStudy and SOPClassesInStudy
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5667
diff
changeset
|
579 |
5667
93dff1fccf36
recursive descent to the children
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5666
diff
changeset
|
580 currentIds = childrenIds; |
5666
aa231c18b9d2
adding computed tags
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5641
diff
changeset
|
581 } |
5667
93dff1fccf36
recursive descent to the children
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5666
diff
changeset
|
582 else |
93dff1fccf36
recursive descent to the children
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5666
diff
changeset
|
583 { |
93dff1fccf36
recursive descent to the children
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5666
diff
changeset
|
584 currentIds.clear(); |
93dff1fccf36
recursive descent to the children
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5666
diff
changeset
|
585 } |
93dff1fccf36
recursive descent to the children
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5666
diff
changeset
|
586 |
93dff1fccf36
recursive descent to the children
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5666
diff
changeset
|
587 currentLevel = childrenLevel; |
5565
def06a42e5ef
Updated FindRequest & FindResponse definitions
Alain Mazy <am@orthanc.team>
parents:
5554
diff
changeset
|
588 } |
5593
862b54b4cfe2
implemented the default multi-stage find/expand
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5592
diff
changeset
|
589 } |
5554
12d8a1a266e9
introduction of FindRequest and FindResponse
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
590 |
5772
093a8693ba16
replaced SetRetrieveOneInstanceIdentifier() by SetRetrieveOneInstanceMetadataAndAttachments()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5771
diff
changeset
|
591 if (request.GetLevel() != ResourceType_Instance && |
093a8693ba16
replaced SetRetrieveOneInstanceIdentifier() by SetRetrieveOneInstanceMetadataAndAttachments()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5771
diff
changeset
|
592 request.IsRetrieveOneInstanceMetadataAndAttachments()) |
5596
81a29ad7fb4b
added possibility to retrieve main DICOM tags and metadata at any level
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5595
diff
changeset
|
593 { |
5609
4690a0d2b01e
preliminary support of requestedTags
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5606
diff
changeset
|
594 int64_t currentId = internalId; |
4690a0d2b01e
preliminary support of requestedTags
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5606
diff
changeset
|
595 ResourceType currentLevel = level; |
5596
81a29ad7fb4b
added possibility to retrieve main DICOM tags and metadata at any level
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5595
diff
changeset
|
596 |
5609
4690a0d2b01e
preliminary support of requestedTags
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5606
diff
changeset
|
597 while (currentLevel != ResourceType_Instance) |
4690a0d2b01e
preliminary support of requestedTags
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5606
diff
changeset
|
598 { |
4690a0d2b01e
preliminary support of requestedTags
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5606
diff
changeset
|
599 std::list<int64_t> children; |
4690a0d2b01e
preliminary support of requestedTags
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5606
diff
changeset
|
600 transaction_.GetChildrenInternalId(children, currentId); |
4690a0d2b01e
preliminary support of requestedTags
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5606
diff
changeset
|
601 if (children.empty()) |
4690a0d2b01e
preliminary support of requestedTags
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5606
diff
changeset
|
602 { |
4690a0d2b01e
preliminary support of requestedTags
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5606
diff
changeset
|
603 throw OrthancException(ErrorCode_DatabasePlugin); |
5596
81a29ad7fb4b
added possibility to retrieve main DICOM tags and metadata at any level
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5595
diff
changeset
|
604 } |
81a29ad7fb4b
added possibility to retrieve main DICOM tags and metadata at any level
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5595
diff
changeset
|
605 else |
81a29ad7fb4b
added possibility to retrieve main DICOM tags and metadata at any level
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5595
diff
changeset
|
606 { |
5609
4690a0d2b01e
preliminary support of requestedTags
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5606
diff
changeset
|
607 currentId = children.front(); |
4690a0d2b01e
preliminary support of requestedTags
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5606
diff
changeset
|
608 currentLevel = GetChildResourceType(currentLevel); |
5596
81a29ad7fb4b
added possibility to retrieve main DICOM tags and metadata at any level
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5595
diff
changeset
|
609 } |
81a29ad7fb4b
added possibility to retrieve main DICOM tags and metadata at any level
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5595
diff
changeset
|
610 } |
5609
4690a0d2b01e
preliminary support of requestedTags
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5606
diff
changeset
|
611 |
5772
093a8693ba16
replaced SetRetrieveOneInstanceIdentifier() by SetRetrieveOneInstanceMetadataAndAttachments()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5771
diff
changeset
|
612 std::map<MetadataType, std::string> metadata; |
093a8693ba16
replaced SetRetrieveOneInstanceIdentifier() by SetRetrieveOneInstanceMetadataAndAttachments()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5771
diff
changeset
|
613 transaction_.GetAllMetadata(metadata, currentId); |
093a8693ba16
replaced SetRetrieveOneInstanceIdentifier() by SetRetrieveOneInstanceMetadataAndAttachments()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5771
diff
changeset
|
614 |
093a8693ba16
replaced SetRetrieveOneInstanceIdentifier() by SetRetrieveOneInstanceMetadataAndAttachments()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5771
diff
changeset
|
615 std::set<FileContentType> attachmentsType; |
093a8693ba16
replaced SetRetrieveOneInstanceIdentifier() by SetRetrieveOneInstanceMetadataAndAttachments()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5771
diff
changeset
|
616 transaction_.ListAvailableAttachments(attachmentsType, currentId); |
093a8693ba16
replaced SetRetrieveOneInstanceIdentifier() by SetRetrieveOneInstanceMetadataAndAttachments()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5771
diff
changeset
|
617 |
093a8693ba16
replaced SetRetrieveOneInstanceIdentifier() by SetRetrieveOneInstanceMetadataAndAttachments()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5771
diff
changeset
|
618 std::map<FileContentType, FileInfo> attachments; |
093a8693ba16
replaced SetRetrieveOneInstanceIdentifier() by SetRetrieveOneInstanceMetadataAndAttachments()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5771
diff
changeset
|
619 for (std::set<FileContentType>::const_iterator it = attachmentsType.begin(); it != attachmentsType.end(); ++it) |
093a8693ba16
replaced SetRetrieveOneInstanceIdentifier() by SetRetrieveOneInstanceMetadataAndAttachments()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5771
diff
changeset
|
620 { |
093a8693ba16
replaced SetRetrieveOneInstanceIdentifier() by SetRetrieveOneInstanceMetadataAndAttachments()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5771
diff
changeset
|
621 FileInfo info; |
093a8693ba16
replaced SetRetrieveOneInstanceIdentifier() by SetRetrieveOneInstanceMetadataAndAttachments()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5771
diff
changeset
|
622 int64_t revision; // Unused in this case |
093a8693ba16
replaced SetRetrieveOneInstanceIdentifier() by SetRetrieveOneInstanceMetadataAndAttachments()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5771
diff
changeset
|
623 if (transaction_.LookupAttachment(info, revision, currentId, *it)) |
093a8693ba16
replaced SetRetrieveOneInstanceIdentifier() by SetRetrieveOneInstanceMetadataAndAttachments()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5771
diff
changeset
|
624 { |
093a8693ba16
replaced SetRetrieveOneInstanceIdentifier() by SetRetrieveOneInstanceMetadataAndAttachments()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5771
diff
changeset
|
625 attachments[*it] = info; |
093a8693ba16
replaced SetRetrieveOneInstanceIdentifier() by SetRetrieveOneInstanceMetadataAndAttachments()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5771
diff
changeset
|
626 } |
093a8693ba16
replaced SetRetrieveOneInstanceIdentifier() by SetRetrieveOneInstanceMetadataAndAttachments()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5771
diff
changeset
|
627 else |
093a8693ba16
replaced SetRetrieveOneInstanceIdentifier() by SetRetrieveOneInstanceMetadataAndAttachments()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5771
diff
changeset
|
628 { |
093a8693ba16
replaced SetRetrieveOneInstanceIdentifier() by SetRetrieveOneInstanceMetadataAndAttachments()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5771
diff
changeset
|
629 throw OrthancException(ErrorCode_DatabasePlugin); |
093a8693ba16
replaced SetRetrieveOneInstanceIdentifier() by SetRetrieveOneInstanceMetadataAndAttachments()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5771
diff
changeset
|
630 } |
093a8693ba16
replaced SetRetrieveOneInstanceIdentifier() by SetRetrieveOneInstanceMetadataAndAttachments()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5771
diff
changeset
|
631 } |
093a8693ba16
replaced SetRetrieveOneInstanceIdentifier() by SetRetrieveOneInstanceMetadataAndAttachments()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5771
diff
changeset
|
632 |
093a8693ba16
replaced SetRetrieveOneInstanceIdentifier() by SetRetrieveOneInstanceMetadataAndAttachments()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5771
diff
changeset
|
633 resource->SetOneInstanceMetadataAndAttachments(transaction_.GetPublicId(currentId), metadata, attachments); |
5596
81a29ad7fb4b
added possibility to retrieve main DICOM tags and metadata at any level
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5595
diff
changeset
|
634 } |
81a29ad7fb4b
added possibility to retrieve main DICOM tags and metadata at any level
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5595
diff
changeset
|
635 |
5593
862b54b4cfe2
implemented the default multi-stage find/expand
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5592
diff
changeset
|
636 response.Add(resource.release()); |
5554
12d8a1a266e9
introduction of FindRequest and FindResponse
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
637 } |
12d8a1a266e9
introduction of FindRequest and FindResponse
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
638 } |
12d8a1a266e9
introduction of FindRequest and FindResponse
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
639 } |