int
main(int argc, char * argv[])
{
if (argc < 2)
{
std::cerr << "Usage: " << argv[0] << " transformFile" << std::endl;
return EXIT_FAILURE;
}
const char * transformFileName = argv[1];
using ScalarType = double;
using CompositeTransformType =
auto cor = itk::MakeFilled<AffineTransformType::InputPointType>(12);
affine->SetCenter(cor);
composite->AddTransform(affine);
constexpr unsigned int SplineOrder = 5;
using BSplineTransformType =
using BSplineTransformFType =
auto origin = itk::MakeFilled<BSplineTransformType::OriginType>(100);
auto dimensions =
itk::MakeFilled<BSplineTransformType::PhysicalDimensionsType>(1.5 * 9.0);
bspline->SetTransformDomainOrigin(origin);
bspline->SetTransformDomainPhysicalDimensions(dimensions);
const BSplineTransformType::ParametersType parameters(
bspline->GetNumberOfParameters());
bspline->SetParameters(parameters);
bspline->SetIdentity();
composite->AddTransform(bspline);
writer->SetInput(composite);
writer->SetFileName(transformFileName);
try
{
writer->Update();
}
{
std::cerr << "Error while saving the transforms" << std::endl;
std::cerr << excp << std::endl;
return EXIT_FAILURE;
}
using ReadScalarType = float;
using TransformReaderType =
reader->SetFileName(transformFileName);
try
{
reader->Update();
}
{
std::cerr << "Error while reading the transform file" << std::endl;
std::cerr << excp << std::endl;
std::cerr << "[FAILED]" << std::endl;
return EXIT_FAILURE;
}
const TransformReaderType::TransformListType * transforms =
reader->GetTransformList();
std::cout << "Number of transforms = " << transforms->size() << std::endl;
using ReadCompositeTransformType =
auto it = transforms->begin();
if (!strcmp((*it)->GetNameOfClass(), "CompositeTransform"))
{
static_cast<ReadCompositeTransformType *>((*it).GetPointer());
compositeRead->
Print(std::cout);
}
return EXIT_SUCCESS;
}