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 clitkSumGenericFilter_txx
19 #define clitkSumGenericFilter_txx
22 #include <itkSumProjectionImageFilter.h>
23 #include <clitkCommon.h>
28 //--------------------------------------------------------------------
29 template<class args_info_type>
30 SumGenericFilter<args_info_type>::SumGenericFilter():
31 ImageToImageGenericFilter<Self>("Sum")
33 InitializeImageType<3>();
34 InitializeImageType<4>();
36 //--------------------------------------------------------------------
39 //--------------------------------------------------------------------
40 template<class args_info_type>
41 template<unsigned int Dim>
42 void SumGenericFilter<args_info_type>::InitializeImageType()
44 ADD_DEFAULT_IMAGE_TYPES(Dim);
46 //--------------------------------------------------------------------
49 //--------------------------------------------------------------------
50 template<class args_info_type>
51 void SumGenericFilter<args_info_type>::SetArgsInfo(const args_info_type & a)
54 this->SetIOVerbose(mArgsInfo.verbose_flag);
55 if (mArgsInfo.imagetypes_flag) this->PrintAvailableImageTypes();
57 if (mArgsInfo.input_given) {
58 this->SetInputFilename(mArgsInfo.input_arg);
60 if (mArgsInfo.output_given) {
61 this->SetOutputFilename(mArgsInfo.output_arg);
64 //--------------------------------------------------------------------
66 //--------------------------------------------------------------------
67 // Update with the number of dimensions and the pixeltype
68 //--------------------------------------------------------------------
69 template<class args_info_type>
70 template<class InputImageType>
72 SumGenericFilter<args_info_type>::UpdateWithInputImageType()
76 typename InputImageType::Pointer input = this->template GetInput<InputImageType>(0);
79 typedef typename InputImageType::PixelType PixelType;
80 const int Dim = InputImageType::ImageDimension;
81 typedef itk::Image<PixelType,Dim> ImageType;
82 typedef itk::Image<PixelType,Dim-1> OutputImageType;
85 typedef itk::SumProjectionImageFilter<ImageType,OutputImageType> FilterType;
86 typename FilterType::Pointer filter = FilterType::New();
87 filter->SetProjectionDimension(mArgsInfo.dimension_arg);
88 filter->SetInput(input);
90 this->template SetNextOutput<OutputImageType>(filter->GetOutput());
92 //--------------------------------------------------------------------
97 #endif //#define clitkSumGenericFilter_txx