Mercurial > hg > orthanc
comparison Core/DicomParsing/DicomModification.cpp @ 2721:062776ab4a21 jobs
fix issue #94
author | Sebastien Jodogne <s.jodogne@gmail.com> |
---|---|
date | Thu, 12 Jul 2018 12:55:48 +0200 |
parents | 2540ac79ab6c |
children | 99863d6245b2 |
comparison
equal
deleted
inserted
replaced
2720:db0f33b2aeeb | 2721:062776ab4a21 |
---|---|
314 level_(ResourceType_Instance), | 314 level_(ResourceType_Instance), |
315 allowManualIdentifiers_(true), | 315 allowManualIdentifiers_(true), |
316 keepStudyInstanceUid_(false), | 316 keepStudyInstanceUid_(false), |
317 keepSeriesInstanceUid_(false), | 317 keepSeriesInstanceUid_(false), |
318 updateReferencedRelationships_(true), | 318 updateReferencedRelationships_(true), |
319 isAnonymization_(false), | |
319 identifierGenerator_(NULL) | 320 identifierGenerator_(NULL) |
320 { | 321 { |
321 } | 322 } |
322 | 323 |
323 DicomModification::~DicomModification() | 324 DicomModification::~DicomModification() |
818 } | 819 } |
819 | 820 |
820 | 821 |
821 void DicomModification::SetupAnonymization(DicomVersion version) | 822 void DicomModification::SetupAnonymization(DicomVersion version) |
822 { | 823 { |
824 isAnonymization_ = true; | |
825 | |
823 removals_.clear(); | 826 removals_.clear(); |
824 clearings_.clear(); | 827 clearings_.clear(); |
825 ClearReplacements(); | 828 ClearReplacements(); |
826 removePrivateTags_ = true; | 829 removePrivateTags_ = true; |
827 level_ = ResourceType_Patient; | 830 level_ = ResourceType_Patient; |
1028 !IsReplaced(DICOM_TAG_SOP_INSTANCE_UID)) | 1031 !IsReplaced(DICOM_TAG_SOP_INSTANCE_UID)) |
1029 { | 1032 { |
1030 MapDicomTags(toModify, ResourceType_Instance); | 1033 MapDicomTags(toModify, ResourceType_Instance); |
1031 } | 1034 } |
1032 | 1035 |
1033 // (6) Update the "referenced" relationships | 1036 // (6) Update the "referenced" relationships in the case of an anonymization |
1037 if (isAnonymization_) | |
1034 { | 1038 { |
1035 RelationshipsVisitor visitor(*this); | 1039 RelationshipsVisitor visitor(*this); |
1036 | 1040 |
1037 if (updateReferencedRelationships_) | 1041 if (updateReferencedRelationships_) |
1038 { | 1042 { |
1246 static const char* LEVEL = "Level"; | 1250 static const char* LEVEL = "Level"; |
1247 static const char* ALLOW_MANUAL_IDENTIFIERS = "AllowManualIdentifiers"; | 1251 static const char* ALLOW_MANUAL_IDENTIFIERS = "AllowManualIdentifiers"; |
1248 static const char* KEEP_STUDY_INSTANCE_UID = "KeepStudyInstanceUID"; | 1252 static const char* KEEP_STUDY_INSTANCE_UID = "KeepStudyInstanceUID"; |
1249 static const char* KEEP_SERIES_INSTANCE_UID = "KeepSeriesInstanceUID"; | 1253 static const char* KEEP_SERIES_INSTANCE_UID = "KeepSeriesInstanceUID"; |
1250 static const char* UPDATE_REFERENCED_RELATIONSHIPS = "UpdateReferencedRelationships"; | 1254 static const char* UPDATE_REFERENCED_RELATIONSHIPS = "UpdateReferencedRelationships"; |
1255 static const char* IS_ANONYMIZATION = "IsAnonymization"; | |
1251 static const char* REMOVALS = "Removals"; | 1256 static const char* REMOVALS = "Removals"; |
1252 static const char* CLEARINGS = "Clearings"; | 1257 static const char* CLEARINGS = "Clearings"; |
1253 static const char* PRIVATE_TAGS_TO_KEEP = "PrivateTagsToKeep"; | 1258 static const char* PRIVATE_TAGS_TO_KEEP = "PrivateTagsToKeep"; |
1254 static const char* REPLACEMENTS = "Replacements"; | 1259 static const char* REPLACEMENTS = "Replacements"; |
1255 static const char* MAP_PATIENTS = "MapPatients"; | 1260 static const char* MAP_PATIENTS = "MapPatients"; |
1270 value[LEVEL] = EnumerationToString(level_); | 1275 value[LEVEL] = EnumerationToString(level_); |
1271 value[ALLOW_MANUAL_IDENTIFIERS] = allowManualIdentifiers_; | 1276 value[ALLOW_MANUAL_IDENTIFIERS] = allowManualIdentifiers_; |
1272 value[KEEP_STUDY_INSTANCE_UID] = keepStudyInstanceUid_; | 1277 value[KEEP_STUDY_INSTANCE_UID] = keepStudyInstanceUid_; |
1273 value[KEEP_SERIES_INSTANCE_UID] = keepSeriesInstanceUid_; | 1278 value[KEEP_SERIES_INSTANCE_UID] = keepSeriesInstanceUid_; |
1274 value[UPDATE_REFERENCED_RELATIONSHIPS] = updateReferencedRelationships_; | 1279 value[UPDATE_REFERENCED_RELATIONSHIPS] = updateReferencedRelationships_; |
1280 value[IS_ANONYMIZATION] = isAnonymization_; | |
1275 | 1281 |
1276 SerializationToolbox::WriteSetOfTags(value, removals_, REMOVALS); | 1282 SerializationToolbox::WriteSetOfTags(value, removals_, REMOVALS); |
1277 SerializationToolbox::WriteSetOfTags(value, clearings_, CLEARINGS); | 1283 SerializationToolbox::WriteSetOfTags(value, clearings_, CLEARINGS); |
1278 SerializationToolbox::WriteSetOfTags(value, privateTagsToKeep_, PRIVATE_TAGS_TO_KEEP); | 1284 SerializationToolbox::WriteSetOfTags(value, privateTagsToKeep_, PRIVATE_TAGS_TO_KEEP); |
1279 | 1285 |
1366 allowManualIdentifiers_ = SerializationToolbox::ReadBoolean(serialized, ALLOW_MANUAL_IDENTIFIERS); | 1372 allowManualIdentifiers_ = SerializationToolbox::ReadBoolean(serialized, ALLOW_MANUAL_IDENTIFIERS); |
1367 keepStudyInstanceUid_ = SerializationToolbox::ReadBoolean(serialized, KEEP_STUDY_INSTANCE_UID); | 1373 keepStudyInstanceUid_ = SerializationToolbox::ReadBoolean(serialized, KEEP_STUDY_INSTANCE_UID); |
1368 keepSeriesInstanceUid_ = SerializationToolbox::ReadBoolean(serialized, KEEP_SERIES_INSTANCE_UID); | 1374 keepSeriesInstanceUid_ = SerializationToolbox::ReadBoolean(serialized, KEEP_SERIES_INSTANCE_UID); |
1369 updateReferencedRelationships_ = SerializationToolbox::ReadBoolean | 1375 updateReferencedRelationships_ = SerializationToolbox::ReadBoolean |
1370 (serialized, UPDATE_REFERENCED_RELATIONSHIPS); | 1376 (serialized, UPDATE_REFERENCED_RELATIONSHIPS); |
1377 isAnonymization_ = SerializationToolbox::ReadBoolean(serialized, IS_ANONYMIZATION); | |
1371 | 1378 |
1372 SerializationToolbox::ReadSetOfTags(removals_, serialized, REMOVALS); | 1379 SerializationToolbox::ReadSetOfTags(removals_, serialized, REMOVALS); |
1373 SerializationToolbox::ReadSetOfTags(clearings_, serialized, CLEARINGS); | 1380 SerializationToolbox::ReadSetOfTags(clearings_, serialized, CLEARINGS); |
1374 SerializationToolbox::ReadSetOfTags(privateTagsToKeep_, serialized, PRIVATE_TAGS_TO_KEEP); | 1381 SerializationToolbox::ReadSetOfTags(privateTagsToKeep_, serialized, PRIVATE_TAGS_TO_KEEP); |
1375 | 1382 |