comparison UnitTestsSources/FromDcmtkTests.cpp @ 1699:8ca0e89798b2

"/modify" can insert/modify sequences
author Sebastien Jodogne <s.jodogne@gmail.com>
date Fri, 09 Oct 2015 13:31:22 +0200
parents 18c02c6987d5
children 4aaaecae5803
comparison
equal deleted inserted replaced
1698:d78b87f93bcf 1699:8ca0e89798b2
103 103
104 std::string s; 104 std::string s;
105 ParsedDicomFile o; 105 ParsedDicomFile o;
106 o.Replace(DICOM_TAG_PATIENT_NAME, "coucou"); 106 o.Replace(DICOM_TAG_PATIENT_NAME, "coucou");
107 ASSERT_FALSE(o.GetTagValue(s, privateTag)); 107 ASSERT_FALSE(o.GetTagValue(s, privateTag));
108 o.Insert(privateTag, "private tag"); 108 o.Insert(privateTag, "private tag", false);
109 ASSERT_TRUE(o.GetTagValue(s, privateTag)); 109 ASSERT_TRUE(o.GetTagValue(s, privateTag));
110 ASSERT_STREQ("private tag", s.c_str()); 110 ASSERT_STREQ("private tag", s.c_str());
111 111
112 ASSERT_FALSE(o.GetTagValue(s, privateTag2)); 112 ASSERT_FALSE(o.GetTagValue(s, privateTag2));
113 ASSERT_THROW(o.Replace(privateTag2, "hello", DicomReplaceMode_ThrowIfAbsent), OrthancException); 113 ASSERT_THROW(o.Replace(privateTag2, "hello", DicomReplaceMode_ThrowIfAbsent), OrthancException);
268 { 268 {
269 ParsedDicomFile f; 269 ParsedDicomFile f;
270 f.SetEncoding(testEncodings[i]); 270 f.SetEncoding(testEncodings[i]);
271 271
272 std::string s = Toolbox::ConvertToUtf8(testEncodingsEncoded[i], testEncodings[i]); 272 std::string s = Toolbox::ConvertToUtf8(testEncodingsEncoded[i], testEncodings[i]);
273 f.Insert(DICOM_TAG_PATIENT_NAME, s); 273 f.Insert(DICOM_TAG_PATIENT_NAME, s, false);
274 f.SaveToMemoryBuffer(dicom); 274 f.SaveToMemoryBuffer(dicom);
275 } 275 }
276 276
277 if (testEncodings[i] != Encoding_Windows1251) 277 if (testEncodings[i] != Encoding_Windows1251)
278 { 278 {
406 406
407 TEST(ParsedDicomFile, InsertReplaceStrings) 407 TEST(ParsedDicomFile, InsertReplaceStrings)
408 { 408 {
409 ParsedDicomFile f; 409 ParsedDicomFile f;
410 410
411 f.Insert(DICOM_TAG_PATIENT_NAME, "World"); 411 f.Insert(DICOM_TAG_PATIENT_NAME, "World", false);
412 ASSERT_THROW(f.Insert(DICOM_TAG_PATIENT_ID, "Hello"), OrthancException); // Already existing tag 412 ASSERT_THROW(f.Insert(DICOM_TAG_PATIENT_ID, "Hello", false), OrthancException); // Already existing tag
413 f.Replace(DICOM_TAG_SOP_INSTANCE_UID, "Toto"); // (*) 413 f.Replace(DICOM_TAG_SOP_INSTANCE_UID, "Toto"); // (*)
414 f.Replace(DICOM_TAG_SOP_CLASS_UID, "Tata"); // (**) 414 f.Replace(DICOM_TAG_SOP_CLASS_UID, "Tata"); // (**)
415 415
416 std::string s; 416 std::string s;
417 417