comparison OrthancFramework/UnitTestsSources/FromDcmtkTests.cpp @ 4935:acd3f72e2a21 more-tags

split ExpandResource in 2: read from DB and serialize to json. This will allow us to merge requested tags from both the DB and the file system
author Alain Mazy <am@osimis.io>
date Thu, 10 Mar 2022 19:00:43 +0100
parents 43e613a7756b
children 96a3e81eba90
comparison
equal deleted inserted replaced
4934:94a7b681b340 4935:acd3f72e2a21
356 ASSERT_EQ(ValueRepresentation_NotSupported, 356 ASSERT_EQ(ValueRepresentation_NotSupported,
357 FromDcmtkBridge::LookupValueRepresentation(DicomTag(0x0001, 0x0001) /* some private tag */)); 357 FromDcmtkBridge::LookupValueRepresentation(DicomTag(0x0001, 0x0001) /* some private tag */));
358 } 358 }
359 359
360 360
361 TEST(FromDcmtkBridge, ParseListOfTags)
362 {
363 {// nominal test
364 std::string source = "0010,0010;PatientBirthDate;0020,0020";
365 std::set<DicomTag> result;
366 FromDcmtkBridge::ParseListOfTags(result, source);
367
368 ASSERT_TRUE(result.find(DICOM_TAG_PATIENT_NAME) != result.end());
369 ASSERT_TRUE(result.find(DICOM_TAG_PATIENT_BIRTH_DATE) != result.end());
370 ASSERT_TRUE(result.find(DICOM_TAG_PATIENT_ORIENTATION) != result.end());
371 ASSERT_TRUE(result.find(DICOM_TAG_PATIENT_ID) == result.end());
372 }
373
374 {// no tag
375 std::string source = "";
376 std::set<DicomTag> result;
377 FromDcmtkBridge::ParseListOfTags(result, source);
378
379 ASSERT_EQ(0, result.size());
380 }
381
382 {// invalid tag
383 std::string source = "0010,0010;Patient-BirthDate;0020,0020";
384 std::set<DicomTag> result;
385
386 ASSERT_THROW(FromDcmtkBridge::ParseListOfTags(result, source), OrthancException);
387 }
388
389 {// duplicate tag only once
390 std::string source = "0010,0010;PatientName";
391 std::set<DicomTag> result;
392
393 FromDcmtkBridge::ParseListOfTags(result, source);
394
395 ASSERT_EQ(1, result.size());
396 }
397
398 }
361 399
362 static const DicomTag REFERENCED_STUDY_SEQUENCE(0x0008, 0x1110); 400 static const DicomTag REFERENCED_STUDY_SEQUENCE(0x0008, 0x1110);
363 static const DicomTag REFERENCED_PATIENT_SEQUENCE(0x0008, 0x1120); 401 static const DicomTag REFERENCED_PATIENT_SEQUENCE(0x0008, 0x1120);
364 402
365 static void CreateSampleJson(Json::Value& a) 403 static void CreateSampleJson(Json::Value& a)