1 #include "clitkCoeffsToDVF_ggo.h"
2 #include "clitkCoeffsToDVF.h"
4 #include "itkImageFileWriter.h"
5 #include "itkImageIOFactory.h"
8 template <class DisplacementFieldType>
10 Write(typename DisplacementFieldType::Pointer dvf, std::string fileName)
12 typedef itk::ImageFileWriter<DisplacementFieldType> ImageWriterType;
13 typename ImageWriterType::Pointer writer = ImageWriterType::New();
14 writer->SetFileName(fileName);
15 writer->SetInput(dvf);
19 int main(int argc, char** argv)
21 GGO(clitkCoeffsToDVF, args_info);
24 typename itk::ImageIOBase::Pointer image_io = itk::ImageIOFactory::CreateImageIO(args_info.input_arg, itk::ImageIOFactory::ReadMode);
25 image_io->SetFileName(args_info.input_arg);
26 image_io->ReadImageInformation();
28 unsigned int ndim = image_io->GetNumberOfDimensions();
32 unsigned const dim = 2;
33 typedef itk::Vector<double, dim> PixelType;
34 typedef itk::Image<PixelType, dim> DVFType;
35 typename DVFType::Pointer dvf = clitk::BLUTCoeffsToDVF<DVFType>(args_info.input_arg, args_info.like_arg);
36 Write<DVFType>(dvf, args_info.output_arg);
42 unsigned const dim = 3;
43 typedef itk::Vector<double, dim> PixelType;
44 typedef itk::Image<PixelType, dim> DVFType;
45 typename DVFType::Pointer dvf = clitk::BLUTCoeffsToDVF<DVFType>(args_info.input_arg, args_info.like_arg);
46 Write<DVFType>(dvf, args_info.output_arg);
51 std::cerr << "Unsupported image dimension (either 2 or 3)" << std::endl;