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 clitkMIPGenericFilter_cxx
19 #define clitkMIPGenericFilter_cxx
21 /* =================================================
22 * @file clitkMIPGenericFilter.cxx
23 * @author Jef Vandemeulebroucke <jef@creatis.insa-lyon.fr>
28 ===================================================*/
30 #include "clitkMIPGenericFilter.h"
34 #include <itkMaximumProjectionImageFilter.h>
36 #include <clitkCommon.h>
41 //--------------------------------------------------------------------
42 MIPGenericFilter::MIPGenericFilter():
43 ImageToImageGenericFilter<Self>("MIP")
45 InitializeImageType<3>();
46 InitializeImageType<4>();
48 //--------------------------------------------------------------------
51 //--------------------------------------------------------------------
52 template<unsigned int Dim>
53 void MIPGenericFilter::InitializeImageType()
55 ADD_DEFAULT_IMAGE_TYPES(Dim);
57 //--------------------------------------------------------------------
60 //--------------------------------------------------------------------
61 void MIPGenericFilter::SetArgsInfo(const args_info_type & a)
64 SetIOVerbose(mArgsInfo.verbose_flag);
65 if (mArgsInfo.imagetypes_given && mArgsInfo.imagetypes_flag)
66 this->PrintAvailableImageTypes();
67 if (mArgsInfo.input_given) {
68 SetInputFilename(mArgsInfo.input_arg);
70 if (mArgsInfo.output_given) {
71 SetOutputFilename(mArgsInfo.output_arg);
74 //--------------------------------------------------------------------
77 //--------------------------------------------------------------------
78 // Update with the number of dimensions and the pixeltype
79 //--------------------------------------------------------------------
80 template<class InputImageType>
82 MIPGenericFilter::UpdateWithInputImageType()
84 typedef typename InputImageType::PixelType PixelType;
85 const int Dim = InputImageType::ImageDimension;
86 typedef itk::Image<PixelType,Dim> ImageType;
87 typedef itk::Image<PixelType,Dim-1> OutputImageType;
88 typedef itk::MaximumProjectionImageFilter<ImageType,OutputImageType> FilterType;
89 typename FilterType::Pointer filter = FilterType::New();
90 filter->SetProjectionDimension(mArgsInfo.dimension_arg);
91 typename InputImageType::Pointer input = this->template GetInput<InputImageType>(0);
92 filter->SetInput(input);
94 this->template SetNextOutput<OutputImageType>(filter->GetOutput());
96 //--------------------------------------------------------------------
101 #endif //#define clitkMIPGenericFilter_cxx