comparison Framework/Loaders/LoadedDicomResources.h @ 1228:c471a0aa137b broker

adding the next generation of loaders
author Sebastien Jodogne <s.jodogne@gmail.com>
date Mon, 09 Dec 2019 13:58:37 +0100
parents
children a8248b08115c
comparison
equal deleted inserted replaced
1227:a1c0c9c9f9af 1228:c471a0aa137b
1 /**
2 * Stone of Orthanc
3 * Copyright (C) 2012-2016 Sebastien Jodogne, Medical Physics
4 * Department, University Hospital of Liege, Belgium
5 * Copyright (C) 2017-2019 Osimis S.A., Belgium
6 *
7 * This program is free software: you can redistribute it and/or
8 * modify it under the terms of the GNU Affero General Public License
9 * as published by the Free Software Foundation, either version 3 of
10 * the License, or (at your option) any later version.
11 *
12 * This program is distributed in the hope that it will be useful, but
13 * WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 * Affero General Public License for more details.
16 *
17 * You should have received a copy of the GNU Affero General Public License
18 * along with this program. If not, see <http://www.gnu.org/licenses/>.
19 **/
20
21
22 #pragma once
23
24 #include <Core/DicomFormat/DicomMap.h>
25
26
27 namespace OrthancStone
28 {
29 class LoadedDicomResources : public boost::noncopyable
30 {
31 private:
32 typedef std::map<std::string, Orthanc::DicomMap*> Resources;
33
34 Orthanc::DicomTag indexedTag_;
35 Resources resources_;
36 std::vector<Orthanc::DicomMap*> flattened_;
37
38 void Flatten();
39
40 void AddFromDicomWebInternal(const Json::Value& dicomweb);
41
42 public:
43 LoadedDicomResources(const Orthanc::DicomTag& indexedTag) :
44 indexedTag_(indexedTag)
45 {
46 }
47
48 // Re-index another set of resources using another tag
49 LoadedDicomResources(const LoadedDicomResources& other,
50 const Orthanc::DicomTag& indexedTag);
51
52 ~LoadedDicomResources()
53 {
54 Clear();
55 }
56
57 const Orthanc::DicomTag& GetIndexedTag() const
58 {
59 return indexedTag_;
60 }
61
62 void Clear();
63
64 size_t GetSize() const
65 {
66 return resources_.size();
67 }
68
69 Orthanc::DicomMap& GetResource(size_t index);
70
71 bool HasResource(const std::string& id) const
72 {
73 return resources_.find(id) != resources_.end();
74 }
75
76 bool LookupStringValue(std::string& target,
77 const std::string& id,
78 const Orthanc::DicomTag& tag) const;
79
80 void AddResource(const Orthanc::DicomMap& dicom);
81
82 void AddFromOrthanc(const Json::Value& tags);
83
84 void AddFromDicomWeb(const Json::Value& dicomweb);
85
86 bool LookupTagValueConsensus(std::string& target,
87 const Orthanc::DicomTag& tag) const;
88 };
89 }