#include "itkParticleSwarmOptimizerSAXReader.h"
#include "itkParticleSwarmOptimizerSAXWriter.h"
#include "itkParticleSwarmOptimizerDOMReader.h"
#include "itkParticleSwarmOptimizerDOMWriter.h"
#include <iostream>
int main( int argc, char* argv[] )
{
if ( argc < 4 )
{
std::cerr << "arguments expected: test-input.pso.xml test-output-DOM.pso.xml test-output-SAX.pso.xml" << std::endl;
return EXIT_FAILURE;
}
try
{
{
itk::ParticleSwarmOptimizerDOMReader::Pointer reader = itk::ParticleSwarmOptimizerDOMReader::New();
reader->SetFileName( argv[1] );
reader->Update();
optimizer = reader->GetOutput();
itk::ParticleSwarmOptimizerDOMWriter::Pointer writer = itk::ParticleSwarmOptimizerDOMWriter::New();
writer->SetInput( optimizer );
writer->SetFileName( argv[2] );
writer->Update();
}
{
itk::ParticleSwarmOptimizerSAXReader::Pointer reader = itk::ParticleSwarmOptimizerSAXReader::New();
reader->SetOutputObject( optimizer );
reader->SetFilename( argv[1] );
reader->ReadFile();
itk::ParticleSwarmOptimizerSAXWriter::Pointer writer = itk::ParticleSwarmOptimizerSAXWriter::New();
writer->SetObject( optimizer );
writer->SetFilename( argv[3] );
writer->WriteFile();
}
}
{
return EXIT_FAILURE;
}
catch ( ... )
{
std::cerr << "Unknown exception caught!" << std::endl;
return EXIT_FAILURE;
}
return EXIT_SUCCESS;
}