Mercurial > hg > orthanc
changeset 5180:d2626a062809
fix DicomMap::SetupFindXXXTemplate() methods
author | Sebastien Jodogne <s.jodogne@gmail.com> |
---|---|
date | Sat, 25 Mar 2023 11:21:09 +0100 |
parents | 1e406c23b352 |
children | 65b05b44ae4c |
files | OrthancFramework/Sources/DicomFormat/DicomMap.cpp OrthancFramework/UnitTestsSources/DicomMapTests.cpp |
diffstat | 2 files changed, 63 insertions(+), 43 deletions(-) [+] |
line wrap: on
line diff
--- a/OrthancFramework/Sources/DicomFormat/DicomMap.cpp Sat Mar 25 11:11:11 2023 +0100 +++ b/OrthancFramework/Sources/DicomFormat/DicomMap.cpp Sat Mar 25 11:21:09 2023 +0100 @@ -587,73 +587,81 @@ } } - static void SetupFindTemplate(DicomMap& result, - const std::set<DicomTag>& mainDicomTags) + void DicomMap::SetupFindPatientTemplate(DicomMap& result) { result.Clear(); - for (std::set<DicomTag>::const_iterator itmt = mainDicomTags.begin(); - itmt != mainDicomTags.end(); ++itmt) - { - result.SetValue(*itmt, "", false); - } - } + // Identifying tags + result.SetValue(DICOM_TAG_PATIENT_ID, "", false); - void DicomMap::SetupFindPatientTemplate(DicomMap& result) - { - std::set<DicomTag> mainDicomTags; - DicomMap::MainDicomTagsConfiguration::GetInstance().GetMainDicomTagsByLevel(mainDicomTags, ResourceType_Patient); - SetupFindTemplate(result, mainDicomTags); + // Other tags in the "Patient" module + result.SetValue(DICOM_TAG_OTHER_PATIENT_IDS, "", false); + result.SetValue(DICOM_TAG_PATIENT_BIRTH_DATE, "", false); + result.SetValue(DICOM_TAG_PATIENT_NAME, "", false); + result.SetValue(DICOM_TAG_PATIENT_SEX, "", false); } void DicomMap::SetupFindStudyTemplate(DicomMap& result) { - std::set<DicomTag> mainDicomTags; - DicomMap::MainDicomTagsConfiguration::GetInstance().GetMainDicomTagsByLevel(mainDicomTags, ResourceType_Study); - SetupFindTemplate(result, mainDicomTags); + result.Clear(); + + // Identifying tags + result.SetValue(DICOM_TAG_PATIENT_ID, "", false); result.SetValue(DICOM_TAG_ACCESSION_NUMBER, "", false); - result.SetValue(DICOM_TAG_PATIENT_ID, "", false); + result.SetValue(DICOM_TAG_STUDY_INSTANCE_UID, "", false); - // These main DICOM tags are only indirectly related to the - // General Study Module, remove them - result.Remove(DICOM_TAG_INSTITUTION_NAME); - result.Remove(DICOM_TAG_REQUESTING_PHYSICIAN); - result.Remove(DICOM_TAG_REQUESTED_PROCEDURE_DESCRIPTION); + // Other tags in the "General Study" module + result.SetValue(DICOM_TAG_REFERRING_PHYSICIAN_NAME, "", false); + result.SetValue(DICOM_TAG_STUDY_DATE, "", false); + result.SetValue(DICOM_TAG_STUDY_DESCRIPTION, "", false); + result.SetValue(DICOM_TAG_STUDY_ID, "", false); + result.SetValue(DICOM_TAG_STUDY_TIME, "", false); } void DicomMap::SetupFindSeriesTemplate(DicomMap& result) { - std::set<DicomTag> mainDicomTags; - DicomMap::MainDicomTagsConfiguration::GetInstance().GetMainDicomTagsByLevel(mainDicomTags, ResourceType_Series); - SetupFindTemplate(result, mainDicomTags); + result.Clear(); + + // Identifying tags + result.SetValue(DICOM_TAG_PATIENT_ID, "", false); result.SetValue(DICOM_TAG_ACCESSION_NUMBER, "", false); - result.SetValue(DICOM_TAG_PATIENT_ID, "", false); result.SetValue(DICOM_TAG_STUDY_INSTANCE_UID, "", false); + result.SetValue(DICOM_TAG_SERIES_INSTANCE_UID, "", false); - // These tags are considered as "main" by Orthanc, but are not in the Series module - result.Remove(DicomTag(0x0008, 0x0070)); // Manufacturer - result.Remove(DicomTag(0x0008, 0x1010)); // Station name - result.Remove(DicomTag(0x0018, 0x0024)); // Sequence name - result.Remove(DICOM_TAG_CARDIAC_NUMBER_OF_IMAGES); - result.Remove(DICOM_TAG_IMAGES_IN_ACQUISITION); - result.Remove(DICOM_TAG_NUMBER_OF_SLICES); - result.Remove(DICOM_TAG_NUMBER_OF_TEMPORAL_POSITIONS); - result.Remove(DICOM_TAG_NUMBER_OF_TIME_SLICES); - result.Remove(DICOM_TAG_IMAGE_ORIENTATION_PATIENT); - result.Remove(DICOM_TAG_SERIES_TYPE); - result.Remove(DICOM_TAG_ACQUISITION_DEVICE_PROCESSING_DESCRIPTION); - result.Remove(DICOM_TAG_CONTRAST_BOLUS_AGENT); + // Other tags in the "General Series" module + result.SetValue(DICOM_TAG_BODY_PART_EXAMINED, "", false); + result.SetValue(DICOM_TAG_MODALITY, "", false); + result.SetValue(DICOM_TAG_OPERATOR_NAME, "", false); + result.SetValue(DICOM_TAG_PERFORMED_PROCEDURE_STEP_DESCRIPTION, "", false); + result.SetValue(DICOM_TAG_PROTOCOL_NAME, "", false); + result.SetValue(DICOM_TAG_SERIES_DATE, "", false); + result.SetValue(DICOM_TAG_SERIES_DESCRIPTION, "", false); + result.SetValue(DICOM_TAG_SERIES_NUMBER, "", false); + result.SetValue(DICOM_TAG_SERIES_TIME, "", false); } void DicomMap::SetupFindInstanceTemplate(DicomMap& result) { - std::set<DicomTag> mainDicomTags; - DicomMap::MainDicomTagsConfiguration::GetInstance().GetMainDicomTagsByLevel(mainDicomTags, ResourceType_Instance); - SetupFindTemplate(result, mainDicomTags); + result.Clear(); + + // Identifying tags + result.SetValue(DICOM_TAG_PATIENT_ID, "", false); result.SetValue(DICOM_TAG_ACCESSION_NUMBER, "", false); - result.SetValue(DICOM_TAG_PATIENT_ID, "", false); result.SetValue(DICOM_TAG_STUDY_INSTANCE_UID, "", false); result.SetValue(DICOM_TAG_SERIES_INSTANCE_UID, "", false); + result.SetValue(DICOM_TAG_SOP_INSTANCE_UID, "", false); + + // Other tags in the "SOP Common" module + result.SetValue(DICOM_TAG_ACQUISITION_NUMBER, "", false); + result.SetValue(DICOM_TAG_IMAGE_COMMENTS, "", false); + result.SetValue(DICOM_TAG_IMAGE_INDEX, "", false); + result.SetValue(DICOM_TAG_IMAGE_ORIENTATION_PATIENT, "", false); + result.SetValue(DICOM_TAG_IMAGE_POSITION_PATIENT, "", false); + result.SetValue(DICOM_TAG_INSTANCE_CREATION_DATE, "", false); + result.SetValue(DICOM_TAG_INSTANCE_CREATION_TIME, "", false); + result.SetValue(DICOM_TAG_INSTANCE_NUMBER, "", false); + result.SetValue(DICOM_TAG_NUMBER_OF_FRAMES, "", false); + result.SetValue(DICOM_TAG_TEMPORAL_POSITION_IDENTIFIER, "", false); }
--- a/OrthancFramework/UnitTestsSources/DicomMapTests.cpp Sat Mar 25 11:11:11 2023 +0100 +++ b/OrthancFramework/UnitTestsSources/DicomMapTests.cpp Sat Mar 25 11:21:09 2023 +0100 @@ -1076,6 +1076,9 @@ { DicomMap m; + m.SetValue(DICOM_TAG_ENCAPSULATED_DOCUMENT, "nope", false); + m.SetValue(DICOM_TAG_PATIENT_ID, "patient_id", false); + DicomMap::SetupFindPatientTemplate(m); std::set<DicomTag> tags; m.GetTags(tags); @@ -1092,6 +1095,9 @@ { DicomMap m; + m.SetValue(DICOM_TAG_ENCAPSULATED_DOCUMENT, "nope", false); + m.SetValue(DICOM_TAG_PATIENT_ID, "patient_id", false); + DicomMap::SetupFindStudyTemplate(m); std::set<DicomTag> tags; m.GetTags(tags); @@ -1111,6 +1117,9 @@ { DicomMap m; + m.SetValue(DICOM_TAG_ENCAPSULATED_DOCUMENT, "nope", false); + m.SetValue(DICOM_TAG_PATIENT_ID, "patient_id", false); + DicomMap::SetupFindSeriesTemplate(m); std::set<DicomTag> tags; m.GetTags(tags); @@ -1135,6 +1144,9 @@ { DicomMap m; + m.SetValue(DICOM_TAG_ENCAPSULATED_DOCUMENT, "nope", false); + m.SetValue(DICOM_TAG_PATIENT_ID, "patient_id", false); + DicomMap::SetupFindInstanceTemplate(m); std::set<DicomTag> tags; m.GetTags(tags);