annotate OrthancServer/Sources/Database/FindRequest.cpp @ 5666:aa231c18b9d2 find-refactoring

adding computed tags
author Sebastien Jodogne <s.jodogne@gmail.com>
date Thu, 04 Jul 2024 18:31:54 +0200
parents 3f13db27b399
children 74f3aab95886
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
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 "FindRequest.h"
12d8a1a266e9 introduction of FindRequest and FindResponse
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
25
12d8a1a266e9 introduction of FindRequest and FindResponse
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
26 #include "../../../OrthancFramework/Sources/OrthancException.h"
12d8a1a266e9 introduction of FindRequest and FindResponse
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
27
5614
4640b7ae9a11 moving normalization of constraints into FindRequest
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 5610
diff changeset
28 #include "MainDicomTagsRegistry.h"
5554
12d8a1a266e9 introduction of FindRequest and FindResponse
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
29
12d8a1a266e9 introduction of FindRequest and FindResponse
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
30 #include <cassert>
12d8a1a266e9 introduction of FindRequest and FindResponse
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
31
5614
4640b7ae9a11 moving normalization of constraints into FindRequest
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 5610
diff changeset
32
5554
12d8a1a266e9 introduction of FindRequest and FindResponse
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
33 namespace Orthanc
12d8a1a266e9 introduction of FindRequest and FindResponse
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
34 {
5619
1864b16bc7b1 added FindRequest::ParentRetrieveSpecification
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 5614
diff changeset
35 FindRequest::ParentRetrieveSpecification& FindRequest::GetParentRetrieveSpecification(ResourceType level)
1864b16bc7b1 added FindRequest::ParentRetrieveSpecification
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 5614
diff changeset
36 {
1864b16bc7b1 added FindRequest::ParentRetrieveSpecification
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 5614
diff changeset
37 if (!IsResourceLevelAboveOrEqual(level, level_))
1864b16bc7b1 added FindRequest::ParentRetrieveSpecification
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 5614
diff changeset
38 {
1864b16bc7b1 added FindRequest::ParentRetrieveSpecification
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 5614
diff changeset
39 throw OrthancException(ErrorCode_ParameterOutOfRange);
1864b16bc7b1 added FindRequest::ParentRetrieveSpecification
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 5614
diff changeset
40 }
1864b16bc7b1 added FindRequest::ParentRetrieveSpecification
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 5614
diff changeset
41
1864b16bc7b1 added FindRequest::ParentRetrieveSpecification
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 5614
diff changeset
42 switch (level)
1864b16bc7b1 added FindRequest::ParentRetrieveSpecification
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 5614
diff changeset
43 {
1864b16bc7b1 added FindRequest::ParentRetrieveSpecification
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 5614
diff changeset
44 case ResourceType_Patient:
1864b16bc7b1 added FindRequest::ParentRetrieveSpecification
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 5614
diff changeset
45 return retrieveParentPatient_;
1864b16bc7b1 added FindRequest::ParentRetrieveSpecification
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 5614
diff changeset
46
1864b16bc7b1 added FindRequest::ParentRetrieveSpecification
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 5614
diff changeset
47 case ResourceType_Study:
1864b16bc7b1 added FindRequest::ParentRetrieveSpecification
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 5614
diff changeset
48 return retrieveParentStudy_;
1864b16bc7b1 added FindRequest::ParentRetrieveSpecification
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 5614
diff changeset
49
1864b16bc7b1 added FindRequest::ParentRetrieveSpecification
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 5614
diff changeset
50 case ResourceType_Series:
1864b16bc7b1 added FindRequest::ParentRetrieveSpecification
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 5614
diff changeset
51 return retrieveParentSeries_;
1864b16bc7b1 added FindRequest::ParentRetrieveSpecification
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 5614
diff changeset
52
1864b16bc7b1 added FindRequest::ParentRetrieveSpecification
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 5614
diff changeset
53 default:
1864b16bc7b1 added FindRequest::ParentRetrieveSpecification
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 5614
diff changeset
54 throw OrthancException(ErrorCode_ParameterOutOfRange);
1864b16bc7b1 added FindRequest::ParentRetrieveSpecification
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 5614
diff changeset
55 }
1864b16bc7b1 added FindRequest::ParentRetrieveSpecification
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 5614
diff changeset
56 }
1864b16bc7b1 added FindRequest::ParentRetrieveSpecification
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 5614
diff changeset
57
1864b16bc7b1 added FindRequest::ParentRetrieveSpecification
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 5614
diff changeset
58
5621
732ec9feeea8 introduction of FindRequest::ChildrenRetrieveSpecification
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 5619
diff changeset
59 FindRequest::ChildrenRetrieveSpecification& FindRequest::GetChildrenRetrieveSpecification(ResourceType level)
732ec9feeea8 introduction of FindRequest::ChildrenRetrieveSpecification
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 5619
diff changeset
60 {
732ec9feeea8 introduction of FindRequest::ChildrenRetrieveSpecification
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 5619
diff changeset
61 if (!IsResourceLevelAboveOrEqual(level_, level))
732ec9feeea8 introduction of FindRequest::ChildrenRetrieveSpecification
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 5619
diff changeset
62 {
732ec9feeea8 introduction of FindRequest::ChildrenRetrieveSpecification
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 5619
diff changeset
63 throw OrthancException(ErrorCode_ParameterOutOfRange);
732ec9feeea8 introduction of FindRequest::ChildrenRetrieveSpecification
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 5619
diff changeset
64 }
732ec9feeea8 introduction of FindRequest::ChildrenRetrieveSpecification
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 5619
diff changeset
65
732ec9feeea8 introduction of FindRequest::ChildrenRetrieveSpecification
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 5619
diff changeset
66 switch (level)
732ec9feeea8 introduction of FindRequest::ChildrenRetrieveSpecification
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 5619
diff changeset
67 {
732ec9feeea8 introduction of FindRequest::ChildrenRetrieveSpecification
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 5619
diff changeset
68 case ResourceType_Study:
732ec9feeea8 introduction of FindRequest::ChildrenRetrieveSpecification
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 5619
diff changeset
69 return retrieveChildrenStudies_;
732ec9feeea8 introduction of FindRequest::ChildrenRetrieveSpecification
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 5619
diff changeset
70
732ec9feeea8 introduction of FindRequest::ChildrenRetrieveSpecification
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 5619
diff changeset
71 case ResourceType_Series:
732ec9feeea8 introduction of FindRequest::ChildrenRetrieveSpecification
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 5619
diff changeset
72 return retrieveChildrenSeries_;
732ec9feeea8 introduction of FindRequest::ChildrenRetrieveSpecification
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 5619
diff changeset
73
732ec9feeea8 introduction of FindRequest::ChildrenRetrieveSpecification
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 5619
diff changeset
74 case ResourceType_Instance:
732ec9feeea8 introduction of FindRequest::ChildrenRetrieveSpecification
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 5619
diff changeset
75 return retrieveChildrenInstances_;
732ec9feeea8 introduction of FindRequest::ChildrenRetrieveSpecification
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 5619
diff changeset
76
732ec9feeea8 introduction of FindRequest::ChildrenRetrieveSpecification
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 5619
diff changeset
77 default:
732ec9feeea8 introduction of FindRequest::ChildrenRetrieveSpecification
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 5619
diff changeset
78 throw OrthancException(ErrorCode_ParameterOutOfRange);
732ec9feeea8 introduction of FindRequest::ChildrenRetrieveSpecification
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 5619
diff changeset
79 }
732ec9feeea8 introduction of FindRequest::ChildrenRetrieveSpecification
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 5619
diff changeset
80 }
732ec9feeea8 introduction of FindRequest::ChildrenRetrieveSpecification
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 5619
diff changeset
81
732ec9feeea8 introduction of FindRequest::ChildrenRetrieveSpecification
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 5619
diff changeset
82
5554
12d8a1a266e9 introduction of FindRequest and FindResponse
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
83 FindRequest::FindRequest(ResourceType level) :
12d8a1a266e9 introduction of FindRequest and FindResponse
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
84 level_(level),
12d8a1a266e9 introduction of FindRequest and FindResponse
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
85 hasLimits_(false),
12d8a1a266e9 introduction of FindRequest and FindResponse
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
86 limitsSince_(0),
12d8a1a266e9 introduction of FindRequest and FindResponse
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
87 limitsCount_(0),
5619
1864b16bc7b1 added FindRequest::ParentRetrieveSpecification
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 5614
diff changeset
88 retrieveMainDicomTags_(false),
1864b16bc7b1 added FindRequest::ParentRetrieveSpecification
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 5614
diff changeset
89 retrieveMetadata_(false),
5590
8b32213af23e replaced FindRequest::ResponseContent by booleans
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 5568
diff changeset
90 retrieveLabels_(false),
8b32213af23e replaced FindRequest::ResponseContent by booleans
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 5568
diff changeset
91 retrieveAttachments_(false),
8b32213af23e replaced FindRequest::ResponseContent by booleans
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 5568
diff changeset
92 retrieveParentIdentifier_(false),
5609
4690a0d2b01e preliminary support of requestedTags
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 5596
diff changeset
93 retrieveOneInstanceIdentifier_(false)
5554
12d8a1a266e9 introduction of FindRequest and FindResponse
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
94 {
12d8a1a266e9 introduction of FindRequest and FindResponse
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
95 }
12d8a1a266e9 introduction of FindRequest and FindResponse
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
96
12d8a1a266e9 introduction of FindRequest and FindResponse
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
97
12d8a1a266e9 introduction of FindRequest and FindResponse
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
98 FindRequest::~FindRequest()
12d8a1a266e9 introduction of FindRequest and FindResponse
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
99 {
5567
f3562c1a150d FindRequest: group metadata and tag constrains in a single class, allow ordering against metadata
Alain Mazy <am@orthanc.team>
parents: 5565
diff changeset
100
f3562c1a150d FindRequest: group metadata and tag constrains in a single class, allow ordering against metadata
Alain Mazy <am@orthanc.team>
parents: 5565
diff changeset
101 for (std::deque<Ordering*>::iterator it = ordering_.begin(); it != ordering_.end(); ++it)
5554
12d8a1a266e9 introduction of FindRequest and FindResponse
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
102 {
12d8a1a266e9 introduction of FindRequest and FindResponse
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
103 assert(*it != NULL);
12d8a1a266e9 introduction of FindRequest and FindResponse
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
104 delete *it;
12d8a1a266e9 introduction of FindRequest and FindResponse
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
105 }
12d8a1a266e9 introduction of FindRequest and FindResponse
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
106 }
12d8a1a266e9 introduction of FindRequest and FindResponse
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
107
5609
4690a0d2b01e preliminary support of requestedTags
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 5596
diff changeset
108
4690a0d2b01e preliminary support of requestedTags
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 5596
diff changeset
109 void FindRequest::SetOrthancId(ResourceType level,
4690a0d2b01e preliminary support of requestedTags
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 5596
diff changeset
110 const std::string& id)
4690a0d2b01e preliminary support of requestedTags
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 5596
diff changeset
111 {
4690a0d2b01e preliminary support of requestedTags
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 5596
diff changeset
112 switch (level)
4690a0d2b01e preliminary support of requestedTags
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 5596
diff changeset
113 {
4690a0d2b01e preliminary support of requestedTags
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 5596
diff changeset
114 case ResourceType_Patient:
4690a0d2b01e preliminary support of requestedTags
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 5596
diff changeset
115 SetOrthancPatientId(id);
4690a0d2b01e preliminary support of requestedTags
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 5596
diff changeset
116 break;
4690a0d2b01e preliminary support of requestedTags
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 5596
diff changeset
117
4690a0d2b01e preliminary support of requestedTags
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 5596
diff changeset
118 case ResourceType_Study:
4690a0d2b01e preliminary support of requestedTags
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 5596
diff changeset
119 SetOrthancStudyId(id);
4690a0d2b01e preliminary support of requestedTags
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 5596
diff changeset
120 break;
4690a0d2b01e preliminary support of requestedTags
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 5596
diff changeset
121
4690a0d2b01e preliminary support of requestedTags
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 5596
diff changeset
122 case ResourceType_Series:
4690a0d2b01e preliminary support of requestedTags
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 5596
diff changeset
123 SetOrthancSeriesId(id);
4690a0d2b01e preliminary support of requestedTags
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 5596
diff changeset
124 break;
4690a0d2b01e preliminary support of requestedTags
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 5596
diff changeset
125
4690a0d2b01e preliminary support of requestedTags
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 5596
diff changeset
126 case ResourceType_Instance:
4690a0d2b01e preliminary support of requestedTags
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 5596
diff changeset
127 SetOrthancInstanceId(id);
4690a0d2b01e preliminary support of requestedTags
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 5596
diff changeset
128 break;
4690a0d2b01e preliminary support of requestedTags
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 5596
diff changeset
129
4690a0d2b01e preliminary support of requestedTags
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 5596
diff changeset
130 default:
4690a0d2b01e preliminary support of requestedTags
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 5596
diff changeset
131 throw OrthancException(ErrorCode_ParameterOutOfRange);
4690a0d2b01e preliminary support of requestedTags
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 5596
diff changeset
132 }
4690a0d2b01e preliminary support of requestedTags
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 5596
diff changeset
133 }
4690a0d2b01e preliminary support of requestedTags
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 5596
diff changeset
134
4690a0d2b01e preliminary support of requestedTags
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 5596
diff changeset
135
4690a0d2b01e preliminary support of requestedTags
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 5596
diff changeset
136 void FindRequest::SetOrthancPatientId(const std::string& id)
4690a0d2b01e preliminary support of requestedTags
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 5596
diff changeset
137 {
4690a0d2b01e preliminary support of requestedTags
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 5596
diff changeset
138 orthancIdentifiers_.SetPatientId(id);
4690a0d2b01e preliminary support of requestedTags
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 5596
diff changeset
139 }
4690a0d2b01e preliminary support of requestedTags
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 5596
diff changeset
140
4690a0d2b01e preliminary support of requestedTags
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 5596
diff changeset
141
4690a0d2b01e preliminary support of requestedTags
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 5596
diff changeset
142 void FindRequest::SetOrthancStudyId(const std::string& id)
4690a0d2b01e preliminary support of requestedTags
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 5596
diff changeset
143 {
4690a0d2b01e preliminary support of requestedTags
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 5596
diff changeset
144 if (level_ == ResourceType_Patient)
4690a0d2b01e preliminary support of requestedTags
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 5596
diff changeset
145 {
4690a0d2b01e preliminary support of requestedTags
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 5596
diff changeset
146 throw OrthancException(ErrorCode_BadSequenceOfCalls);
4690a0d2b01e preliminary support of requestedTags
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 5596
diff changeset
147 }
4690a0d2b01e preliminary support of requestedTags
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 5596
diff changeset
148 else
4690a0d2b01e preliminary support of requestedTags
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 5596
diff changeset
149 {
4690a0d2b01e preliminary support of requestedTags
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 5596
diff changeset
150 orthancIdentifiers_.SetStudyId(id);
4690a0d2b01e preliminary support of requestedTags
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 5596
diff changeset
151 }
4690a0d2b01e preliminary support of requestedTags
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 5596
diff changeset
152 }
4690a0d2b01e preliminary support of requestedTags
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 5596
diff changeset
153
4690a0d2b01e preliminary support of requestedTags
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 5596
diff changeset
154
4690a0d2b01e preliminary support of requestedTags
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 5596
diff changeset
155 void FindRequest::SetOrthancSeriesId(const std::string& id)
4690a0d2b01e preliminary support of requestedTags
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 5596
diff changeset
156 {
4690a0d2b01e preliminary support of requestedTags
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 5596
diff changeset
157 if (level_ == ResourceType_Patient ||
4690a0d2b01e preliminary support of requestedTags
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 5596
diff changeset
158 level_ == ResourceType_Study)
4690a0d2b01e preliminary support of requestedTags
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 5596
diff changeset
159 {
4690a0d2b01e preliminary support of requestedTags
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 5596
diff changeset
160 throw OrthancException(ErrorCode_BadSequenceOfCalls);
4690a0d2b01e preliminary support of requestedTags
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 5596
diff changeset
161 }
4690a0d2b01e preliminary support of requestedTags
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 5596
diff changeset
162 else
4690a0d2b01e preliminary support of requestedTags
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 5596
diff changeset
163 {
4690a0d2b01e preliminary support of requestedTags
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 5596
diff changeset
164 orthancIdentifiers_.SetSeriesId(id);
4690a0d2b01e preliminary support of requestedTags
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 5596
diff changeset
165 }
4690a0d2b01e preliminary support of requestedTags
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 5596
diff changeset
166 }
4690a0d2b01e preliminary support of requestedTags
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 5596
diff changeset
167
4690a0d2b01e preliminary support of requestedTags
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 5596
diff changeset
168
4690a0d2b01e preliminary support of requestedTags
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 5596
diff changeset
169 void FindRequest::SetOrthancInstanceId(const std::string& id)
4690a0d2b01e preliminary support of requestedTags
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 5596
diff changeset
170 {
4690a0d2b01e preliminary support of requestedTags
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 5596
diff changeset
171 if (level_ == ResourceType_Patient ||
4690a0d2b01e preliminary support of requestedTags
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 5596
diff changeset
172 level_ == ResourceType_Study ||
4690a0d2b01e preliminary support of requestedTags
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 5596
diff changeset
173 level_ == ResourceType_Series)
4690a0d2b01e preliminary support of requestedTags
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 5596
diff changeset
174 {
4690a0d2b01e preliminary support of requestedTags
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 5596
diff changeset
175 throw OrthancException(ErrorCode_BadSequenceOfCalls);
4690a0d2b01e preliminary support of requestedTags
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 5596
diff changeset
176 }
4690a0d2b01e preliminary support of requestedTags
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 5596
diff changeset
177 else
4690a0d2b01e preliminary support of requestedTags
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 5596
diff changeset
178 {
4690a0d2b01e preliminary support of requestedTags
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 5596
diff changeset
179 orthancIdentifiers_.SetInstanceId(id);
4690a0d2b01e preliminary support of requestedTags
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 5596
diff changeset
180 }
4690a0d2b01e preliminary support of requestedTags
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 5596
diff changeset
181 }
4690a0d2b01e preliminary support of requestedTags
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 5596
diff changeset
182
4690a0d2b01e preliminary support of requestedTags
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 5596
diff changeset
183
5568
b0b5546f1b9f find refactor: re-use existing code. /studies?expand is almost fully implemented with new code
Alain Mazy <am@orthanc.team>
parents: 5567
diff changeset
184 void FindRequest::AddDicomTagConstraint(const DicomTagConstraint& constraint)
5554
12d8a1a266e9 introduction of FindRequest and FindResponse
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
185 {
5614
4640b7ae9a11 moving normalization of constraints into FindRequest
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 5610
diff changeset
186 // This behaves like "StatelessDatabaseOperations::NormalizeLookup()" in Orthanc <= 1.12.3
4640b7ae9a11 moving normalization of constraints into FindRequest
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 5610
diff changeset
187
4640b7ae9a11 moving normalization of constraints into FindRequest
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 5610
diff changeset
188 if (mainDicomTagsRegistry_.get() == NULL)
4640b7ae9a11 moving normalization of constraints into FindRequest
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 5610
diff changeset
189 {
4640b7ae9a11 moving normalization of constraints into FindRequest
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 5610
diff changeset
190 // Lazy creation of the registry of main DICOM tags
4640b7ae9a11 moving normalization of constraints into FindRequest
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 5610
diff changeset
191 mainDicomTagsRegistry_.reset(new MainDicomTagsRegistry());
4640b7ae9a11 moving normalization of constraints into FindRequest
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 5610
diff changeset
192 }
4640b7ae9a11 moving normalization of constraints into FindRequest
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 5610
diff changeset
193
4640b7ae9a11 moving normalization of constraints into FindRequest
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 5610
diff changeset
194 ResourceType level;
4640b7ae9a11 moving normalization of constraints into FindRequest
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 5610
diff changeset
195 DicomTagType type;
4640b7ae9a11 moving normalization of constraints into FindRequest
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 5610
diff changeset
196
4640b7ae9a11 moving normalization of constraints into FindRequest
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 5610
diff changeset
197 mainDicomTagsRegistry_->LookupTag(level, type, constraint.GetTag());
4640b7ae9a11 moving normalization of constraints into FindRequest
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 5610
diff changeset
198
4640b7ae9a11 moving normalization of constraints into FindRequest
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 5610
diff changeset
199 if (type == DicomTagType_Identifier ||
4640b7ae9a11 moving normalization of constraints into FindRequest
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 5610
diff changeset
200 type == DicomTagType_Main)
4640b7ae9a11 moving normalization of constraints into FindRequest
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 5610
diff changeset
201 {
4640b7ae9a11 moving normalization of constraints into FindRequest
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 5610
diff changeset
202 // Use the fact that patient-level tags are copied at the study level
4640b7ae9a11 moving normalization of constraints into FindRequest
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 5610
diff changeset
203 if (level == ResourceType_Patient &&
4640b7ae9a11 moving normalization of constraints into FindRequest
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 5610
diff changeset
204 GetLevel() != ResourceType_Patient)
4640b7ae9a11 moving normalization of constraints into FindRequest
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 5610
diff changeset
205 {
4640b7ae9a11 moving normalization of constraints into FindRequest
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 5610
diff changeset
206 level = ResourceType_Study;
4640b7ae9a11 moving normalization of constraints into FindRequest
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 5610
diff changeset
207 }
4640b7ae9a11 moving normalization of constraints into FindRequest
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 5610
diff changeset
208
4640b7ae9a11 moving normalization of constraints into FindRequest
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 5610
diff changeset
209 dicomTagConstraints_.push_back(constraint.ConvertToDatabaseConstraint(level, type));
4640b7ae9a11 moving normalization of constraints into FindRequest
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 5610
diff changeset
210 }
5554
12d8a1a266e9 introduction of FindRequest and FindResponse
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
211 }
12d8a1a266e9 introduction of FindRequest and FindResponse
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
212
5614
4640b7ae9a11 moving normalization of constraints into FindRequest
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 5610
diff changeset
213
4640b7ae9a11 moving normalization of constraints into FindRequest
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 5610
diff changeset
214 const DatabaseConstraint& FindRequest::GetDicomTagConstraint(size_t index) const
5554
12d8a1a266e9 introduction of FindRequest and FindResponse
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
215 {
5568
b0b5546f1b9f find refactor: re-use existing code. /studies?expand is almost fully implemented with new code
Alain Mazy <am@orthanc.team>
parents: 5567
diff changeset
216 if (index >= dicomTagConstraints_.size())
5554
12d8a1a266e9 introduction of FindRequest and FindResponse
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
217 {
12d8a1a266e9 introduction of FindRequest and FindResponse
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
218 throw OrthancException(ErrorCode_ParameterOutOfRange);
12d8a1a266e9 introduction of FindRequest and FindResponse
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
219 }
12d8a1a266e9 introduction of FindRequest and FindResponse
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
220 else
12d8a1a266e9 introduction of FindRequest and FindResponse
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
221 {
5568
b0b5546f1b9f find refactor: re-use existing code. /studies?expand is almost fully implemented with new code
Alain Mazy <am@orthanc.team>
parents: 5567
diff changeset
222 return dicomTagConstraints_[index];
5554
12d8a1a266e9 introduction of FindRequest and FindResponse
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
223 }
12d8a1a266e9 introduction of FindRequest and FindResponse
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
224 }
12d8a1a266e9 introduction of FindRequest and FindResponse
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
225
12d8a1a266e9 introduction of FindRequest and FindResponse
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
226
12d8a1a266e9 introduction of FindRequest and FindResponse
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
227 void FindRequest::SetLimits(uint64_t since,
12d8a1a266e9 introduction of FindRequest and FindResponse
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
228 uint64_t count)
12d8a1a266e9 introduction of FindRequest and FindResponse
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
229 {
12d8a1a266e9 introduction of FindRequest and FindResponse
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
230 if (hasLimits_)
12d8a1a266e9 introduction of FindRequest and FindResponse
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
231 {
12d8a1a266e9 introduction of FindRequest and FindResponse
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
232 throw OrthancException(ErrorCode_BadSequenceOfCalls);
12d8a1a266e9 introduction of FindRequest and FindResponse
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
233 }
12d8a1a266e9 introduction of FindRequest and FindResponse
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
234 else
12d8a1a266e9 introduction of FindRequest and FindResponse
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
235 {
12d8a1a266e9 introduction of FindRequest and FindResponse
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
236 hasLimits_ = true;
12d8a1a266e9 introduction of FindRequest and FindResponse
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
237 limitsSince_ = since;
12d8a1a266e9 introduction of FindRequest and FindResponse
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
238 limitsCount_ = count;
12d8a1a266e9 introduction of FindRequest and FindResponse
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
239 }
12d8a1a266e9 introduction of FindRequest and FindResponse
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
240 }
12d8a1a266e9 introduction of FindRequest and FindResponse
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
241
12d8a1a266e9 introduction of FindRequest and FindResponse
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
242
12d8a1a266e9 introduction of FindRequest and FindResponse
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
243 uint64_t FindRequest::GetLimitsSince() const
12d8a1a266e9 introduction of FindRequest and FindResponse
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
244 {
12d8a1a266e9 introduction of FindRequest and FindResponse
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
245 if (hasLimits_)
12d8a1a266e9 introduction of FindRequest and FindResponse
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
246 {
12d8a1a266e9 introduction of FindRequest and FindResponse
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
247 return limitsSince_;
12d8a1a266e9 introduction of FindRequest and FindResponse
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
248 }
12d8a1a266e9 introduction of FindRequest and FindResponse
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
249 else
12d8a1a266e9 introduction of FindRequest and FindResponse
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
250 {
12d8a1a266e9 introduction of FindRequest and FindResponse
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
251 throw OrthancException(ErrorCode_BadSequenceOfCalls);
12d8a1a266e9 introduction of FindRequest and FindResponse
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
252 }
12d8a1a266e9 introduction of FindRequest and FindResponse
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
253 }
12d8a1a266e9 introduction of FindRequest and FindResponse
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
254
12d8a1a266e9 introduction of FindRequest and FindResponse
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
255
12d8a1a266e9 introduction of FindRequest and FindResponse
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
256 uint64_t FindRequest::GetLimitsCount() const
12d8a1a266e9 introduction of FindRequest and FindResponse
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
257 {
12d8a1a266e9 introduction of FindRequest and FindResponse
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
258 if (hasLimits_)
12d8a1a266e9 introduction of FindRequest and FindResponse
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
259 {
12d8a1a266e9 introduction of FindRequest and FindResponse
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
260 return limitsCount_;
12d8a1a266e9 introduction of FindRequest and FindResponse
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
261 }
12d8a1a266e9 introduction of FindRequest and FindResponse
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
262 else
12d8a1a266e9 introduction of FindRequest and FindResponse
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
263 {
12d8a1a266e9 introduction of FindRequest and FindResponse
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
264 throw OrthancException(ErrorCode_BadSequenceOfCalls);
12d8a1a266e9 introduction of FindRequest and FindResponse
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
265 }
12d8a1a266e9 introduction of FindRequest and FindResponse
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
266 }
12d8a1a266e9 introduction of FindRequest and FindResponse
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
267
12d8a1a266e9 introduction of FindRequest and FindResponse
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
268
5567
f3562c1a150d FindRequest: group metadata and tag constrains in a single class, allow ordering against metadata
Alain Mazy <am@orthanc.team>
parents: 5565
diff changeset
269 void FindRequest::AddOrdering(const DicomTag& tag,
f3562c1a150d FindRequest: group metadata and tag constrains in a single class, allow ordering against metadata
Alain Mazy <am@orthanc.team>
parents: 5565
diff changeset
270 OrderingDirection direction)
5554
12d8a1a266e9 introduction of FindRequest and FindResponse
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
271 {
5567
f3562c1a150d FindRequest: group metadata and tag constrains in a single class, allow ordering against metadata
Alain Mazy <am@orthanc.team>
parents: 5565
diff changeset
272 ordering_.push_back(new Ordering(Key(tag), direction));
5554
12d8a1a266e9 introduction of FindRequest and FindResponse
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
273 }
12d8a1a266e9 introduction of FindRequest and FindResponse
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
274
5592
1e2631b8b9af GenericFind::Execute() is working for a basic request
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 5590
diff changeset
275
5567
f3562c1a150d FindRequest: group metadata and tag constrains in a single class, allow ordering against metadata
Alain Mazy <am@orthanc.team>
parents: 5565
diff changeset
276 void FindRequest::AddOrdering(MetadataType metadataType,
f3562c1a150d FindRequest: group metadata and tag constrains in a single class, allow ordering against metadata
Alain Mazy <am@orthanc.team>
parents: 5565
diff changeset
277 OrderingDirection direction)
5554
12d8a1a266e9 introduction of FindRequest and FindResponse
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
278 {
5567
f3562c1a150d FindRequest: group metadata and tag constrains in a single class, allow ordering against metadata
Alain Mazy <am@orthanc.team>
parents: 5565
diff changeset
279 ordering_.push_back(new Ordering(Key(metadataType), direction));
5554
12d8a1a266e9 introduction of FindRequest and FindResponse
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
280 }
5567
f3562c1a150d FindRequest: group metadata and tag constrains in a single class, allow ordering against metadata
Alain Mazy <am@orthanc.team>
parents: 5565
diff changeset
281
5590
8b32213af23e replaced FindRequest::ResponseContent by booleans
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 5568
diff changeset
282
8b32213af23e replaced FindRequest::ResponseContent by booleans
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 5568
diff changeset
283 void FindRequest::SetRetrieveParentIdentifier(bool retrieve)
8b32213af23e replaced FindRequest::ResponseContent by booleans
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 5568
diff changeset
284 {
8b32213af23e replaced FindRequest::ResponseContent by booleans
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 5568
diff changeset
285 if (level_ == ResourceType_Patient)
8b32213af23e replaced FindRequest::ResponseContent by booleans
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 5568
diff changeset
286 {
8b32213af23e replaced FindRequest::ResponseContent by booleans
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 5568
diff changeset
287 throw OrthancException(ErrorCode_BadParameterType);
8b32213af23e replaced FindRequest::ResponseContent by booleans
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 5568
diff changeset
288 }
8b32213af23e replaced FindRequest::ResponseContent by booleans
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 5568
diff changeset
289 else
8b32213af23e replaced FindRequest::ResponseContent by booleans
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 5568
diff changeset
290 {
8b32213af23e replaced FindRequest::ResponseContent by booleans
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 5568
diff changeset
291 retrieveParentIdentifier_ = retrieve;
8b32213af23e replaced FindRequest::ResponseContent by booleans
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 5568
diff changeset
292 }
8b32213af23e replaced FindRequest::ResponseContent by booleans
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 5568
diff changeset
293 }
8b32213af23e replaced FindRequest::ResponseContent by booleans
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 5568
diff changeset
294
8b32213af23e replaced FindRequest::ResponseContent by booleans
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 5568
diff changeset
295
5595
a87f2a56257d implemented FindRequest::retrieveChildrenMetadata_
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 5592
diff changeset
296 void FindRequest::AddRetrieveChildrenMetadata(MetadataType metadata)
5590
8b32213af23e replaced FindRequest::ResponseContent by booleans
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 5568
diff changeset
297 {
5595
a87f2a56257d implemented FindRequest::retrieveChildrenMetadata_
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 5592
diff changeset
298 if (IsRetrieveChildrenMetadata(metadata))
5590
8b32213af23e replaced FindRequest::ResponseContent by booleans
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 5568
diff changeset
299 {
5596
81a29ad7fb4b added possibility to retrieve main DICOM tags and metadata at any level
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 5595
diff changeset
300 throw OrthancException(ErrorCode_BadSequenceOfCalls);
5590
8b32213af23e replaced FindRequest::ResponseContent by booleans
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 5568
diff changeset
301 }
8b32213af23e replaced FindRequest::ResponseContent by booleans
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 5568
diff changeset
302 else
8b32213af23e replaced FindRequest::ResponseContent by booleans
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 5568
diff changeset
303 {
5595
a87f2a56257d implemented FindRequest::retrieveChildrenMetadata_
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 5592
diff changeset
304 retrieveChildrenMetadata_.insert(metadata);
5590
8b32213af23e replaced FindRequest::ResponseContent by booleans
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 5568
diff changeset
305 }
8b32213af23e replaced FindRequest::ResponseContent by booleans
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 5568
diff changeset
306 }
5610
d4b570834d3a adding safeguards around FindRequest::SetRetrieveOneInstanceIdentifier()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 5609
diff changeset
307
d4b570834d3a adding safeguards around FindRequest::SetRetrieveOneInstanceIdentifier()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 5609
diff changeset
308
d4b570834d3a adding safeguards around FindRequest::SetRetrieveOneInstanceIdentifier()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 5609
diff changeset
309 void FindRequest::SetRetrieveOneInstanceIdentifier(bool retrieve)
d4b570834d3a adding safeguards around FindRequest::SetRetrieveOneInstanceIdentifier()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 5609
diff changeset
310 {
d4b570834d3a adding safeguards around FindRequest::SetRetrieveOneInstanceIdentifier()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 5609
diff changeset
311 if (level_ == ResourceType_Instance)
d4b570834d3a adding safeguards around FindRequest::SetRetrieveOneInstanceIdentifier()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 5609
diff changeset
312 {
d4b570834d3a adding safeguards around FindRequest::SetRetrieveOneInstanceIdentifier()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 5609
diff changeset
313 throw OrthancException(ErrorCode_BadSequenceOfCalls);
d4b570834d3a adding safeguards around FindRequest::SetRetrieveOneInstanceIdentifier()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 5609
diff changeset
314 }
d4b570834d3a adding safeguards around FindRequest::SetRetrieveOneInstanceIdentifier()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 5609
diff changeset
315 else
d4b570834d3a adding safeguards around FindRequest::SetRetrieveOneInstanceIdentifier()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 5609
diff changeset
316 {
d4b570834d3a adding safeguards around FindRequest::SetRetrieveOneInstanceIdentifier()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 5609
diff changeset
317 retrieveOneInstanceIdentifier_ = retrieve;
d4b570834d3a adding safeguards around FindRequest::SetRetrieveOneInstanceIdentifier()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 5609
diff changeset
318 }
d4b570834d3a adding safeguards around FindRequest::SetRetrieveOneInstanceIdentifier()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 5609
diff changeset
319 }
5554
12d8a1a266e9 introduction of FindRequest and FindResponse
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
320 }