Mercurial > hg > orthanc
comparison OrthancServer/Sources/ServerJobs/SplitStudyJob.cpp @ 4717:783f8a048035 openssl-3.x
integration mainline->openssl-3.x
author | Sebastien Jodogne <s.jodogne@gmail.com> |
---|---|
date | Wed, 23 Jun 2021 16:23:23 +0200 |
parents | f0038043fb97 bad8935cd5f2 |
children | 70d2a97ca8cb |
comparison
equal
deleted
inserted
replaced
4711:816a9ecc6ea1 | 4717:783f8a048035 |
---|---|
178 { | 178 { |
179 SetOrigin(DicomInstanceOrigin::FromRest(call)); | 179 SetOrigin(DicomInstanceOrigin::FromRest(call)); |
180 } | 180 } |
181 | 181 |
182 | 182 |
183 static void RegisterSeries(std::map<std::string, std::string>& target, | |
184 const std::string& series) | |
185 { | |
186 // Generate a target SeriesInstanceUID for this series | |
187 if (target.find(series) == target.end()) | |
188 { | |
189 target[series] = FromDcmtkBridge::GenerateUniqueIdentifier(ResourceType_Series); | |
190 } | |
191 } | |
192 | |
193 | |
183 void SplitStudyJob::AddSourceSeries(const std::string& series) | 194 void SplitStudyJob::AddSourceSeries(const std::string& series) |
184 { | 195 { |
185 std::string parent; | 196 std::string parent; |
186 | 197 |
187 if (IsStarted()) | 198 if (IsStarted()) |
194 throw OrthancException(ErrorCode_UnknownResource, | 205 throw OrthancException(ErrorCode_UnknownResource, |
195 "This series does not belong to the study to be split: " + series); | 206 "This series does not belong to the study to be split: " + series); |
196 } | 207 } |
197 else | 208 else |
198 { | 209 { |
199 // Generate a target SeriesInstanceUID for this series | 210 RegisterSeries(seriesUidMap_, series); |
200 seriesUidMap_[series] = FromDcmtkBridge::GenerateUniqueIdentifier(ResourceType_Series); | |
201 | 211 |
202 // Add all the instances of the series as to be processed | 212 // Add all the instances of the series as to be processed |
203 std::list<std::string> instances; | 213 std::list<std::string> instances; |
204 GetContext().GetIndex().GetChildren(instances, series); | 214 GetContext().GetIndex().GetChildren(instances, series); |
205 | 215 |
206 for (std::list<std::string>::const_iterator | 216 for (std::list<std::string>::const_iterator |
207 it = instances.begin(); it != instances.end(); ++it) | 217 it = instances.begin(); it != instances.end(); ++it) |
208 { | 218 { |
209 AddInstance(*it); | 219 AddInstance(*it); |
210 } | 220 } |
221 } | |
222 } | |
223 | |
224 | |
225 void SplitStudyJob::AddSourceInstance(const std::string& instance) | |
226 { | |
227 std::string study, series; | |
228 | |
229 if (IsStarted()) | |
230 { | |
231 throw OrthancException(ErrorCode_BadSequenceOfCalls); | |
232 } | |
233 else if (!GetContext().GetIndex().LookupParent(series, instance, ResourceType_Series) || | |
234 !GetContext().GetIndex().LookupParent(study, series, ResourceType_Study) || | |
235 study != sourceStudy_) | |
236 { | |
237 throw OrthancException(ErrorCode_UnknownResource, | |
238 "This instance does not belong to the study to be split: " + instance); | |
239 } | |
240 else | |
241 { | |
242 RegisterSeries(seriesUidMap_, series); | |
243 AddInstance(instance); | |
211 } | 244 } |
212 } | 245 } |
213 | 246 |
214 | 247 |
215 bool SplitStudyJob::LookupTargetSeriesUid(std::string& uid, | 248 bool SplitStudyJob::LookupTargetSeriesUid(std::string& uid, |