1 /*=========================================================================
2 Program: vv http://www.creatis.insa-lyon.fr/rio/vv
5 - University of LYON http://www.universite-lyon.fr/
6 - Léon Bérard cancer center http://www.centreleonberard.fr
7 - CREATIS CNRS laboratory http://www.creatis.insa-lyon.fr
9 This software is distributed WITHOUT ANY WARRANTY; without even
10 the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
11 PURPOSE. See the copyright notices for more information.
13 It is distributed under dual licence
15 - BSD See included LICENSE.txt file
16 - CeCILL-B http://www.cecill.info/licences/Licence_CeCILL-B_V1-en.html
17 ===========================================================================**/
18 #ifndef __clitkComposeVFGenericFilter_txx
19 #define __clitkComposeVFGenericFilter_txx
20 #include "clitkComposeVFGenericFilter.h"
22 #include "clitkCoeffsToDVF.h"
27 template<unsigned int Dimension>
28 void ComposeVFGenericFilter::UpdateWithDim(std::string PixelType)
30 if (PixelType=="double")
32 UpdateWithDimAndPixelType<Dimension, double>();
36 UpdateWithDimAndPixelType<Dimension, float>();
41 template<unsigned int Dimension, class PixelType>
42 void ComposeVFGenericFilter::UpdateWithDimAndPixelType()
44 typedef itk::Vector<PixelType, Dimension> DisplacementType;
45 typedef itk::Image<DisplacementType, Dimension> ImageType;
46 typename ImageType::Pointer input1, input2;
48 //Define the image type
50 input1 = BLUTCoeffsToDVF<ImageType>(m_InputName1, m_LikeImage, m_Verbose);
51 input2 = BLUTCoeffsToDVF<ImageType>(m_InputName2, m_LikeImage, m_Verbose);
55 typedef itk::ImageFileReader<ImageType> ImageReaderType;
56 typename ImageReaderType::Pointer reader1= ImageReaderType::New();
57 reader1->SetFileName(m_InputName1);
59 input1 =reader1->GetOutput();
62 typename ImageReaderType::Pointer reader2= ImageReaderType::New();
63 reader2->SetFileName(m_InputName2);
65 input2=reader2->GetOutput();
68 //Create the ComposeVFFilter
69 typedef clitk::ComposeVFFilter<ImageType,ImageType> FilterType;
70 typename FilterType::Pointer filter =FilterType::New();
71 filter->SetInput1(input1);
72 filter->SetInput2(input2);
73 filter->SetVerbose(m_Verbose);
77 typedef itk::ImageFileWriter<ImageType> WriterType;
78 typename WriterType::Pointer writer = WriterType::New();
79 writer->SetFileName(m_OutputName);
80 writer->SetInput(filter->GetOutput());