From 54887f7e9b2a9a6344ab4c68da8312bf12f68105 Mon Sep 17 00:00:00 2001 From: Ziv Yaniv Date: Tue, 5 May 2026 15:52:20 -0400 Subject: [PATCH 1/6] ENH: add missing metadata to DCMTKImageIO The DCMTKImageIO was not updating the metadata dictionary resulting in empty metadata when reading DICOM files. This commit adds the missing code to update the metadata dictionary with the DICOM tags read from the file. Note that tags that are part of a DICOM sequence are skipped due to the flat nature of the metadata dictionary. Encoding DICOM sequences requires supporting a heirarchical structure in the metadata dictionary which is not straightforward. This omission is consistent with the GDCMImageIO behavior. Possibly address in the future. --- Modules/IO/DCMTK/include/itkDCMTKFileReader.h | 6 ++ Modules/IO/DCMTK/src/itkDCMTKImageIO.cxx | 59 ++++++++++++++ Modules/IO/DCMTK/test/CMakeLists.txt | 9 +++ .../test/itkDCMTKImageIOMetadataTest.cxx | 76 +++++++++++++++++++ 4 files changed, 150 insertions(+) create mode 100644 Modules/IO/DCMTK/test/itkDCMTKImageIOMetadataTest.cxx diff --git a/Modules/IO/DCMTK/include/itkDCMTKFileReader.h b/Modules/IO/DCMTK/include/itkDCMTKFileReader.h index 299283c1f67..dc6b86ff143 100644 --- a/Modules/IO/DCMTK/include/itkDCMTKFileReader.h +++ b/Modules/IO/DCMTK/include/itkDCMTKFileReader.h @@ -498,6 +498,12 @@ class ITKIODCMTK_EXPORT DCMTKFileReader static bool IsImageFile(const std::string & filename); + DcmDataset * + GetDataset() const + { + return m_Dataset; + } + private: std::string m_FileName; DcmFileFormat * m_DFile{ nullptr }; diff --git a/Modules/IO/DCMTK/src/itkDCMTKImageIO.cxx b/Modules/IO/DCMTK/src/itkDCMTKImageIO.cxx index d1bb903c382..74f832e11d0 100644 --- a/Modules/IO/DCMTK/src/itkDCMTKImageIO.cxx +++ b/Modules/IO/DCMTK/src/itkDCMTKImageIO.cxx @@ -21,15 +21,18 @@ #include "itkByteSwapper.h" #include "itksys/SystemTools.hxx" #include "itkDCMTKFileReader.h" +#include "itkMetaDataObject.h" #include #include "vnl/vnl_cross.h" #include "itkMath.h" +#include "itksys/Base64.h" #include "dcmtk/dcmimgle/dcmimage.h" #include "dcmtk/dcmjpeg/djdecode.h" #include "dcmtk/dcmjpls/djdecode.h" #include "dcmtk/dcmdata/dcmetinf.h" #include "dcmtk/dcmdata/dcrledrg.h" +#include "dcmtk/dcmdata/dcelem.h" #include "dcmtk/oflog/oflog.h" namespace @@ -478,6 +481,62 @@ DCMTKImageIO::ReadImageInformation() this->m_Spacing.push_back(1.0); } + // Populate the metadata dictionary with all DICOM tag values + MetaDataDictionary & dict = this->GetMetaDataDictionary(); + dict.Clear(); + DcmDataset * dataset = reader.GetDataset(); + if (dataset != nullptr) + { + const unsigned long numElements = dataset->card(); + for (unsigned long i = 0; i < numElements; ++i) + { + DcmElement * element = dataset->getElement(i); + if (element == nullptr) + { + continue; + } + const DcmTag & tag = element->getTag(); + // Skip pixel data (7FE0,0010) + if (tag.getGroup() == 0x7fe0 && tag.getElement() == 0x0010) + { + continue; + } + // Format key as "GGGG|EEEE" (lowercase hex, matching GDCMImageIO) + char key[10]; + std::snprintf(key, sizeof(key), "%04x|%04x", tag.getGroup(), tag.getElement()); + + const DcmEVR vr = element->getVR(); + if (vr == EVR_SQ || vr == EVR_OB || vr == EVR_OW || vr == EVR_OF || vr == EVR_UN || vr == EVR_ox || vr == EVR_px) + { + // Binary VR — base64-encode the raw bytes + Uint8 * byteValue = nullptr; + if (element->getUint8Array(byteValue) == EC_Normal && byteValue != nullptr) + { + const Uint32 length = element->getLength(); + if (length > 0) + { + int encodedLengthEstimate = 2 * static_cast(length); + encodedLengthEstimate = ((encodedLengthEstimate / 4) + 1) * 4; + const auto bin = std::make_unique(encodedLengthEstimate); + const auto encodedLengthActual = + static_cast(itksysBase64_Encode(reinterpret_cast(byteValue), + static_cast(length), + reinterpret_cast(bin.get()), + 0)); + EncapsulateMetaData(dict, key, std::string(bin.get(), encodedLengthActual)); + } + } + } + else + { + OFString value; + if (element->getOFStringArray(value) == EC_Normal) + { + EncapsulateMetaData(dict, key, std::string(value.c_str())); + } + } + } + } this->OpenDicomImage(); const DiPixel * interData = this->m_DImage->getInterData(); diff --git a/Modules/IO/DCMTK/test/CMakeLists.txt b/Modules/IO/DCMTK/test/CMakeLists.txt index 9251879a44b..cd6f69dd047 100644 --- a/Modules/IO/DCMTK/test/CMakeLists.txt +++ b/Modules/IO/DCMTK/test/CMakeLists.txt @@ -2,6 +2,7 @@ itk_module_test() set( ITKIODCMTKTests itkDCMTKGetDicomTagsTest.cxx + itkDCMTKImageIOMetadataTest.cxx itkDCMTKImageIOMultiFrameImageTest.cxx itkDCMTKImageIONoPreambleTest.cxx itkDCMTKImageIOOrthoDirTest.cxx @@ -82,6 +83,14 @@ itk_add_test( ${ITK_TEST_OUTPUT_DIR}/DICOMTags.txt ) +itk_add_test( + NAME itkDCMTKImageIOMetadataTest + COMMAND + ITKIODCMTKTestDriver + itkDCMTKImageIOMetadataTest + DATA{${ITK_DATA_ROOT}/Input/DicomSeries/Image0075.dcm} +) + itk_add_test( NAME itkDCMTKImageIOTest1 COMMAND diff --git a/Modules/IO/DCMTK/test/itkDCMTKImageIOMetadataTest.cxx b/Modules/IO/DCMTK/test/itkDCMTKImageIOMetadataTest.cxx new file mode 100644 index 00000000000..d81a4baa44a --- /dev/null +++ b/Modules/IO/DCMTK/test/itkDCMTKImageIOMetadataTest.cxx @@ -0,0 +1,76 @@ +/*========================================================================= + * + * Copyright NumFOCUS + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0.txt + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + *=========================================================================*/ + +#include "itkDCMTKImageIO.h" +#include "itkMetaDataObject.h" +#include "itkTestingMacros.h" + +#include + +// Tests that DCMTKImageIO::ReadImageInformation() populates the metadata +// dictionary with DICOM tag values using "GGGG|EEEE" keys (lowercase +// matching GDCMImageIO behavior). Expected values are verified against +// Input/DicomSeries/Image0075.dcm using the same fixture as +// itkDCMTKGetDicomTagsTest. +int +itkDCMTKImageIOMetadataTest(int argc, char * argv[]) +{ + if (argc != 2) + { + std::cerr << "Missing parameters." << std::endl; + std::cerr << "Usage: " << itkNameOfTestExecutableMacro(argv) << " " << std::endl; + return EXIT_FAILURE; + } + + auto dcmtkIO = itk::DCMTKImageIO::New(); + + ITK_TEST_EXPECT_TRUE(dcmtkIO->CanReadFile(argv[1])); + dcmtkIO->SetFileName(argv[1]); + ITK_TRY_EXPECT_NO_EXCEPTION(dcmtkIO->ReadImageInformation()); + + const itk::MetaDataDictionary & dict = dcmtkIO->GetMetaDataDictionary(); + + // Dictionary must be populated + ITK_TEST_EXPECT_TRUE(!dict.GetKeys().empty()); + + // Pixel data (7FE0,0010) must NOT appear in the dictionary + ITK_TEST_EXPECT_TRUE(!dict.HasKey("7fe0|0010")); + + // Verify string-valued DICOM tags using the "GGGG|EEEE" key format. + // Values are specific to the test file Input/DicomSeries/Image0075.dcm + std::string value; + + // (0008,0021) DA StudyDate + ITK_TEST_EXPECT_TRUE(itk::ExposeMetaData(dict, "0008|0021", value)); + ITK_TEST_EXPECT_EQUAL(value, std::string("20030625")); + + // (0010,0010) PN PatientName + ITK_TEST_EXPECT_TRUE(itk::ExposeMetaData(dict, "0010|0010", value)); + ITK_TEST_EXPECT_EQUAL(value, std::string("Wes Turner")); + + // (0010,0040) CS PatientSex + ITK_TEST_EXPECT_TRUE(itk::ExposeMetaData(dict, "0010|0040", value)); + ITK_TEST_EXPECT_EQUAL(value, std::string("O")); + + // (0028,0004) CS PhotometricInterpretation + ITK_TEST_EXPECT_TRUE(itk::ExposeMetaData(dict, "0028|0004", value)); + ITK_TEST_EXPECT_EQUAL(value, std::string("MONOCHROME2")); + + std::cout << "Test finished." << std::endl; + return EXIT_SUCCESS; +} From f5a977cf496da54b4df59695baecdbc502cb7ff0 Mon Sep 17 00:00:00 2001 From: "Hans J. Johnson" Date: Tue, 5 May 2026 16:59:53 -0500 Subject: [PATCH 2/6] BUG: Cover EVR_OD/EVR_OL/EVR_OV in DCMTK binary VR base64 path DICOM Supplements 172/173 added the OD, OL, and OV bulk-data VRs. Add them to the binary-VR check in DCMTKImageIO so values reach the base64 encoder instead of falling through to the text getOFStringArray branch (which silently drops them). --- Modules/IO/DCMTK/src/itkDCMTKImageIO.cxx | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Modules/IO/DCMTK/src/itkDCMTKImageIO.cxx b/Modules/IO/DCMTK/src/itkDCMTKImageIO.cxx index 74f832e11d0..83e736655ad 100644 --- a/Modules/IO/DCMTK/src/itkDCMTKImageIO.cxx +++ b/Modules/IO/DCMTK/src/itkDCMTKImageIO.cxx @@ -506,7 +506,8 @@ DCMTKImageIO::ReadImageInformation() std::snprintf(key, sizeof(key), "%04x|%04x", tag.getGroup(), tag.getElement()); const DcmEVR vr = element->getVR(); - if (vr == EVR_SQ || vr == EVR_OB || vr == EVR_OW || vr == EVR_OF || vr == EVR_UN || vr == EVR_ox || vr == EVR_px) + if (vr == EVR_SQ || vr == EVR_OB || vr == EVR_OW || vr == EVR_OF || vr == EVR_OD || vr == EVR_OL || + vr == EVR_OV || vr == EVR_UN || vr == EVR_ox || vr == EVR_px) { // Binary VR — base64-encode the raw bytes Uint8 * byteValue = nullptr; From 17a89dbd6a2490497ce90bc855a3c3ff2bf6f2f3 Mon Sep 17 00:00:00 2001 From: "Hans J. Johnson" Date: Tue, 5 May 2026 16:59:56 -0500 Subject: [PATCH 3/6] STYLE: Correct DICOM tag comment (0008,0021) is SeriesDate MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Tag (0008,0021) is SeriesDate; StudyDate is (0008,0020). Test assertion was already against the right tag number — only the comment was misleading. --- Modules/IO/DCMTK/test/itkDCMTKImageIOMetadataTest.cxx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Modules/IO/DCMTK/test/itkDCMTKImageIOMetadataTest.cxx b/Modules/IO/DCMTK/test/itkDCMTKImageIOMetadataTest.cxx index d81a4baa44a..c9f33a104e2 100644 --- a/Modules/IO/DCMTK/test/itkDCMTKImageIOMetadataTest.cxx +++ b/Modules/IO/DCMTK/test/itkDCMTKImageIOMetadataTest.cxx @@ -55,7 +55,7 @@ itkDCMTKImageIOMetadataTest(int argc, char * argv[]) // Values are specific to the test file Input/DicomSeries/Image0075.dcm std::string value; - // (0008,0021) DA StudyDate + // (0008,0021) DA SeriesDate ITK_TEST_EXPECT_TRUE(itk::ExposeMetaData(dict, "0008|0021", value)); ITK_TEST_EXPECT_EQUAL(value, std::string("20030625")); From bc4415a10e4379423d133e6969865dc1505e22c6 Mon Sep 17 00:00:00 2001 From: "Hans J. Johnson" Date: Tue, 5 May 2026 17:23:16 -0500 Subject: [PATCH 4/6] STYLE: Drop misleading const on DCMTKFileReader::GetDataset The accessor returns the raw mutable DcmDataset *, so a const-qualified method would let callers mutate dataset state through a const reference. Drop the const to match the returned-pointer mutability. --- Modules/IO/DCMTK/include/itkDCMTKFileReader.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Modules/IO/DCMTK/include/itkDCMTKFileReader.h b/Modules/IO/DCMTK/include/itkDCMTKFileReader.h index dc6b86ff143..e373439d2a1 100644 --- a/Modules/IO/DCMTK/include/itkDCMTKFileReader.h +++ b/Modules/IO/DCMTK/include/itkDCMTKFileReader.h @@ -499,7 +499,7 @@ class ITKIODCMTK_EXPORT DCMTKFileReader IsImageFile(const std::string & filename); DcmDataset * - GetDataset() const + GetDataset() { return m_Dataset; } From b99df555e173221bfbb45c9a2fedf5de9fc1b8b9 Mon Sep 17 00:00:00 2001 From: "Hans J. Johnson" Date: Tue, 5 May 2026 17:23:21 -0500 Subject: [PATCH 5/6] BUG: Skip EVR_SQ in DCMTKImageIO metadata loop Sequences are nested datasets; getUint8Array() does not produce their content, so they were silently dropped from the dictionary. Match GDCMImageIO and skip them explicitly. --- Modules/IO/DCMTK/src/itkDCMTKImageIO.cxx | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/Modules/IO/DCMTK/src/itkDCMTKImageIO.cxx b/Modules/IO/DCMTK/src/itkDCMTKImageIO.cxx index 83e736655ad..0c9c9343edf 100644 --- a/Modules/IO/DCMTK/src/itkDCMTKImageIO.cxx +++ b/Modules/IO/DCMTK/src/itkDCMTKImageIO.cxx @@ -506,8 +506,14 @@ DCMTKImageIO::ReadImageInformation() std::snprintf(key, sizeof(key), "%04x|%04x", tag.getGroup(), tag.getElement()); const DcmEVR vr = element->getVR(); - if (vr == EVR_SQ || vr == EVR_OB || vr == EVR_OW || vr == EVR_OF || vr == EVR_OD || vr == EVR_OL || - vr == EVR_OV || vr == EVR_UN || vr == EVR_ox || vr == EVR_px) + if (vr == EVR_SQ) + { + // Sequences are nested datasets, not byte arrays; getUint8Array() does + // not return their content. Skip rather than emit an empty entry. + continue; + } + if (vr == EVR_OB || vr == EVR_OW || vr == EVR_OF || vr == EVR_OD || vr == EVR_OL || vr == EVR_OV || + vr == EVR_UN || vr == EVR_ox || vr == EVR_px) { // Binary VR — base64-encode the raw bytes Uint8 * byteValue = nullptr; From 394306614d5889e83493022d410464adeb3f6de7 Mon Sep 17 00:00:00 2001 From: "Hans J. Johnson" Date: Wed, 6 May 2026 14:09:09 -0500 Subject: [PATCH 6/6] COMP: Encapsulate DCMTK metadata loop in DCMTKFileReader Move the metadata-population loop into DCMTKFileReader::PopulateMetaDataDictionary so DcmDataset never escapes the reader. Per @blowekamp review. --- Modules/IO/DCMTK/include/itkDCMTKFileReader.h | 8 +-- Modules/IO/DCMTK/src/itkDCMTKFileReader.cxx | 70 +++++++++++++++++++ Modules/IO/DCMTK/src/itkDCMTKImageIO.cxx | 67 +----------------- 3 files changed, 74 insertions(+), 71 deletions(-) diff --git a/Modules/IO/DCMTK/include/itkDCMTKFileReader.h b/Modules/IO/DCMTK/include/itkDCMTKFileReader.h index e373439d2a1..d8e5385ea38 100644 --- a/Modules/IO/DCMTK/include/itkDCMTKFileReader.h +++ b/Modules/IO/DCMTK/include/itkDCMTKFileReader.h @@ -35,6 +35,7 @@ #include "dcmtk/dcmdata/dcsequen.h" #include "itkMacro.h" #include "itkImageIOBase.h" +#include "itkMetaDataDictionary.h" class DcmSequenceOfItems; class DcmFileFormat; @@ -498,11 +499,8 @@ class ITKIODCMTK_EXPORT DCMTKFileReader static bool IsImageFile(const std::string & filename); - DcmDataset * - GetDataset() - { - return m_Dataset; - } + void + PopulateMetaDataDictionary(MetaDataDictionary & dict) const; private: std::string m_FileName; diff --git a/Modules/IO/DCMTK/src/itkDCMTKFileReader.cxx b/Modules/IO/DCMTK/src/itkDCMTKFileReader.cxx index c41762f7d9e..79a855f5474 100644 --- a/Modules/IO/DCMTK/src/itkDCMTKFileReader.cxx +++ b/Modules/IO/DCMTK/src/itkDCMTKFileReader.cxx @@ -33,6 +33,7 @@ #include "dcmtk/dcmdata/dcvrus.h" /* for DcmUnsignedShort */ #include "dcmtk/dcmdata/dcvris.h" /* for DcmIntegerString */ #include "dcmtk/dcmdata/dcvrobow.h" /* for DcmOtherByteOtherWord */ +#include "dcmtk/dcmdata/dcelem.h" /* for DcmElement */ #include "dcmtk/dcmdata/dcvrui.h" /* for DcmUniqueIdentifier */ #include "dcmtk/dcmdata/dcfilefo.h" /* for DcmFileFormat */ #include "dcmtk/dcmdata/dcmetinf.h" /* for DcmMetaInfo */ @@ -47,7 +48,10 @@ #include "vnl/vnl_cross.h" #include "itkIntTypes.h" +#include "itkMetaDataObject.h" +#include "itksys/Base64.h" #include +#include namespace itk { @@ -1369,6 +1373,72 @@ DCMTKFileReader::GetFileNumber() const return m_FileNumber; } +void +DCMTKFileReader::PopulateMetaDataDictionary(MetaDataDictionary & dict) const +{ + dict.Clear(); + if (m_Dataset == nullptr) + { + return; + } + const unsigned long numElements = m_Dataset->card(); + for (unsigned long i = 0; i < numElements; ++i) + { + DcmElement * element = m_Dataset->getElement(i); + if (element == nullptr) + { + continue; + } + const DcmTag & tag = element->getTag(); + // Skip pixel data (7FE0,0010) + if (tag.getGroup() == 0x7fe0 && tag.getElement() == 0x0010) + { + continue; + } + // Format key as "GGGG|EEEE" (lowercase hex, matching GDCMImageIO) + char key[10]; + std::snprintf(key, sizeof(key), "%04x|%04x", tag.getGroup(), tag.getElement()); + + const DcmEVR vr = element->getVR(); + if (vr == EVR_SQ) + { + // Sequences are nested datasets, not byte arrays; getUint8Array() does + // not return their content. Skip rather than emit an empty entry. + continue; + } + if (vr == EVR_OB || vr == EVR_OW || vr == EVR_OF || vr == EVR_OD || vr == EVR_OL || vr == EVR_OV || vr == EVR_UN || + vr == EVR_ox || vr == EVR_px) + { + // Binary VR — base64-encode the raw bytes + Uint8 * byteValue = nullptr; + if (element->getUint8Array(byteValue) == EC_Normal && byteValue != nullptr) + { + const Uint32 length = element->getLength(); + if (length > 0) + { + int encodedLengthEstimate = 2 * static_cast(length); + encodedLengthEstimate = ((encodedLengthEstimate / 4) + 1) * 4; + const auto bin = std::make_unique(encodedLengthEstimate); + const auto encodedLengthActual = + static_cast(itksysBase64_Encode(reinterpret_cast(byteValue), + static_cast(length), + reinterpret_cast(bin.get()), + 0)); + EncapsulateMetaData(dict, key, std::string(bin.get(), encodedLengthActual)); + } + } + } + else + { + OFString value; + if (element->getOFStringArray(value) == EC_Normal) + { + EncapsulateMetaData(dict, key, std::string(value.c_str())); + } + } + } +} + void DCMTKFileReader::AddDictEntry(DcmDictEntry * entry) { diff --git a/Modules/IO/DCMTK/src/itkDCMTKImageIO.cxx b/Modules/IO/DCMTK/src/itkDCMTKImageIO.cxx index 0c9c9343edf..1fa5ad70888 100644 --- a/Modules/IO/DCMTK/src/itkDCMTKImageIO.cxx +++ b/Modules/IO/DCMTK/src/itkDCMTKImageIO.cxx @@ -21,18 +21,15 @@ #include "itkByteSwapper.h" #include "itksys/SystemTools.hxx" #include "itkDCMTKFileReader.h" -#include "itkMetaDataObject.h" #include #include "vnl/vnl_cross.h" #include "itkMath.h" -#include "itksys/Base64.h" #include "dcmtk/dcmimgle/dcmimage.h" #include "dcmtk/dcmjpeg/djdecode.h" #include "dcmtk/dcmjpls/djdecode.h" #include "dcmtk/dcmdata/dcmetinf.h" #include "dcmtk/dcmdata/dcrledrg.h" -#include "dcmtk/dcmdata/dcelem.h" #include "dcmtk/oflog/oflog.h" namespace @@ -481,69 +478,7 @@ DCMTKImageIO::ReadImageInformation() this->m_Spacing.push_back(1.0); } - // Populate the metadata dictionary with all DICOM tag values - MetaDataDictionary & dict = this->GetMetaDataDictionary(); - dict.Clear(); - DcmDataset * dataset = reader.GetDataset(); - if (dataset != nullptr) - { - const unsigned long numElements = dataset->card(); - for (unsigned long i = 0; i < numElements; ++i) - { - DcmElement * element = dataset->getElement(i); - if (element == nullptr) - { - continue; - } - const DcmTag & tag = element->getTag(); - // Skip pixel data (7FE0,0010) - if (tag.getGroup() == 0x7fe0 && tag.getElement() == 0x0010) - { - continue; - } - // Format key as "GGGG|EEEE" (lowercase hex, matching GDCMImageIO) - char key[10]; - std::snprintf(key, sizeof(key), "%04x|%04x", tag.getGroup(), tag.getElement()); - - const DcmEVR vr = element->getVR(); - if (vr == EVR_SQ) - { - // Sequences are nested datasets, not byte arrays; getUint8Array() does - // not return their content. Skip rather than emit an empty entry. - continue; - } - if (vr == EVR_OB || vr == EVR_OW || vr == EVR_OF || vr == EVR_OD || vr == EVR_OL || vr == EVR_OV || - vr == EVR_UN || vr == EVR_ox || vr == EVR_px) - { - // Binary VR — base64-encode the raw bytes - Uint8 * byteValue = nullptr; - if (element->getUint8Array(byteValue) == EC_Normal && byteValue != nullptr) - { - const Uint32 length = element->getLength(); - if (length > 0) - { - int encodedLengthEstimate = 2 * static_cast(length); - encodedLengthEstimate = ((encodedLengthEstimate / 4) + 1) * 4; - const auto bin = std::make_unique(encodedLengthEstimate); - const auto encodedLengthActual = - static_cast(itksysBase64_Encode(reinterpret_cast(byteValue), - static_cast(length), - reinterpret_cast(bin.get()), - 0)); - EncapsulateMetaData(dict, key, std::string(bin.get(), encodedLengthActual)); - } - } - } - else - { - OFString value; - if (element->getOFStringArray(value) == EC_Normal) - { - EncapsulateMetaData(dict, key, std::string(value.c_str())); - } - } - } - } + reader.PopulateMetaDataDictionary(this->GetMetaDataDictionary()); this->OpenDicomImage(); const DiPixel * interData = this->m_DImage->getInterData();