Mercurial > hg > orthanc
comparison Core/DicomParsing/DicomModification.cpp @ 2535:d3476d90dcb7
DicomModification::SetDicomIdentifierGenerator()
author | Sebastien Jodogne <s.jodogne@gmail.com> |
---|---|
date | Tue, 17 Apr 2018 13:03:34 +0200 |
parents | 6db878376018 |
children | 2f3007bf0708 |
comparison
equal
deleted
inserted
replaced
2534:373d75b90d3b | 2535:d3476d90dcb7 |
---|---|
245 | 245 |
246 UidMap::const_iterator previous = uidMap_.find(std::make_pair(level, original)); | 246 UidMap::const_iterator previous = uidMap_.find(std::make_pair(level, original)); |
247 | 247 |
248 if (previous == uidMap_.end()) | 248 if (previous == uidMap_.end()) |
249 { | 249 { |
250 mapped = FromDcmtkBridge::GenerateUniqueIdentifier(level); | 250 if (identifierGenerator_ == NULL) |
251 { | |
252 mapped = FromDcmtkBridge::GenerateUniqueIdentifier(level); | |
253 } | |
254 else | |
255 { | |
256 if (!identifierGenerator_->Apply(mapped, original, level, currentSource_)) | |
257 { | |
258 LOG(ERROR) << "Unable to generate an anonymized ID"; | |
259 throw Orthanc::OrthancException(Orthanc::ErrorCode_InternalError); | |
260 } | |
261 } | |
262 | |
251 uidMap_.insert(std::make_pair(std::make_pair(level, original), mapped)); | 263 uidMap_.insert(std::make_pair(std::make_pair(level, original), mapped)); |
252 } | 264 } |
253 else | 265 else |
254 { | 266 { |
255 mapped = previous->second; | 267 mapped = previous->second; |
300 removePrivateTags_(false), | 312 removePrivateTags_(false), |
301 level_(ResourceType_Instance), | 313 level_(ResourceType_Instance), |
302 allowManualIdentifiers_(true), | 314 allowManualIdentifiers_(true), |
303 keepStudyInstanceUid_(false), | 315 keepStudyInstanceUid_(false), |
304 keepSeriesInstanceUid_(false), | 316 keepSeriesInstanceUid_(false), |
305 updateReferencedRelationships_(true) | 317 updateReferencedRelationships_(true), |
318 identifierGenerator_(NULL) | |
306 { | 319 { |
307 } | 320 } |
308 | 321 |
309 DicomModification::~DicomModification() | 322 DicomModification::~DicomModification() |
310 { | 323 { |
946 LOG(ERROR) << "When modifying an instance, the parent SeriesInstanceUID cannot be manually modified"; | 959 LOG(ERROR) << "When modifying an instance, the parent SeriesInstanceUID cannot be manually modified"; |
947 throw OrthancException(ErrorCode_BadRequest); | 960 throw OrthancException(ErrorCode_BadRequest); |
948 } | 961 } |
949 | 962 |
950 | 963 |
964 // (0) Create a summary of the source file, if a custom generator | |
965 // is provided | |
966 if (identifierGenerator_ != NULL) | |
967 { | |
968 toModify.ExtractDicomSummary(currentSource_); | |
969 } | |
970 | |
971 | |
951 // (1) Remove the private tags, if need be | 972 // (1) Remove the private tags, if need be |
952 if (removePrivateTags_) | 973 if (removePrivateTags_) |
953 { | 974 { |
954 toModify.RemovePrivateTags(privateTagsToKeep_); | 975 toModify.RemovePrivateTags(privateTagsToKeep_); |
955 } | 976 } |