Mercurial > hg > orthanc
annotate OrthancServer/Sources/ResourceFinder.h @ 5641:3f13db27b399 find-refactoring
integration mainline->find-refactoring
author | Sebastien Jodogne <s.jodogne@gmail.com> |
---|---|
date | Thu, 30 May 2024 21:27:48 +0200 |
parents | 732ec9feeea8 |
children | d8c86698110c |
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_; |
5608 | 47 bool includeAllMetadata_; // Same as: ExpandResourceFlags_IncludeAllMetadata |
48 | |
49 SeriesStatus GetSeriesStatus(uint32_t& expectedNumberOfInstances, | |
50 const FindResponse::Resource& resource) const; | |
51 | |
52 void Expand(Json::Value& target, | |
53 const FindResponse::Resource& resource, | |
54 ServerIndex& index) const; | |
55 | |
56 public: | |
57 ResourceFinder(ResourceType level, | |
58 bool expand); | |
59 | |
5617
8905ffa45fc2
started listing of children resources
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5615
diff
changeset
|
60 bool IsAllowStorageAccess() const |
8905ffa45fc2
started listing of children resources
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5615
diff
changeset
|
61 { |
8905ffa45fc2
started listing of children resources
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5615
diff
changeset
|
62 return allowStorageAccess_; |
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 |
8905ffa45fc2
started listing of children resources
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5615
diff
changeset
|
65 void SetAllowStorageAccess(bool allow) |
8905ffa45fc2
started listing of children resources
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5615
diff
changeset
|
66 { |
8905ffa45fc2
started listing of children resources
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5615
diff
changeset
|
67 allowStorageAccess_ = allow; |
8905ffa45fc2
started listing of children resources
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5615
diff
changeset
|
68 } |
8905ffa45fc2
started listing of children resources
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5615
diff
changeset
|
69 |
5615
a10978a5e65c
expansion of single resources using ResourceFinder
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5609
diff
changeset
|
70 void SetOrthancId(ResourceType level, |
a10978a5e65c
expansion of single resources using ResourceFinder
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5609
diff
changeset
|
71 const std::string& id) |
a10978a5e65c
expansion of single resources using ResourceFinder
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5609
diff
changeset
|
72 { |
a10978a5e65c
expansion of single resources using ResourceFinder
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5609
diff
changeset
|
73 request_.SetOrthancId(level, id); |
a10978a5e65c
expansion of single resources using ResourceFinder
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5609
diff
changeset
|
74 } |
a10978a5e65c
expansion of single resources using ResourceFinder
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5609
diff
changeset
|
75 |
5608 | 76 void SetFormat(DicomToJsonFormat format) |
77 { | |
78 format_ = format; | |
79 } | |
80 | |
81 void SetLimits(uint64_t since, | |
82 uint64_t count) | |
83 { | |
84 request_.SetLimits(since, count); | |
85 } | |
86 | |
87 void SetIncludeAllMetadata(bool include) | |
88 { | |
89 includeAllMetadata_ = include; | |
90 } | |
91 | |
5609
4690a0d2b01e
preliminary support of requestedTags
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5608
diff
changeset
|
92 void AddRequestedTags(const DicomTag& tag); |
4690a0d2b01e
preliminary support of requestedTags
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5608
diff
changeset
|
93 |
4690a0d2b01e
preliminary support of requestedTags
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5608
diff
changeset
|
94 void AddRequestedTags(const std::set<DicomTag>& tags); |
4690a0d2b01e
preliminary support of requestedTags
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5608
diff
changeset
|
95 |
5608 | 96 void Execute(Json::Value& target, |
5621
732ec9feeea8
introduction of FindRequest::ChildrenRetrieveSpecification
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5617
diff
changeset
|
97 ServerContext& context) const; |
5615
a10978a5e65c
expansion of single resources using ResourceFinder
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5609
diff
changeset
|
98 |
a10978a5e65c
expansion of single resources using ResourceFinder
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5609
diff
changeset
|
99 bool ExecuteOneResource(Json::Value& target, |
5621
732ec9feeea8
introduction of FindRequest::ChildrenRetrieveSpecification
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5617
diff
changeset
|
100 ServerContext& context) const; |
5608 | 101 }; |
102 } |