Mercurial > hg > orthanc
changeset 5795:9990b4140c1c find-refactoring
fix unit tests
author | Alain Mazy <am@orthanc.team> |
---|---|
date | Wed, 18 Sep 2024 15:45:18 +0200 |
parents | 44eef6975662 |
children | 16ce3c920f71 |
files | OrthancFramework/Sources/DicomFormat/DicomMap.cpp OrthancFramework/Sources/DicomFormat/DicomMap.h OrthancFramework/UnitTestsSources/DicomMapTests.cpp OrthancServer/Sources/Database/StatelessDatabaseOperations.cpp OrthancServer/Sources/ResourceFinder.cpp |
diffstat | 5 files changed, 19 insertions(+), 17 deletions(-) [+] |
line wrap: on
line diff
--- a/OrthancFramework/Sources/DicomFormat/DicomMap.cpp Wed Sep 18 14:55:06 2024 +0200 +++ b/OrthancFramework/Sources/DicomFormat/DicomMap.cpp Wed Sep 18 15:45:18 2024 +0200 @@ -347,7 +347,7 @@ return signatures_[level]; } - std::string GetDefaultMainDicomTagsSignature(ResourceType level) + std::string GetDefaultMainDicomTagsSignatureFrom1_11(ResourceType level) { #if !defined(__EMSCRIPTEN__) ReaderLock lock(mutex_); @@ -827,9 +827,9 @@ return DicomMap::MainDicomTagsConfiguration::GetInstance().GetMainDicomTagsSignature(level); } - std::string DicomMap::GetDefaultMainDicomTagsSignature(ResourceType level) + std::string DicomMap::GetDefaultMainDicomTagsSignatureFrom1_11(ResourceType level) { - return DicomMap::MainDicomTagsConfiguration::GetInstance().GetDefaultMainDicomTagsSignature(level); + return DicomMap::MainDicomTagsConfiguration::GetInstance().GetDefaultMainDicomTagsSignatureFrom1_11(level); } void DicomMap::GetTags(std::set<DicomTag>& tags) const
--- a/OrthancFramework/Sources/DicomFormat/DicomMap.h Wed Sep 18 14:55:06 2024 +0200 +++ b/OrthancFramework/Sources/DicomFormat/DicomMap.h Wed Sep 18 15:45:18 2024 +0200 @@ -152,7 +152,7 @@ // returns a string uniquely identifying the list of main dicom tags for a level static std::string GetMainDicomTagsSignature(ResourceType level); - static std::string GetDefaultMainDicomTagsSignature(ResourceType level); + static std::string GetDefaultMainDicomTagsSignatureFrom1_11(ResourceType level); static void GetAllMainDicomTags(std::set<DicomTag>& target);
--- a/OrthancFramework/UnitTestsSources/DicomMapTests.cpp Wed Sep 18 14:55:06 2024 +0200 +++ b/OrthancFramework/UnitTestsSources/DicomMapTests.cpp Wed Sep 18 15:45:18 2024 +0200 @@ -148,10 +148,10 @@ TEST_F(DicomMapMainTagsTests, Signatures) { - std::string defaultPatientSignature = DicomMap::GetDefaultMainDicomTagsSignature(ResourceType_Patient); - std::string defaultStudySignature = DicomMap::GetDefaultMainDicomTagsSignature(ResourceType_Study); - std::string defaultSeriesSignature = DicomMap::GetDefaultMainDicomTagsSignature(ResourceType_Series); - std::string defaultInstanceSignature = DicomMap::GetDefaultMainDicomTagsSignature(ResourceType_Instance); + std::string defaultPatientSignature = DicomMap::GetDefaultMainDicomTagsSignatureFrom1_11(ResourceType_Patient); + std::string defaultStudySignature = DicomMap::GetDefaultMainDicomTagsSignatureFrom1_11(ResourceType_Study); + std::string defaultSeriesSignature = DicomMap::GetDefaultMainDicomTagsSignatureFrom1_11(ResourceType_Series); + std::string defaultInstanceSignature = DicomMap::GetDefaultMainDicomTagsSignatureFrom1_11(ResourceType_Instance); ASSERT_NE(defaultInstanceSignature, defaultPatientSignature); ASSERT_NE(defaultSeriesSignature, defaultStudySignature); @@ -162,11 +162,11 @@ std::string seriesSignature = DicomMap::GetMainDicomTagsSignature(ResourceType_Series); std::string instanceSignature = DicomMap::GetMainDicomTagsSignature(ResourceType_Instance); - // at start, default and current signature should be equal - ASSERT_EQ(defaultPatientSignature, patientSignature); - ASSERT_EQ(defaultStudySignature, studySignature); - ASSERT_EQ(defaultSeriesSignature, seriesSignature); - ASSERT_EQ(defaultInstanceSignature, instanceSignature); + // // at start, default and current signature should be equal !! This is not true anymore since we have added new MainDicomTags in 1.12.5 + // ASSERT_EQ(defaultPatientSignature, patientSignature); + // ASSERT_EQ(defaultStudySignature, studySignature); + // ASSERT_EQ(defaultSeriesSignature, seriesSignature); + // ASSERT_EQ(defaultInstanceSignature, instanceSignature); DicomMap::AddMainDicomTag(DICOM_TAG_BITS_ALLOCATED, ResourceType_Instance); instanceSignature = DicomMap::GetMainDicomTagsSignature(ResourceType_Instance); @@ -266,6 +266,7 @@ if (level == ResourceType_Study && (*it == DicomTag(0x0008, 0x0080) || /* InstitutionName, from Visit identification module, related to Visit */ *it == DicomTag(0x0032, 0x1032) || /* RequestingPhysician, from Imaging Service Request module, related to Study */ + *it == DicomTag(0x0008, 0x0201) || /* TimezoneOffsetFromUTC */ *it == DicomTag(0x0032, 0x1060))) /* RequestedProcedureDescription, from Requested Procedure module, related to Study */ { ok = true; @@ -284,6 +285,7 @@ *it == DicomTag(0x0054, 0x0101) || /* NumberOfTimeSlices, from PET Series module */ *it == DicomTag(0x0054, 0x1000) || /* SeriesType, from PET Series module */ *it == DicomTag(0x0018, 0x1400) || /* AcquisitionDeviceProcessingDescription, from CR/X-Ray/DX/WholeSlideMicro Image (SIMPLIFICATION => Series) */ + *it == DicomTag(0x0008, 0x0201) || /* TimezoneOffsetFromUTC */ *it == DicomTag(0x0018, 0x0010))) /* ContrastBolusAgent, from Contrast/Bolus module (SIMPLIFICATION => Series) */ { ok = true;
--- a/OrthancServer/Sources/Database/StatelessDatabaseOperations.cpp Wed Sep 18 14:55:06 2024 +0200 +++ b/OrthancServer/Sources/Database/StatelessDatabaseOperations.cpp Wed Sep 18 15:45:18 2024 +0200 @@ -741,7 +741,7 @@ } // check the main dicom tags list has not changed since the resource was stored - target.mainDicomTagsSignature_ = DicomMap::GetDefaultMainDicomTagsSignature(type); + target.mainDicomTagsSignature_ = DicomMap::GetDefaultMainDicomTagsSignatureFrom1_11(type); LookupStringMetadata(target.mainDicomTagsSignature_, target.metadata_, MetadataType_MainDicomTagsSignature); } @@ -789,7 +789,7 @@ std::map<MetadataType, std::string> parentMetadata; transaction.GetAllMetadata(parentMetadata, currentParentId); - std::string parentMainDicomTagsSignature = DicomMap::GetDefaultMainDicomTagsSignature(currentLevel); + std::string parentMainDicomTagsSignature = DicomMap::GetDefaultMainDicomTagsSignatureFrom1_11(currentLevel); LookupStringMetadata(parentMainDicomTagsSignature, parentMetadata, MetadataType_MainDicomTagsSignature); std::set<DicomTag> parentSavedMainDicomTags;
--- a/OrthancServer/Sources/ResourceFinder.cpp Wed Sep 18 14:55:06 2024 +0200 +++ b/OrthancServer/Sources/ResourceFinder.cpp Wed Sep 18 15:45:18 2024 +0200 @@ -810,12 +810,12 @@ // check which tags have been saved in DB; that's the way to know if they are missing because they were not saved or because they have no value - std::string signature = DicomMap::GetDefaultMainDicomTagsSignature(level); // default signature in case it's not in the metadata (= the signature for 1.11.0) + std::string signature = DicomMap::GetDefaultMainDicomTagsSignatureFrom1_11(level); // default signature in case it's not in the metadata (= the signature for 1.11.0) if (resource.LookupMetadata(signature, level, MetadataType_MainDicomTagsSignature)) { if (level == ResourceType_Study) // when we retrieve the study tags, we actually also get the patient tags that are also saved at study level but not included in the signature { - signature += ";" + DicomMap::GetDefaultMainDicomTagsSignature(ResourceType_Patient); // append the default signature (from before 1.11.0) + signature += ";" + DicomMap::GetDefaultMainDicomTagsSignatureFrom1_11(ResourceType_Patient); // append the default signature (from before 1.11.0) } FromDcmtkBridge::ParseListOfTags(savedMainDicomTags, signature);