static void
CreateImage(ImageType::Pointer image);
int
main(int, char *[])
{
ImageType::Pointer image = ImageType::New();
CreateImage(image);
itk::EncapsulateMetaData<float>(dictionary, "ASimpleFloat", 1.2);
image->SetMetaDataDictionary(dictionary);
dictionary.
Print(std::cout);
auto itr = dictionary.
Begin();
while (itr != dictionary.
End())
{
std::cout << "Key = " << itr->first << std::endl;
std::cout << "Value = ";
itr->second->Print(std::cout);
std::cout << std::endl;
++itr;
}
WriterType::Pointer writer = WriterType::New();
writer->SetFileName("test.mhd");
writer->SetInput(image);
writer->Update();
ReaderType::Pointer reader = ReaderType::New();
reader->SetFileName("test.mhd");
std::cout << "Data read from file:" << std::endl;
reader->GetMetaDataDictionary().Print(std::cout);
return EXIT_SUCCESS;
}
void
CreateImage(ImageType::Pointer image)
{
region.SetIndex(start);
image->SetRegions(region);
image->Allocate();
while (!imageIterator.IsAtEnd())
{
++imageIterator;
}
}