Mercurial > hg > orthanc
changeset 2518:63d2cc0fb40a
refactoring
author | Sebastien Jodogne <s.jodogne@gmail.com> |
---|---|
date | Thu, 29 Mar 2018 14:41:41 +0200 |
parents | d3d306bc4b99 |
children | 2e6b7862ccf2 |
files | OrthancServer/OrthancRestApi/OrthancRestAnonymizeModify.cpp |
diffstat | 1 files changed, 13 insertions(+), 10 deletions(-) [+] |
line wrap: on
line diff
--- a/OrthancServer/OrthancRestApi/OrthancRestAnonymizeModify.cpp Thu Mar 29 14:35:48 2018 +0200 +++ b/OrthancServer/OrthancRestApi/OrthancRestAnonymizeModify.cpp Thu Mar 29 14:41:41 2018 +0200 @@ -200,8 +200,8 @@ static void ParseAnonymizationRequest(DicomModification& target, - const Json::Value& request, - ServerContext& context) + bool& patientNameReplaced, + const Json::Value& request) { if (!request.isObject()) { @@ -249,13 +249,8 @@ ParseListOfTags(target, request["Keep"], TagOperation_Keep, force); } - if (target.IsReplaced(DICOM_TAG_PATIENT_NAME) && - target.GetReplacement(DICOM_TAG_PATIENT_NAME) == patientName) - { - // Overwrite the random Patient's Name by one that is more - // user-friendly (provided none was specified by the user) - target.Replace(DICOM_TAG_PATIENT_NAME, GeneratePatientName(context), true); - } + patientNameReplaced = (target.IsReplaced(DICOM_TAG_PATIENT_NAME) && + target.GetReplacement(DICOM_TAG_PATIENT_NAME) == patientName); } @@ -285,7 +280,15 @@ if (call.ParseJsonRequest(request) && request.isObject()) { - ParseAnonymizationRequest(target, request, OrthancRestApi::GetContext(call)); + bool patientNameReplaced; + ParseAnonymizationRequest(target, patientNameReplaced, request); + + if (patientNameReplaced) + { + // Overwrite the random Patient's Name by one that is more + // user-friendly (provided none was specified by the user) + target.Replace(DICOM_TAG_PATIENT_NAME, GeneratePatientName(OrthancRestApi::GetContext(call)), true); + } } else {