Mercurial > hg > orthanc
annotate OrthancServer/Sources/Database/MainDicomTagsRegistry.cpp @ 5619:1864b16bc7b1 find-refactoring
added FindRequest::ParentRetrieveSpecification
author | Sebastien Jodogne <s.jodogne@gmail.com> |
---|---|
date | Sat, 11 May 2024 12:13:31 +0200 |
parents | 4640b7ae9a11 |
children | 3f13db27b399 |
rev | line source |
---|---|
5614
4640b7ae9a11
moving normalization of constraints into FindRequest
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1 /** |
4640b7ae9a11
moving normalization of constraints into FindRequest
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
2 * Orthanc - A Lightweight, RESTful DICOM Store |
4640b7ae9a11
moving normalization of constraints into FindRequest
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
3 * Copyright (C) 2012-2016 Sebastien Jodogne, Medical Physics |
4640b7ae9a11
moving normalization of constraints into FindRequest
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
4 * Department, University Hospital of Liege, Belgium |
4640b7ae9a11
moving normalization of constraints into FindRequest
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
5 * Copyright (C) 2017-2024 Osimis S.A., Belgium |
4640b7ae9a11
moving normalization of constraints into FindRequest
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
6 * Copyright (C) 2021-2024 Sebastien Jodogne, ICTEAM UCLouvain, Belgium |
4640b7ae9a11
moving normalization of constraints into FindRequest
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
7 * |
4640b7ae9a11
moving normalization of constraints into FindRequest
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
8 * This program is free software: you can redistribute it and/or |
4640b7ae9a11
moving normalization of constraints into FindRequest
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
9 * modify it under the terms of the GNU General Public License as |
4640b7ae9a11
moving normalization of constraints into FindRequest
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
10 * published by the Free Software Foundation, either version 3 of the |
4640b7ae9a11
moving normalization of constraints into FindRequest
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
11 * License, or (at your option) any later version. |
4640b7ae9a11
moving normalization of constraints into FindRequest
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
12 * |
4640b7ae9a11
moving normalization of constraints into FindRequest
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
13 * This program is distributed in the hope that it will be useful, but |
4640b7ae9a11
moving normalization of constraints into FindRequest
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
14 * WITHOUT ANY WARRANTY; without even the implied warranty of |
4640b7ae9a11
moving normalization of constraints into FindRequest
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
4640b7ae9a11
moving normalization of constraints into FindRequest
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
16 * General Public License for more details. |
4640b7ae9a11
moving normalization of constraints into FindRequest
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
17 * |
4640b7ae9a11
moving normalization of constraints into FindRequest
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
18 * You should have received a copy of the GNU General Public License |
4640b7ae9a11
moving normalization of constraints into FindRequest
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
19 * along with this program. If not, see <http://www.gnu.org/licenses/>. |
4640b7ae9a11
moving normalization of constraints into FindRequest
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
20 **/ |
4640b7ae9a11
moving normalization of constraints into FindRequest
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
21 |
4640b7ae9a11
moving normalization of constraints into FindRequest
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
22 |
4640b7ae9a11
moving normalization of constraints into FindRequest
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
23 #include "../PrecompiledHeadersServer.h" |
4640b7ae9a11
moving normalization of constraints into FindRequest
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
24 #include "MainDicomTagsRegistry.h" |
4640b7ae9a11
moving normalization of constraints into FindRequest
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
25 |
4640b7ae9a11
moving normalization of constraints into FindRequest
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
26 #include "../ServerToolbox.h" |
4640b7ae9a11
moving normalization of constraints into FindRequest
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
27 |
4640b7ae9a11
moving normalization of constraints into FindRequest
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
28 namespace Orthanc |
4640b7ae9a11
moving normalization of constraints into FindRequest
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
29 { |
4640b7ae9a11
moving normalization of constraints into FindRequest
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
30 void MainDicomTagsRegistry::LoadTags(ResourceType level) |
4640b7ae9a11
moving normalization of constraints into FindRequest
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
31 { |
4640b7ae9a11
moving normalization of constraints into FindRequest
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
32 { |
4640b7ae9a11
moving normalization of constraints into FindRequest
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
33 const DicomTag* tags = NULL; |
4640b7ae9a11
moving normalization of constraints into FindRequest
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
34 size_t size; |
4640b7ae9a11
moving normalization of constraints into FindRequest
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
35 |
4640b7ae9a11
moving normalization of constraints into FindRequest
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
36 ServerToolbox::LoadIdentifiers(tags, size, level); |
4640b7ae9a11
moving normalization of constraints into FindRequest
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
37 |
4640b7ae9a11
moving normalization of constraints into FindRequest
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
38 for (size_t i = 0; i < size; i++) |
4640b7ae9a11
moving normalization of constraints into FindRequest
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
39 { |
4640b7ae9a11
moving normalization of constraints into FindRequest
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
40 if (registry_.find(tags[i]) == registry_.end()) |
4640b7ae9a11
moving normalization of constraints into FindRequest
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
41 { |
4640b7ae9a11
moving normalization of constraints into FindRequest
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
42 registry_[tags[i]] = TagInfo(level, DicomTagType_Identifier); |
4640b7ae9a11
moving normalization of constraints into FindRequest
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
43 } |
4640b7ae9a11
moving normalization of constraints into FindRequest
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
44 else |
4640b7ae9a11
moving normalization of constraints into FindRequest
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
45 { |
4640b7ae9a11
moving normalization of constraints into FindRequest
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
46 // These patient-level tags are copied in the study level |
4640b7ae9a11
moving normalization of constraints into FindRequest
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
47 assert(level == ResourceType_Study && |
4640b7ae9a11
moving normalization of constraints into FindRequest
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
48 (tags[i] == DICOM_TAG_PATIENT_ID || |
4640b7ae9a11
moving normalization of constraints into FindRequest
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
49 tags[i] == DICOM_TAG_PATIENT_NAME || |
4640b7ae9a11
moving normalization of constraints into FindRequest
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
50 tags[i] == DICOM_TAG_PATIENT_BIRTH_DATE)); |
4640b7ae9a11
moving normalization of constraints into FindRequest
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
51 } |
4640b7ae9a11
moving normalization of constraints into FindRequest
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
52 } |
4640b7ae9a11
moving normalization of constraints into FindRequest
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
53 } |
4640b7ae9a11
moving normalization of constraints into FindRequest
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
54 |
4640b7ae9a11
moving normalization of constraints into FindRequest
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
55 { |
4640b7ae9a11
moving normalization of constraints into FindRequest
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
56 std::set<DicomTag> tags; |
4640b7ae9a11
moving normalization of constraints into FindRequest
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
57 DicomMap::GetMainDicomTags(tags, level); |
4640b7ae9a11
moving normalization of constraints into FindRequest
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
58 |
4640b7ae9a11
moving normalization of constraints into FindRequest
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
59 for (std::set<DicomTag>::const_iterator |
4640b7ae9a11
moving normalization of constraints into FindRequest
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
60 tag = tags.begin(); tag != tags.end(); ++tag) |
4640b7ae9a11
moving normalization of constraints into FindRequest
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
61 { |
4640b7ae9a11
moving normalization of constraints into FindRequest
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
62 if (registry_.find(*tag) == registry_.end()) |
4640b7ae9a11
moving normalization of constraints into FindRequest
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
63 { |
4640b7ae9a11
moving normalization of constraints into FindRequest
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
64 registry_[*tag] = TagInfo(level, DicomTagType_Main); |
4640b7ae9a11
moving normalization of constraints into FindRequest
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
65 } |
4640b7ae9a11
moving normalization of constraints into FindRequest
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
66 } |
4640b7ae9a11
moving normalization of constraints into FindRequest
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
67 } |
4640b7ae9a11
moving normalization of constraints into FindRequest
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
68 } |
4640b7ae9a11
moving normalization of constraints into FindRequest
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
69 |
4640b7ae9a11
moving normalization of constraints into FindRequest
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
70 |
4640b7ae9a11
moving normalization of constraints into FindRequest
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
71 MainDicomTagsRegistry::MainDicomTagsRegistry() |
4640b7ae9a11
moving normalization of constraints into FindRequest
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
72 { |
4640b7ae9a11
moving normalization of constraints into FindRequest
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
73 LoadTags(ResourceType_Patient); |
4640b7ae9a11
moving normalization of constraints into FindRequest
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
74 LoadTags(ResourceType_Study); |
4640b7ae9a11
moving normalization of constraints into FindRequest
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
75 LoadTags(ResourceType_Series); |
4640b7ae9a11
moving normalization of constraints into FindRequest
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
76 LoadTags(ResourceType_Instance); |
4640b7ae9a11
moving normalization of constraints into FindRequest
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
77 } |
4640b7ae9a11
moving normalization of constraints into FindRequest
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
78 |
4640b7ae9a11
moving normalization of constraints into FindRequest
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
79 |
4640b7ae9a11
moving normalization of constraints into FindRequest
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
80 void MainDicomTagsRegistry::LookupTag(ResourceType& level, |
4640b7ae9a11
moving normalization of constraints into FindRequest
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
81 DicomTagType& type, |
4640b7ae9a11
moving normalization of constraints into FindRequest
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
82 const DicomTag& tag) const |
4640b7ae9a11
moving normalization of constraints into FindRequest
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
83 { |
4640b7ae9a11
moving normalization of constraints into FindRequest
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
84 Registry::const_iterator it = registry_.find(tag); |
4640b7ae9a11
moving normalization of constraints into FindRequest
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
85 |
4640b7ae9a11
moving normalization of constraints into FindRequest
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
86 if (it == registry_.end()) |
4640b7ae9a11
moving normalization of constraints into FindRequest
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
87 { |
4640b7ae9a11
moving normalization of constraints into FindRequest
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
88 // Default values |
4640b7ae9a11
moving normalization of constraints into FindRequest
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
89 level = ResourceType_Instance; |
4640b7ae9a11
moving normalization of constraints into FindRequest
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
90 type = DicomTagType_Generic; |
4640b7ae9a11
moving normalization of constraints into FindRequest
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
91 } |
4640b7ae9a11
moving normalization of constraints into FindRequest
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
92 else |
4640b7ae9a11
moving normalization of constraints into FindRequest
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
93 { |
4640b7ae9a11
moving normalization of constraints into FindRequest
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
94 level = it->second.GetLevel(); |
4640b7ae9a11
moving normalization of constraints into FindRequest
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
95 type = it->second.GetType(); |
4640b7ae9a11
moving normalization of constraints into FindRequest
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
96 } |
4640b7ae9a11
moving normalization of constraints into FindRequest
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
97 } |
4640b7ae9a11
moving normalization of constraints into FindRequest
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
98 } |