comparison OrthancServer/FromDcmtkBridge.h @ 790:331eaf9d9d69

ParsedDicomFile
author Sebastien Jodogne <s.jodogne@gmail.com>
date Mon, 05 May 2014 18:55:10 +0200
parents 55dae8c5a6ab
children 381f90e2b69d
comparison
equal deleted inserted replaced
789:55dae8c5a6ab 790:331eaf9d9d69
108 static std::string GenerateUniqueIdentifier(ResourceType level); 108 static std::string GenerateUniqueIdentifier(ResourceType level);
109 109
110 static bool SaveToMemoryBuffer(std::string& buffer, 110 static bool SaveToMemoryBuffer(std::string& buffer,
111 DcmDataset* dataSet); 111 DcmDataset* dataSet);
112 }; 112 };
113
114 class ParsedDicomFile : public IDynamicObject
115 {
116 private:
117 std::auto_ptr<DcmFileFormat> file_;
118
119 ParsedDicomFile(DcmFileFormat& other) :
120 file_(dynamic_cast<DcmFileFormat*>(other.clone()))
121 {
122 }
123
124 void Setup(const char* content,
125 size_t size);
126
127 public:
128 ParsedDicomFile(); // Create a minimal DICOM instance
129
130 ParsedDicomFile(const char* content,
131 size_t size)
132 {
133 Setup(content, size);
134 }
135
136 ParsedDicomFile(const std::string& content)
137 {
138 if (content.size() == 0)
139 Setup(NULL, 0);
140 else
141 Setup(&content[0], content.size());
142 }
143
144 DcmFileFormat& GetDicom()
145 {
146 return *file_;
147 }
148
149 ParsedDicomFile* Clone()
150 {
151 return new ParsedDicomFile(*file_);
152 }
153
154 void SendPathValue(RestApiOutput& output,
155 const UriComponents& uri);
156
157 void Answer(RestApiOutput& output);
158
159 void Remove(const DicomTag& tag);
160
161 void Insert(const DicomTag& tag,
162 const std::string& value);
163
164 void Replace(const DicomTag& tag,
165 const std::string& value,
166 DicomReplaceMode mode = DicomReplaceMode_InsertIfAbsent);
167
168 void RemovePrivateTags();
169
170 bool GetTagValue(std::string& value,
171 const DicomTag& tag);
172
173 DicomInstanceHasher GetHasher();
174
175 void SaveToMemoryBuffer(std::string& buffer)
176 {
177 FromDcmtkBridge::SaveToMemoryBuffer(buffer, file_->getDataset());
178 }
179
180 void SaveToFile(const std::string& path);
181 };
182
183 } 113 }