Mercurial > hg > orthanc
changeset 5651:c4e33e0f907b
merge
author | Alain Mazy <am@orthanc.team> |
---|---|
date | Wed, 05 Jun 2024 11:04:37 +0200 |
parents | c2817a9eb032 (diff) a8e9113dc8f1 (current diff) |
children | 53ddff5dccaf |
files | |
diffstat | 2 files changed, 46 insertions(+), 30 deletions(-) [+] |
line wrap: on
line diff
--- a/OrthancServer/UnitTestsSources/UnitTestsMain.cpp Tue Jun 04 19:15:42 2024 +0200 +++ b/OrthancServer/UnitTestsSources/UnitTestsMain.cpp Wed Jun 05 11:04:37 2024 +0200 @@ -242,42 +242,53 @@ Json::Value dicomAsJson; OrthancConfiguration::DefaultDicomDatasetToJson(dicomAsJson, toStore->GetParsedDicomFile()); - DicomMap m; - m.FromDicomAsJson(dicomAsJson); + { // without parsing sequences + DicomMap m; + m.FromDicomAsJson(dicomAsJson); - ASSERT_EQ("ISO_IR 100", m.GetValue(DICOM_TAG_SPECIFIC_CHARACTER_SET).GetContent()); - - ASSERT_FALSE(m.GetValue(DICOM_TAG_PATIENT_NAME).IsBinary()); - ASSERT_EQ("Hello", m.GetValue(DICOM_TAG_PATIENT_NAME).GetContent()); - - ASSERT_FALSE(m.GetValue(DICOM_TAG_STUDY_DESCRIPTION).IsBinary()); - ASSERT_EQ(utf8, m.GetValue(DICOM_TAG_STUDY_DESCRIPTION).GetContent()); + ASSERT_EQ("ISO_IR 100", m.GetValue(DICOM_TAG_SPECIFIC_CHARACTER_SET).GetContent()); + + ASSERT_FALSE(m.GetValue(DICOM_TAG_PATIENT_NAME).IsBinary()); + ASSERT_EQ("Hello", m.GetValue(DICOM_TAG_PATIENT_NAME).GetContent()); + + ASSERT_FALSE(m.GetValue(DICOM_TAG_STUDY_DESCRIPTION).IsBinary()); + ASSERT_EQ(utf8, m.GetValue(DICOM_TAG_STUDY_DESCRIPTION).GetContent()); - ASSERT_FALSE(m.HasTag(DICOM_TAG_MANUFACTURER)); // Too long - ASSERT_FALSE(m.HasTag(DICOM_TAG_PIXEL_DATA)); // Pixel data - ASSERT_FALSE(m.HasTag(DICOM_TAG_REFERENCED_SERIES_SEQUENCE)); // Sequence - ASSERT_EQ(DICOM_TAG_REFERENCED_SERIES_SEQUENCE.GetGroup(), DCM_ReferencedSeriesSequence.getGroup()); - ASSERT_EQ(DICOM_TAG_REFERENCED_SERIES_SEQUENCE.GetElement(), DCM_ReferencedSeriesSequence.getElement()); + ASSERT_FALSE(m.HasTag(DICOM_TAG_MANUFACTURER)); // Too long + ASSERT_FALSE(m.HasTag(DICOM_TAG_PIXEL_DATA)); // Pixel data + ASSERT_FALSE(m.HasTag(DICOM_TAG_REFERENCED_SERIES_SEQUENCE)); // Sequence + ASSERT_EQ(DICOM_TAG_REFERENCED_SERIES_SEQUENCE.GetGroup(), DCM_ReferencedSeriesSequence.getGroup()); + ASSERT_EQ(DICOM_TAG_REFERENCED_SERIES_SEQUENCE.GetElement(), DCM_ReferencedSeriesSequence.getElement()); + + ASSERT_TRUE(m.HasTag(DICOM_TAG_SERIES_DESCRIPTION)); // Maximum length + ASSERT_FALSE(m.GetValue(DICOM_TAG_SERIES_DESCRIPTION).IsBinary()); + ASSERT_EQ(ORTHANC_MAXIMUM_TAG_LENGTH, + static_cast<int>(m.GetValue(DICOM_TAG_SERIES_DESCRIPTION).GetContent().length())); - ASSERT_TRUE(m.HasTag(DICOM_TAG_SERIES_DESCRIPTION)); // Maximum length - ASSERT_FALSE(m.GetValue(DICOM_TAG_SERIES_DESCRIPTION).IsBinary()); - ASSERT_EQ(ORTHANC_MAXIMUM_TAG_LENGTH, - static_cast<int>(m.GetValue(DICOM_TAG_SERIES_DESCRIPTION).GetContent().length())); + ASSERT_FALSE(m.GetValue(DICOM_TAG_ROWS).IsBinary()); + ASSERT_EQ("512", m.GetValue(DICOM_TAG_ROWS).GetContent()); - ASSERT_FALSE(m.GetValue(DICOM_TAG_ROWS).IsBinary()); - ASSERT_EQ("512", m.GetValue(DICOM_TAG_ROWS).GetContent()); + ASSERT_FALSE(m.GetValue(DICOM_TAG_STUDY_ID).IsNull()); + ASSERT_FALSE(m.GetValue(DICOM_TAG_STUDY_ID).IsBinary()); + ASSERT_EQ("", m.GetValue(DICOM_TAG_STUDY_ID).GetContent()); + + DicomArray a(m); + ASSERT_EQ(6u, a.GetSize()); - ASSERT_FALSE(m.GetValue(DICOM_TAG_STUDY_ID).IsNull()); - ASSERT_FALSE(m.GetValue(DICOM_TAG_STUDY_ID).IsBinary()); - ASSERT_EQ("", m.GetValue(DICOM_TAG_STUDY_ID).GetContent()); + + //dicom.SaveToFile("/tmp/test.dcm"); + //std::cout << toStore.GetJson() << std::endl; + //a.Print(stdout); + } - DicomArray a(m); - ASSERT_EQ(6u, a.GetSize()); + { // now parses sequences + // LOG(INFO) << dicomAsJson.toStyledString(); - - //dicom.SaveToFile("/tmp/test.dcm"); - //std::cout << toStore.GetJson() << std::endl; - //a.Print(stdout); + DicomMap m; + m.FromDicomAsJson(dicomAsJson, false, true /* parseSequences */); + + ASSERT_TRUE(m.HasTag(DICOM_TAG_REFERENCED_SERIES_SEQUENCE)); + } }
--- a/TODO Tue Jun 04 19:15:42 2024 +0200 +++ b/TODO Wed Jun 05 11:04:37 2024 +0200 @@ -126,7 +126,12 @@ https://groups.google.com/g/orthanc-users/c/o15Dekecgds/m/xmPE2y3bAwAJ * Support Palette PNG in /tools/create-dicom: https://discourse.orthanc-server.org/t/404-on-tools-create-dicom-endpoint-with-specific-png/3562 -* Support creation of DICOM files from MP4 in /tools/create-dicom +* Support creation of DICOM files from MP4 in /tools/create-dicom. + Sample python code: https://github.com/salimkanoun/OrthancGif/blob/new-organisation/python/create_dicom_video.py. + We would need to extract frame rate + dimension from the MP4 which would + require ffmpeg or a similar library -> can not be done in the Orthanc core. + -> keep it for a python plugin + -> or require the payload to include rows/columns/cinerate/... * (1) In the /studies/{id}/anonymize route, add an option to remove secondary captures. They usually contains Patient info in the image. The SOPClassUID might be used to identify such secondary