Mercurial > hg > orthanc
annotate OrthancServer/Sources/ResourceFinder.h @ 5621:732ec9feeea8 find-refactoring
introduction of FindRequest::ChildrenRetrieveSpecification
author | Sebastien Jodogne <s.jodogne@gmail.com> |
---|---|
date | Sat, 11 May 2024 15:43:07 +0200 |
parents | 8905ffa45fc2 |
children | 3f13db27b399 |
rev | line source |
---|---|
5608 | 1 /** |
2 * Orthanc - A Lightweight, RESTful DICOM Store | |
3 * Copyright (C) 2012-2016 Sebastien Jodogne, Medical Physics | |
4 * Department, University Hospital of Liege, Belgium | |
5 * Copyright (C) 2017-2024 Osimis S.A., Belgium | |
6 * Copyright (C) 2021-2024 Sebastien Jodogne, ICTEAM UCLouvain, Belgium | |
7 * | |
8 * This program is free software: you can redistribute it and/or | |
9 * modify it under the terms of the GNU General Public License as | |
10 * published by the Free Software Foundation, either version 3 of the | |
11 * License, or (at your option) any later version. | |
12 * | |
13 * This program is distributed in the hope that it will be useful, but | |
14 * WITHOUT ANY WARRANTY; without even the implied warranty of | |
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |
16 * General Public License for more details. | |
17 * | |
18 * You should have received a copy of the GNU General Public License | |
19 * along with this program. If not, see <http://www.gnu.org/licenses/>. | |
20 **/ | |
21 | |
22 | |
23 #pragma once | |
24 | |
25 #include "Database/FindRequest.h" | |
26 #include "Database/FindResponse.h" | |
27 | |
28 namespace Orthanc | |
29 { | |
30 class ServerContext; | |
31 class ServerIndex; | |
32 | |
33 class ResourceFinder : public boost::noncopyable | |
34 { | |
35 private: | |
36 FindRequest request_; | |
37 bool expand_; | |
38 DicomToJsonFormat format_; | |
5617
8905ffa45fc2
started listing of children resources
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5615
diff
changeset
|
39 bool allowStorageAccess_; |
5609
4690a0d2b01e
preliminary support of requestedTags
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5608
diff
changeset
|
40 bool hasRequestedTags_; |
4690a0d2b01e
preliminary support of requestedTags
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5608
diff
changeset
|
41 std::set<DicomTag> requestedPatientTags_; |
4690a0d2b01e
preliminary support of requestedTags
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5608
diff
changeset
|
42 std::set<DicomTag> requestedStudyTags_; |
4690a0d2b01e
preliminary support of requestedTags
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5608
diff
changeset
|
43 std::set<DicomTag> requestedSeriesTags_; |
4690a0d2b01e
preliminary support of requestedTags
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5608
diff
changeset
|
44 std::set<DicomTag> requestedInstanceTags_; |
4690a0d2b01e
preliminary support of requestedTags
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5608
diff
changeset
|
45 std::set<DicomTag> requestedTagsFromFileStorage_; |
5608 | 46 bool includeAllMetadata_; // Same as: ExpandResourceFlags_IncludeAllMetadata |
47 | |
48 SeriesStatus GetSeriesStatus(uint32_t& expectedNumberOfInstances, | |
49 const FindResponse::Resource& resource) const; | |
50 | |
51 void Expand(Json::Value& target, | |
52 const FindResponse::Resource& resource, | |
53 ServerIndex& index) const; | |
54 | |
55 public: | |
56 ResourceFinder(ResourceType level, | |
57 bool expand); | |
58 | |
5617
8905ffa45fc2
started listing of children resources
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5615
diff
changeset
|
59 bool IsAllowStorageAccess() const |
8905ffa45fc2
started listing of children resources
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5615
diff
changeset
|
60 { |
8905ffa45fc2
started listing of children resources
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5615
diff
changeset
|
61 return allowStorageAccess_; |
8905ffa45fc2
started listing of children resources
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5615
diff
changeset
|
62 } |
8905ffa45fc2
started listing of children resources
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5615
diff
changeset
|
63 |
8905ffa45fc2
started listing of children resources
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5615
diff
changeset
|
64 void SetAllowStorageAccess(bool allow) |
8905ffa45fc2
started listing of children resources
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5615
diff
changeset
|
65 { |
8905ffa45fc2
started listing of children resources
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5615
diff
changeset
|
66 allowStorageAccess_ = allow; |
8905ffa45fc2
started listing of children resources
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5615
diff
changeset
|
67 } |
8905ffa45fc2
started listing of children resources
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5615
diff
changeset
|
68 |
5615
a10978a5e65c
expansion of single resources using ResourceFinder
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5609
diff
changeset
|
69 void SetOrthancId(ResourceType level, |
a10978a5e65c
expansion of single resources using ResourceFinder
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5609
diff
changeset
|
70 const std::string& id) |
a10978a5e65c
expansion of single resources using ResourceFinder
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5609
diff
changeset
|
71 { |
a10978a5e65c
expansion of single resources using ResourceFinder
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5609
diff
changeset
|
72 request_.SetOrthancId(level, id); |
a10978a5e65c
expansion of single resources using ResourceFinder
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5609
diff
changeset
|
73 } |
a10978a5e65c
expansion of single resources using ResourceFinder
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5609
diff
changeset
|
74 |
5608 | 75 void SetFormat(DicomToJsonFormat format) |
76 { | |
77 format_ = format; | |
78 } | |
79 | |
80 void SetLimits(uint64_t since, | |
81 uint64_t count) | |
82 { | |
83 request_.SetLimits(since, count); | |
84 } | |
85 | |
86 void SetIncludeAllMetadata(bool include) | |
87 { | |
88 includeAllMetadata_ = include; | |
89 } | |
90 | |
5609
4690a0d2b01e
preliminary support of requestedTags
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5608
diff
changeset
|
91 void AddRequestedTags(const DicomTag& tag); |
4690a0d2b01e
preliminary support of requestedTags
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5608
diff
changeset
|
92 |
4690a0d2b01e
preliminary support of requestedTags
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5608
diff
changeset
|
93 void AddRequestedTags(const std::set<DicomTag>& tags); |
4690a0d2b01e
preliminary support of requestedTags
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5608
diff
changeset
|
94 |
5608 | 95 void Execute(Json::Value& target, |
5621
732ec9feeea8
introduction of FindRequest::ChildrenRetrieveSpecification
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5617
diff
changeset
|
96 ServerContext& context) const; |
5615
a10978a5e65c
expansion of single resources using ResourceFinder
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5609
diff
changeset
|
97 |
a10978a5e65c
expansion of single resources using ResourceFinder
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5609
diff
changeset
|
98 bool ExecuteOneResource(Json::Value& target, |
5621
732ec9feeea8
introduction of FindRequest::ChildrenRetrieveSpecification
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5617
diff
changeset
|
99 ServerContext& context) const; |
5608 | 100 }; |
101 } |