Mercurial > hg > orthanc
diff OrthancFramework/UnitTestsSources/FromDcmtkTests.cpp @ 5319:f2e1ad71e49c
added "OrthancPluginLoadDicomInstance()" to load DICOM instances from the database
author | Sebastien Jodogne <s.jodogne@gmail.com> |
---|---|
date | Sat, 24 Jun 2023 12:18:58 +0200 |
parents | 68e15471b408 |
children | a904a4caf5b7 |
line wrap: on
line diff
--- a/OrthancFramework/UnitTestsSources/FromDcmtkTests.cpp Fri Jun 23 18:01:55 2023 +0200 +++ b/OrthancFramework/UnitTestsSources/FromDcmtkTests.cpp Sat Jun 24 12:18:58 2023 +0200 @@ -3264,6 +3264,54 @@ } +#include "../Sources/DicomFormat/DicomArray.h" +TEST(ParsedDicomFile, RemoveFromPixelData) +{ + ParsedDicomFile dicom(true); + ASSERT_TRUE(dicom.GetDcmtkObject().getDataset()->putAndInsertString(DcmTag(0x7fe0, 0x0000), "").good()); + ASSERT_TRUE(dicom.GetDcmtkObject().getDataset()->putAndInsertString(DcmTag(0x7fe0, 0x0009), "").good()); + ASSERT_TRUE(dicom.GetDcmtkObject().getDataset()->putAndInsertUint8Array(DcmTag(0x7fe0, 0x0010), NULL, 0).good()); + ASSERT_TRUE(dicom.GetDcmtkObject().getDataset()->putAndInsertString(DcmTag(0x7fe0, 0x0011), "").good()); + ASSERT_TRUE(dicom.GetDcmtkObject().getDataset()->putAndInsertString(DcmTag(0x7fe1, 0x0000), "").good()); + + { + DicomMap m; + dicom.ExtractDicomSummary(m, 0); + + ASSERT_EQ(10u, m.GetSize()); + ASSERT_TRUE(m.HasTag(DICOM_TAG_MEDIA_STORAGE_SOP_INSTANCE_UID)); + ASSERT_TRUE(m.HasTag(DICOM_TAG_SOP_INSTANCE_UID)); + ASSERT_TRUE(m.HasTag(DICOM_TAG_PATIENT_ID)); + ASSERT_TRUE(m.HasTag(DICOM_TAG_SERIES_INSTANCE_UID)); + ASSERT_TRUE(m.HasTag(DICOM_TAG_STUDY_INSTANCE_UID)); + ASSERT_TRUE(m.HasTag(0x7fe0, 0x0000)); + ASSERT_TRUE(m.HasTag(0x7fe0, 0x0009)); + ASSERT_TRUE(m.HasTag(DICOM_TAG_PIXEL_DATA)); + ASSERT_TRUE(m.HasTag(0x7fe0, 0x0011)); + ASSERT_TRUE(m.HasTag(0x7fe1, 0x0000)); + } + + dicom.RemoveFromPixelData(); + + { + DicomMap m; + dicom.ExtractDicomSummary(m, 0); + + ASSERT_EQ(7u, m.GetSize()); + ASSERT_TRUE(m.HasTag(DICOM_TAG_MEDIA_STORAGE_SOP_INSTANCE_UID)); + ASSERT_TRUE(m.HasTag(DICOM_TAG_SOP_INSTANCE_UID)); + ASSERT_TRUE(m.HasTag(DICOM_TAG_PATIENT_ID)); + ASSERT_TRUE(m.HasTag(DICOM_TAG_SERIES_INSTANCE_UID)); + ASSERT_TRUE(m.HasTag(DICOM_TAG_STUDY_INSTANCE_UID)); + ASSERT_TRUE(m.HasTag(0x7fe0, 0x0000)); + ASSERT_TRUE(m.HasTag(0x7fe0, 0x0009)); + ASSERT_FALSE(m.HasTag(DICOM_TAG_PIXEL_DATA)); + ASSERT_FALSE(m.HasTag(0x7fe0, 0x0011)); + ASSERT_FALSE(m.HasTag(0x7fe1, 0x0000)); + } +} + + TEST(ParsedDicomFile, DISABLED_InjectEmptyPixelData2) { static const char* PIXEL_DATA = "7FE00010";