comparison OrthancServer/OrthancRestApi/OrthancRestAnonymizeModify.cpp @ 1695:18c02c6987d5

fix for encodings
author Sebastien Jodogne <s.jodogne@gmail.com>
date Thu, 08 Oct 2015 14:34:19 +0200
parents 26083d84d237
children b62c2e706c13
comparison
equal deleted inserted replaced
1694:06d579e82bb8 1695:18c02c6987d5
502 if (tags[name].type() != Json::stringValue) 502 if (tags[name].type() != Json::stringValue)
503 { 503 {
504 throw OrthancException(ErrorCode_CreateDicomNotString); 504 throw OrthancException(ErrorCode_CreateDicomNotString);
505 } 505 }
506 506
507 std::string value = tags[name].asString();
508 DicomTag tag = FromDcmtkBridge::ParseTag(name); 507 DicomTag tag = FromDcmtkBridge::ParseTag(name);
509 508
510 if (tag != DICOM_TAG_SPECIFIC_CHARACTER_SET) 509 if (tag != DICOM_TAG_SPECIFIC_CHARACTER_SET)
511 { 510 {
512 if (tag != DICOM_TAG_PATIENT_ID && 511 if (tag != DICOM_TAG_PATIENT_ID &&
527 526
528 if (tag == DICOM_TAG_PIXEL_DATA) 527 if (tag == DICOM_TAG_PIXEL_DATA)
529 { 528 {
530 throw OrthancException(ErrorCode_CreateDicomUseContent); 529 throw OrthancException(ErrorCode_CreateDicomUseContent);
531 } 530 }
532 else if (decodeBinaryTags &&
533 boost::starts_with(value, "data:application/octet-stream;base64,"))
534 {
535 std::string mime, binary;
536 Toolbox::DecodeDataUriScheme(mime, binary, value);
537 dicom.Replace(tag, binary);
538 }
539 else 531 else
540 { 532 {
541 dicom.Replace(tag, Toolbox::ConvertFromUtf8(value, dicom.GetEncoding())); 533 dicom.Replace(tag, tags[name], decodeBinaryTags);
542 } 534 }
543 } 535 }
544 } 536 }
545 } 537 }
546 538