annotate OrthancServer/Sources/Search/DatabaseLookup.h @ 4834:bec432ee1094

download of numpy arrays from the REST API
author Sebastien Jodogne <s.jodogne@gmail.com>
date Fri, 26 Nov 2021 19:03:32 +0100
parents 7053502fbf97
children 2e71a08eea15 43e613a7756b
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
2892
ce310baccda6 DicomTagConstraint and DatabaseLookup
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1 /**
ce310baccda6 DicomTagConstraint and DatabaseLookup
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2 * Orthanc - A Lightweight, RESTful DICOM Store
ce310baccda6 DicomTagConstraint and DatabaseLookup
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3 * Copyright (C) 2012-2016 Sebastien Jodogne, Medical Physics
ce310baccda6 DicomTagConstraint and DatabaseLookup
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4 * Department, University Hospital of Liege, Belgium
4437
d9473bd5ed43 upgrade to year 2021
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4196
diff changeset
5 * Copyright (C) 2017-2021 Osimis S.A., Belgium
4831
7053502fbf97 added copyright UCLouvain
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4437
diff changeset
6 * Copyright (C) 2021-2021 Sebastien Jodogne, ICTEAM UCLouvain, Belgium
2892
ce310baccda6 DicomTagConstraint and DatabaseLookup
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7 *
ce310baccda6 DicomTagConstraint and DatabaseLookup
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8 * This program is free software: you can redistribute it and/or
ce310baccda6 DicomTagConstraint and DatabaseLookup
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
9 * modify it under the terms of the GNU General Public License as
ce310baccda6 DicomTagConstraint and DatabaseLookup
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
10 * published by the Free Software Foundation, either version 3 of the
ce310baccda6 DicomTagConstraint and DatabaseLookup
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
11 * License, or (at your option) any later version.
ce310baccda6 DicomTagConstraint and DatabaseLookup
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
12 *
ce310baccda6 DicomTagConstraint and DatabaseLookup
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
13 * In addition, as a special exception, the copyright holders of this
ce310baccda6 DicomTagConstraint and DatabaseLookup
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
14 * program give permission to link the code of its release with the
ce310baccda6 DicomTagConstraint and DatabaseLookup
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
15 * OpenSSL project's "OpenSSL" library (or with modified versions of it
ce310baccda6 DicomTagConstraint and DatabaseLookup
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
16 * that use the same license as the "OpenSSL" library), and distribute
ce310baccda6 DicomTagConstraint and DatabaseLookup
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
17 * the linked executables. You must obey the GNU General Public License
ce310baccda6 DicomTagConstraint and DatabaseLookup
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
18 * in all respects for all of the code used other than "OpenSSL". If you
ce310baccda6 DicomTagConstraint and DatabaseLookup
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
19 * modify file(s) with this exception, you may extend this exception to
ce310baccda6 DicomTagConstraint and DatabaseLookup
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
20 * your version of the file(s), but you are not obligated to do so. If
ce310baccda6 DicomTagConstraint and DatabaseLookup
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
21 * you do not wish to do so, delete this exception statement from your
ce310baccda6 DicomTagConstraint and DatabaseLookup
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
22 * version. If you delete this exception statement from all source files
ce310baccda6 DicomTagConstraint and DatabaseLookup
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
23 * in the program, then also delete it here.
ce310baccda6 DicomTagConstraint and DatabaseLookup
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
24 *
ce310baccda6 DicomTagConstraint and DatabaseLookup
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
25 * This program is distributed in the hope that it will be useful, but
ce310baccda6 DicomTagConstraint and DatabaseLookup
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
26 * WITHOUT ANY WARRANTY; without even the implied warranty of
ce310baccda6 DicomTagConstraint and DatabaseLookup
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
27 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
ce310baccda6 DicomTagConstraint and DatabaseLookup
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
28 * General Public License for more details.
ce310baccda6 DicomTagConstraint and DatabaseLookup
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
29 *
ce310baccda6 DicomTagConstraint and DatabaseLookup
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
30 * You should have received a copy of the GNU General Public License
ce310baccda6 DicomTagConstraint and DatabaseLookup
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
31 * along with this program. If not, see <http://www.gnu.org/licenses/>.
ce310baccda6 DicomTagConstraint and DatabaseLookup
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
32 **/
ce310baccda6 DicomTagConstraint and DatabaseLookup
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
33
ce310baccda6 DicomTagConstraint and DatabaseLookup
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
34
ce310baccda6 DicomTagConstraint and DatabaseLookup
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
35 #pragma once
ce310baccda6 DicomTagConstraint and DatabaseLookup
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
36
ce310baccda6 DicomTagConstraint and DatabaseLookup
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
37 #include "DicomTagConstraint.h"
ce310baccda6 DicomTagConstraint and DatabaseLookup
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
38
3071
2df061cf2fec getting rid of IFindConstraint hierarchy
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3061
diff changeset
39 class DcmItem;
2df061cf2fec getting rid of IFindConstraint hierarchy
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3061
diff changeset
40
2892
ce310baccda6 DicomTagConstraint and DatabaseLookup
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
41 namespace Orthanc
ce310baccda6 DicomTagConstraint and DatabaseLookup
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
42 {
ce310baccda6 DicomTagConstraint and DatabaseLookup
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
43 class DatabaseLookup : public boost::noncopyable
ce310baccda6 DicomTagConstraint and DatabaseLookup
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
44 {
ce310baccda6 DicomTagConstraint and DatabaseLookup
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
45 private:
ce310baccda6 DicomTagConstraint and DatabaseLookup
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
46 std::vector<DicomTagConstraint*> constraints_;
ce310baccda6 DicomTagConstraint and DatabaseLookup
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
47
3027
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3025
diff changeset
48 void AddDicomConstraintInternal(const DicomTag& tag,
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3025
diff changeset
49 ValueRepresentation vr,
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3025
diff changeset
50 const std::string& dicomQuery,
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3025
diff changeset
51 bool caseSensitive,
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3025
diff changeset
52 bool mandatoryTag);
3163
cf91b6f22278 Fix issue #90 (C-Find shall match missing tags to null/empty string)
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3071
diff changeset
53
4196
37310bb1cd30 Fix handling of "ModalitiesInStudy" (0008,0061) in C-FIND and "/tools/find"
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4044
diff changeset
54 void AddConstraintInternal(DicomTagConstraint* constraint); // Takes ownership
3163
cf91b6f22278 Fix issue #90 (C-Find shall match missing tags to null/empty string)
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3071
diff changeset
55
2892
ce310baccda6 DicomTagConstraint and DatabaseLookup
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
56 public:
3025
039a9d262d64 preparing to speed up find in databases
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2892
diff changeset
57 DatabaseLookup()
039a9d262d64 preparing to speed up find in databases
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2892
diff changeset
58 {
039a9d262d64 preparing to speed up find in databases
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2892
diff changeset
59 }
2892
ce310baccda6 DicomTagConstraint and DatabaseLookup
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
60
ce310baccda6 DicomTagConstraint and DatabaseLookup
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
61 ~DatabaseLookup();
ce310baccda6 DicomTagConstraint and DatabaseLookup
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
62
ce310baccda6 DicomTagConstraint and DatabaseLookup
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
63 void Reserve(size_t n)
ce310baccda6 DicomTagConstraint and DatabaseLookup
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
64 {
ce310baccda6 DicomTagConstraint and DatabaseLookup
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
65 constraints_.reserve(n);
ce310baccda6 DicomTagConstraint and DatabaseLookup
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
66 }
ce310baccda6 DicomTagConstraint and DatabaseLookup
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
67
ce310baccda6 DicomTagConstraint and DatabaseLookup
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
68 size_t GetConstraintsCount() const
ce310baccda6 DicomTagConstraint and DatabaseLookup
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
69 {
ce310baccda6 DicomTagConstraint and DatabaseLookup
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
70 return constraints_.size();
ce310baccda6 DicomTagConstraint and DatabaseLookup
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
71 }
ce310baccda6 DicomTagConstraint and DatabaseLookup
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
72
ce310baccda6 DicomTagConstraint and DatabaseLookup
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
73 const DicomTagConstraint& GetConstraint(size_t index) const;
ce310baccda6 DicomTagConstraint and DatabaseLookup
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
74
3033
5da6d1063d8f effectively replacing LookupResource by DatabaseLookup in searches
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3027
diff changeset
75 bool IsMatch(const DicomMap& value) const;
2892
ce310baccda6 DicomTagConstraint and DatabaseLookup
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
76
3071
2df061cf2fec getting rid of IFindConstraint hierarchy
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3061
diff changeset
77 bool IsMatch(DcmItem& item,
3217
cf8cbeb35f33 preliminary support of Korean character set
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3163
diff changeset
78 Encoding encoding,
cf8cbeb35f33 preliminary support of Korean character set
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3163
diff changeset
79 bool hasCodeExtensions) const;
3071
2df061cf2fec getting rid of IFindConstraint hierarchy
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3061
diff changeset
80
2892
ce310baccda6 DicomTagConstraint and DatabaseLookup
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
81 void AddDicomConstraint(const DicomTag& tag,
ce310baccda6 DicomTagConstraint and DatabaseLookup
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
82 const std::string& dicomQuery,
3025
039a9d262d64 preparing to speed up find in databases
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2892
diff changeset
83 bool caseSensitivePN,
039a9d262d64 preparing to speed up find in databases
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2892
diff changeset
84 bool mandatoryTag);
3027
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3025
diff changeset
85
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3025
diff changeset
86 void AddRestConstraint(const DicomTag& tag,
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3025
diff changeset
87 const std::string& dicomQuery,
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3025
diff changeset
88 bool caseSensitive,
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3025
diff changeset
89 bool mandatoryTag);
3033
5da6d1063d8f effectively replacing LookupResource by DatabaseLookup in searches
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3027
diff changeset
90
4196
37310bb1cd30 Fix handling of "ModalitiesInStudy" (0008,0061) in C-FIND and "/tools/find"
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4044
diff changeset
91 void AddConstraint(const DicomTagConstraint& constraint)
37310bb1cd30 Fix handling of "ModalitiesInStudy" (0008,0061) in C-FIND and "/tools/find"
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4044
diff changeset
92 {
37310bb1cd30 Fix handling of "ModalitiesInStudy" (0008,0061) in C-FIND and "/tools/find"
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4044
diff changeset
93 AddConstraintInternal(new DicomTagConstraint(constraint));
37310bb1cd30 Fix handling of "ModalitiesInStudy" (0008,0061) in C-FIND and "/tools/find"
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4044
diff changeset
94 }
37310bb1cd30 Fix handling of "ModalitiesInStudy" (0008,0061) in C-FIND and "/tools/find"
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4044
diff changeset
95
3033
5da6d1063d8f effectively replacing LookupResource by DatabaseLookup in searches
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3027
diff changeset
96 bool HasOnlyMainDicomTags() const;
4196
37310bb1cd30 Fix handling of "ModalitiesInStudy" (0008,0061) in C-FIND and "/tools/find"
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4044
diff changeset
97
37310bb1cd30 Fix handling of "ModalitiesInStudy" (0008,0061) in C-FIND and "/tools/find"
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4044
diff changeset
98 std::string Format() const;
37310bb1cd30 Fix handling of "ModalitiesInStudy" (0008,0061) in C-FIND and "/tools/find"
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4044
diff changeset
99
37310bb1cd30 Fix handling of "ModalitiesInStudy" (0008,0061) in C-FIND and "/tools/find"
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4044
diff changeset
100 bool HasTag(const DicomTag& tag) const;
2892
ce310baccda6 DicomTagConstraint and DatabaseLookup
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
101 };
ce310baccda6 DicomTagConstraint and DatabaseLookup
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
102 }