#include <list>
#include <fstream>
int
main(int argc, char * argv[])
{
if (argc < 5)
{
std::cerr << "Usage: " << argv[0]
<< " DicomImage OutputDicomImage Entry Value\n";
return EXIT_FAILURE;
}
using InputPixelType = short;
reader->SetFileName(argv[1]);
reader->SetImageIO(gdcmImageIO);
try
{
reader->Update();
}
{
std::cerr << "exception in file reader " << std::endl;
std::cerr <<
e.GetDescription() << std::endl;
std::cerr <<
e.GetLocation() << std::endl;
return EXIT_FAILURE;
}
DictionaryType & dictionary = inputImage->GetMetaDataDictionary();
for (int i = 3; i < argc; i += 2)
{
const std::string entryId(argv[i]);
const std::string value(argv[i + 1]);
itk::EncapsulateMetaData<std::string>(dictionary, entryId, value);
}
writer1->SetInput(reader->GetOutput());
writer1->SetFileName(argv[2]);
writer1->SetImageIO(gdcmImageIO);
try
{
writer1->Update();
}
{
std::cerr << "exception in file writer " << std::endl;
std::cerr <<
e.GetDescription() << std::endl;
std::cerr <<
e.GetLocation() << std::endl;
return EXIT_FAILURE;
}
return EXIT_SUCCESS;
}