comparison OrthancServer/Sources/Database/FindRequest.h @ 5590:8b32213af23e find-refactoring

replaced FindRequest::ResponseContent by booleans
author Sebastien Jodogne <s.jodogne@gmail.com>
date Fri, 03 May 2024 18:17:53 +0200
parents 0f5586c498d1
children 043c8016ed6a
comparison
equal deleted inserted replaced
5589:b51ee994cd6f 5590:8b32213af23e
38 namespace Orthanc 38 namespace Orthanc
39 { 39 {
40 class FindRequest : public boost::noncopyable 40 class FindRequest : public boost::noncopyable
41 { 41 {
42 public: 42 public:
43 enum ResponseContent 43 /**
44 { 44
45 ResponseContent_MainDicomTags = (1 << 0), // retrieve all tags from MainDicomTags and DicomIdentifiers 45 TO DISCUSS:
46 ResponseContent_Metadata = (1 << 1), // retrieve all metadata, their values and revision 46
47 ResponseContent_Labels = (1 << 2), // get all labels 47 (1) ResponseContent_ChildInstanceId = (1 << 6), // When you need to access all tags from a patient/study/series, you might need to open the DICOM file of a child instance
48 ResponseContent_Attachments = (1 << 3), // retrieve all attachments, their values and revision 48
49 ResponseContent_Parent = (1 << 4), // get the id of the parent 49 if (requestedTags.size() > 0 && resourceType != ResourceType_Instance) // if we are requesting specific tags that might be outside of the MainDicomTags, we must get a childInstanceId too
50 ResponseContent_Children = (1 << 5), // retrieve the list of children ids 50 {
51 ResponseContent_ChildInstanceId = (1 << 6), // When you need to access all tags from a patient/study/series, you might need to open the DICOM file of a child instance 51 responseContent = static_cast<FindRequest::ResponseContent>(responseContent | FindRequest::ResponseContent_ChildInstanceId);
52 ResponseContent_ChildrenMetadata = (1 << 7), // That is actually required to compute the series status but could be usefull for other stuffs. 52 }
53 ResponseContent_IsStable = (1 << 8), // This is currently not saved in DB but it could be in the future. 53
54 54
55 ResponseContent_IdentifiersOnly = 0, 55 (2) ResponseContent_IsStable = (1 << 8), // This is currently not saved in DB but it could be in the future.
56 ResponseContent_INTERNAL = 0x7FFFFFFF 56
57 }; 57 **/
58 58
59 enum ConstraintType
60 {
61 ConstraintType_Mandatory,
62 ConstraintType_Equality,
63 ConstraintType_Range,
64 ConstraintType_Wildcard,
65 ConstraintType_List
66 };
67 59
68 enum KeyType // used for ordering and filters 60 enum KeyType // used for ordering and filters
69 { 61 {
70 KeyType_DicomTag, 62 KeyType_DicomTag,
71 KeyType_Metadata 63 KeyType_Metadata
72 }; 64 };
65
73 66
74 enum OrderingDirection 67 enum OrderingDirection
75 { 68 {
76 OrderingDirection_Ascending, 69 OrderingDirection_Ascending,
77 OrderingDirection_Descending 70 OrderingDirection_Descending
170 uint64_t limitsCount_; 163 uint64_t limitsCount_;
171 std::set<std::string> labels_; 164 std::set<std::string> labels_;
172 LabelsConstraint labelsContraint_; 165 LabelsConstraint labelsContraint_;
173 std::deque<Ordering*> ordering_; // The ordering criteria (note: the order is important !) 166 std::deque<Ordering*> ordering_; // The ordering criteria (note: the order is important !)
174 167
175 // response fields
176 ResponseContent responseContent_;
177
178 // TODO: check if these 4 options are required. We might just have a retrieveParentTags that could be part of the ResponseContent enum ?
179 bool retrievePatientTags_; 168 bool retrievePatientTags_;
180 bool retrieveStudyTags_; 169 bool retrieveStudyTags_;
181 bool retrieveSeriesTags_; 170 bool retrieveSeriesTags_;
182 bool retrieveInstanceTags_; 171 bool retrieveInstanceTags_;
183 172
173 bool retrieveMetadata_;
174 bool retrieveLabels_;
175 bool retrieveAttachments_;
176 bool retrieveParentIdentifier_;
177 bool retrieveChildrenIdentifiers_;
178 bool retrieveChildrenMetadata_;
179
184 bool IsCompatibleLevel(ResourceType levelOfInterest) const; 180 bool IsCompatibleLevel(ResourceType levelOfInterest) const;
185 181
186 public: 182 public:
187 explicit FindRequest(ResourceType level); 183 explicit FindRequest(ResourceType level);
188 184
191 ResourceType GetLevel() const 187 ResourceType GetLevel() const
192 { 188 {
193 return level_; 189 return level_;
194 } 190 }
195 191
196
197 void SetResponseContent(ResponseContent content)
198 {
199 responseContent_ = content;
200 }
201
202 void AddResponseContent(ResponseContent content)
203 {
204 responseContent_ = static_cast<ResponseContent>(static_cast<uint32_t>(responseContent_) | content);
205 }
206
207 ResponseContent GetResponseContent() const
208 {
209 return responseContent_;
210 }
211
212 bool HasResponseContent(ResponseContent content) const
213 {
214 return (responseContent_ & content) == content;
215 }
216
217 bool IsResponseIdentifiersOnly() const
218 {
219 return responseContent_ == ResponseContent_IdentifiersOnly;
220 }
221
222 void SetOrthancPatientId(const std::string& id) 192 void SetOrthancPatientId(const std::string& id)
223 { 193 {
224 orthancIdentifiers_.SetPatientId(id); 194 orthancIdentifiers_.SetPatientId(id);
225 } 195 }
226 196
241 211
242 const OrthancIdentifiers& GetOrthancIdentifiers() const 212 const OrthancIdentifiers& GetOrthancIdentifiers() const
243 { 213 {
244 return orthancIdentifiers_; 214 return orthancIdentifiers_;
245 } 215 }
246
247 216
248 void AddDicomTagConstraint(const DicomTagConstraint& constraint); 217 void AddDicomTagConstraint(const DicomTagConstraint& constraint);
249 218
250 size_t GetDicomTagConstraintsCount() const 219 size_t GetDicomTagConstraintsCount() const
251 { 220 {
269 238
270 uint64_t GetLimitsSince() const; 239 uint64_t GetLimitsSince() const;
271 240
272 uint64_t GetLimitsCount() const; 241 uint64_t GetLimitsCount() const;
273 242
274
275 void SetRetrieveTagsAtLevel(ResourceType levelOfInterest, 243 void SetRetrieveTagsAtLevel(ResourceType levelOfInterest,
276 bool retrieve); 244 bool retrieve);
277 245
278 bool IsRetrieveTagsAtLevel(ResourceType levelOfInterest) const; 246 bool IsRetrieveTagsAtLevel(ResourceType levelOfInterest) const;
279 247
298 266
299 LabelsConstraint GetLabelsConstraint() const 267 LabelsConstraint GetLabelsConstraint() const
300 { 268 {
301 return labelsContraint_; 269 return labelsContraint_;
302 } 270 }
271
272 void SetRetrieveMetadata(bool retrieve)
273 {
274 retrieveMetadata_ = retrieve;
275 }
276
277 bool IsRetrieveMetadata() const
278 {
279 return retrieveMetadata_;
280 }
281
282 void SetRetrieveLabels(bool retrieve)
283 {
284 retrieveLabels_ = retrieve;
285 }
286
287 bool IsRetrieveLabels() const
288 {
289 return retrieveLabels_;
290 }
291
292 void SetRetrieveAttachments(bool retrieve)
293 {
294 retrieveAttachments_ = retrieve;
295 }
296
297 bool IsRetrieveAttachments() const
298 {
299 return retrieveAttachments_;
300 }
301
302 void SetRetrieveParentIdentifier(bool retrieve);
303
304 bool IsRetrieveParentIdentifier() const
305 {
306 return retrieveParentIdentifier_;
307 }
308
309 void SetRetrieveChildrenIdentifiers(bool retrieve);
310
311 bool IsRetrieveChildrenIdentifiers() const
312 {
313 return retrieveChildrenIdentifiers_;
314 }
315
316 void SetRetrieveChildrenMetadata(bool retrieve);
317
318 bool IsRetrieveChildrenMetadata() const
319 {
320 return retrieveChildrenMetadata_;
321 }
303 }; 322 };
304 } 323 }