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") {
30 UpdateWithDimAndPixelType<Dimension, double>();
32 UpdateWithDimAndPixelType<Dimension, float>();
37 template<unsigned int Dimension, class PixelType>
38 void ZeroVFGenericFilter::UpdateWithDimAndPixelType()
40 //Define the image type
41 typedef itk::Vector<PixelType, Dimension> DisplacementType;
42 typedef itk::Image<DisplacementType, Dimension> ImageType;
45 typedef itk::ImageFileReader<ImageType> ImageReaderType;
46 typename ImageReaderType::Pointer reader= ImageReaderType::New();
47 reader->SetFileName(m_InputName);
48 reader->Update(); // not very efficient :-p
49 typename ImageType::Pointer image =reader->GetOutput();
50 DisplacementType zero;
52 image->FillBuffer(zero);
55 typedef itk::ImageFileWriter<ImageType> WriterType;
56 typename WriterType::Pointer writer = WriterType::New();
57 writer->SetFileName(m_OutputName);
58 writer->SetInput(image);