Skip to content

Commit 5d31af3

Browse files
authored
Merge pull request InsightSoftwareConsortium#6926 from hjmjohnson/enh-mrc-test-print-all-metadata
ENH: Print full metadata value in MRC IO test
2 parents acd3617 + fb52f25 commit 5d31af3

1 file changed

Lines changed: 4 additions & 13 deletions

File tree

‎Modules/IO/MRC/test/itkMRCImageIOTest2.cxx‎

Lines changed: 4 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,6 @@ Test(const std::string & inFileName, const std::string & outFileName, const std:
4444
const typename ImageType::Pointer image = reader->GetOutput();
4545

4646
using DictionaryType = itk::MetaDataDictionary;
47-
using MetaDataStringType = itk::MetaDataObject<std::string>;
4847

4948
// prepare to iterate over the dictionary
5049
DictionaryType & dic = image->GetMetaDataDictionary();
@@ -72,18 +71,10 @@ Test(const std::string & inFileName, const std::string & outFileName, const std:
7271
}
7372
else
7473
{
75-
// just print the strings now
76-
const itk::MetaDataObjectBase::Pointer entry = itr->second;
77-
78-
const MetaDataStringType::Pointer entryvalue = dynamic_cast<MetaDataStringType *>(entry.GetPointer());
79-
if (entryvalue)
80-
{
81-
82-
const std::string tagvalue = entryvalue->GetMetaDataObjectValue();
83-
84-
std::cout << '(' << key << ") ";
85-
std::cout << " = " << tagvalue << std::endl;
86-
}
74+
// MetaDataObjectBase::Print dispatches to the value's own Print/operator<<.
75+
std::cout << '(' << key << ") = ";
76+
itr->second->Print(std::cout);
77+
std::cout << std::endl;
8778
}
8879
++itr;
8980
}

0 commit comments

Comments
 (0)