comparison OrthancStone/Sources/Loaders/LoadedDicomResources.h @ 1822:0489fe25ce48

support of pixel spacing in ultrasound images from tag SequenceOfUltrasoundRegions
author Sebastien Jodogne <s.jodogne@gmail.com>
date Wed, 26 May 2021 18:13:35 +0200
parents 9ac2a65d4172
children d6b83b4cedcd
comparison
equal deleted inserted replaced
1821:36430d73e36c 1822:0489fe25ce48
32 user-specified DicomTag. 32 user-specified DicomTag.
33 */ 33 */
34 class LoadedDicomResources : public boost::noncopyable 34 class LoadedDicomResources : public boost::noncopyable
35 { 35 {
36 private: 36 private:
37 typedef std::map<std::string, Orthanc::DicomMap*> Resources; 37 class Resource : public boost::noncopyable
38 {
39 private:
40 std::unique_ptr<Orthanc::DicomMap> dicom_;
41 std::unique_ptr<Json::Value> sourceJson_;
38 42
39 Orthanc::DicomTag indexedTag_; 43 public:
40 Resources resources_; 44 Resource(const Orthanc::DicomMap& dicom);
41 std::vector<Orthanc::DicomMap*> flattened_;
42 45
43 void Flatten(); 46 Resource* Clone() const;
47
48 const Orthanc::DicomMap& GetDicom() const
49 {
50 return *dicom_;
51 }
52
53 bool HasSourceJson() const
54 {
55 return sourceJson_.get() != NULL;
56 }
57
58 const Json::Value& GetSourceJson() const;
59
60 void SetSourceJson(const Json::Value& json);
61 };
62
63 typedef std::map<std::string, Resource*> Resources;
64
65 Orthanc::DicomTag indexedTag_;
66 Resources resources_;
67 std::vector<Resource*> flattened_;
68
69 void AddResourceInternal(Resource* resource);
70
71 const Resource& GetResourceInternal(size_t index);
44 72
45 void AddFromDicomWebInternal(const Json::Value& dicomweb); 73 void AddFromDicomWebInternal(const Json::Value& dicomweb);
46 74
47 public: 75 public:
48 explicit LoadedDicomResources(const Orthanc::DicomTag& indexedTag) : 76 explicit LoadedDicomResources(const Orthanc::DicomTag& indexedTag) :
69 size_t GetSize() const 97 size_t GetSize() const
70 { 98 {
71 return resources_.size(); 99 return resources_.size();
72 } 100 }
73 101
74 Orthanc::DicomMap& GetResource(size_t index); 102 const Orthanc::DicomMap& GetResource(size_t index)
103 {
104 return GetResourceInternal(index).GetDicom();
105 }
75 106
76 bool HasResource(const std::string& id) const 107 bool HasResource(const std::string& id) const
77 { 108 {
78 return resources_.find(id) != resources_.end(); 109 return resources_.find(id) != resources_.end();
79 } 110 }
91 122
92 void AddFromDicomWeb(const Json::Value& dicomweb); 123 void AddFromDicomWeb(const Json::Value& dicomweb);
93 124
94 bool LookupTagValueConsensus(std::string& target, 125 bool LookupTagValueConsensus(std::string& target,
95 const Orthanc::DicomTag& tag) const; 126 const Orthanc::DicomTag& tag) const;
127
128 bool HasSourceJson(size_t index)
129 {
130 return GetResourceInternal(index).HasSourceJson();
131 }
132
133 const Json::Value& GetSourceJson(size_t index)
134 {
135 return GetResourceInternal(index).GetSourceJson();
136 }
96 }; 137 };
97 } 138 }