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://oncora1.lyon.fnclcc.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 __clitkZeroVFGenericFilter_txx
19 #define __clitkZeroVFGenericFilter_txx
20 #include "clitkZeroVFGenericFilter.h"
26 template<unsigned int Dimension>
27 void ZeroVFGenericFilter::UpdateWithDim(std::string PixelType)
29 if (PixelType=="double")
31 UpdateWithDimAndPixelType<Dimension, double>();
35 UpdateWithDimAndPixelType<Dimension, float>();
40 template<unsigned int Dimension, class PixelType>
41 void ZeroVFGenericFilter::UpdateWithDimAndPixelType()
43 //Define the image type
44 typedef itk::Vector<PixelType, Dimension> DisplacementType;
45 typedef itk::Image<DisplacementType, Dimension> ImageType;
48 typedef itk::ImageFileReader<ImageType> ImageReaderType;
49 typename ImageReaderType::Pointer reader= ImageReaderType::New();
50 reader->SetFileName(m_InputName);
51 reader->Update(); // not very efficient :-p
52 typename ImageType::Pointer image =reader->GetOutput();
53 DisplacementType zero;
55 image->FillBuffer(zero);
58 typedef itk::ImageFileWriter<ImageType> WriterType;
59 typename WriterType::Pointer writer = WriterType::New();
60 writer->SetFileName(m_OutputName);
61 writer->SetInput(image);