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 ======================================================================-====*/
19 #include "clitkImageCommon.h"
21 //--------------------------------------------------------------------
22 template<class ArgsInfoType>
23 clitk::ExtractPatientGenericFilter<ArgsInfoType>::ExtractPatientGenericFilter():
24 ImageToImageGenericFilter<Self>("ExtractPatient")
27 cmdline_parser_clitkExtractPatient_init(&mArgsInfo);
28 InitializeImageType<3>();
30 //--------------------------------------------------------------------
33 //--------------------------------------------------------------------
34 template<class ArgsInfoType>
35 template<unsigned int Dim>
36 void clitk::ExtractPatientGenericFilter<ArgsInfoType>::InitializeImageType()
38 ADD_IMAGE_TYPE(Dim, short);
39 // ADD_IMAGE_TYPE(Dim, int);
40 // ADD_IMAGE_TYPE(Dim, float);
42 //--------------------------------------------------------------------
45 //--------------------------------------------------------------------
46 template<class ArgsInfoType>
47 void clitk::ExtractPatientGenericFilter<ArgsInfoType>::SetArgsInfo(const ArgsInfoType & a)
50 SetIOVerbose(mArgsInfo.verbose_flag);
51 if (mArgsInfo.imagetypes_flag) this->PrintAvailableImageTypes();
52 if (mArgsInfo.input_given) SetInputFilename(mArgsInfo.input_arg);
53 if (mArgsInfo.output_given) AddOutputFilename(mArgsInfo.output_arg);
55 //--------------------------------------------------------------------
58 //--------------------------------------------------------------------
59 // Update with the number of dimensions and the pixeltype
60 //--------------------------------------------------------------------
61 template<class ArgsInfoType>
62 template<class ImageType>
63 void clitk::ExtractPatientGenericFilter<ArgsInfoType>::UpdateWithInputImageType()
66 typedef itk::Image<uchar, ImageType::ImageDimension> OutputImageType;
69 typename ImageType::Pointer input = this->template GetInput<ImageType>(0);
72 typedef clitk::ExtractPatientFilter<ImageType, OutputImageType> FilterType;
73 typename FilterType::Pointer filter = FilterType::New();
76 filter->SetArgsInfo(mArgsInfo);
77 filter->SetInput(input);
83 if (filter->HasError()) {
84 SetLastError(filter->GetLastError());
90 typename OutputImageType::Pointer output = filter->GetOutput();
91 this->template SetNextOutput<OutputImageType>(output);
93 //--------------------------------------------------------------------