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