]> Creatis software - clitk.git/blob - tools/clitkRelativePositionAnalyzerGenericFilter.txx
df52194bd00343030b3fe6811956185f94972084
[clitk.git] / tools / clitkRelativePositionAnalyzerGenericFilter.txx
1 /*=========================================================================
2   Program:   vv                     http://www.creatis.insa-lyon.fr/rio/vv
3
4   Authors belong to: 
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
8
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.
12
13   It is distributed under dual licence
14
15   - BSD        See included LICENSE.txt file
16   - CeCILL-B   http://www.cecill.info/licences/Licence_CeCILL-B_V1-en.html
17   ===========================================================================**/
18
19 //--------------------------------------------------------------------
20 template<class ArgsInfoType>
21 clitk::RelativePositionAnalyzerGenericFilter<ArgsInfoType>::
22 RelativePositionAnalyzerGenericFilter():
23   ImageToImageGenericFilter<Self>("RelativePositionAnalyzer")
24 {
25   // Default values
26   cmdline_parser_clitkRelativePositionAnalyzer_init(&mArgsInfo);
27   InitializeImageType<3>();
28 }
29 //--------------------------------------------------------------------
30
31
32 //--------------------------------------------------------------------
33 template<class ArgsInfoType>
34 template<unsigned int Dim>
35 void clitk::RelativePositionAnalyzerGenericFilter<ArgsInfoType>::
36 InitializeImageType() 
37 {  
38   ADD_IMAGE_TYPE(Dim, uchar);
39 }
40 //--------------------------------------------------------------------
41   
42
43 //--------------------------------------------------------------------
44 template<class ArgsInfoType>
45 void clitk::RelativePositionAnalyzerGenericFilter<ArgsInfoType>::
46 SetArgsInfo(const ArgsInfoType & a) 
47 {
48   mArgsInfo=a;
49   SetIOVerbose(mArgsInfo.verbose_flag);
50   if (mArgsInfo.imagetypes_flag) this->PrintAvailableImageTypes();
51   if (mArgsInfo.support_given) AddInputFilename(mArgsInfo.support_arg);
52   if (mArgsInfo.object_given) AddInputFilename(mArgsInfo.object_arg);
53   if (mArgsInfo.target_given) AddInputFilename(mArgsInfo.target_arg);
54   if (mArgsInfo.output_given) AddOutputFilename(mArgsInfo.output_arg);
55 }
56 //--------------------------------------------------------------------
57
58
59 //--------------------------------------------------------------------
60 // Update with the number of dimensions and the pixeltype
61 //--------------------------------------------------------------------
62 template<class ArgsInfoType>
63 template<class FilterType>
64 void clitk::RelativePositionAnalyzerGenericFilter<ArgsInfoType>::
65 SetOptionsFromArgsInfoToFilter(FilterType * f) 
66 {
67   f->SetAFDBFilename(mArgsInfo.afdb_arg);  
68 }
69
70 //--------------------------------------------------------------------
71 // Update with the number of dimensions and the pixeltype
72 //--------------------------------------------------------------------
73 template<class ArgsInfoType>
74 template<class ImageType>
75 void clitk::RelativePositionAnalyzerGenericFilter<ArgsInfoType>::
76 UpdateWithInputImageType() 
77
78   // Reading input
79   typename ImageType::Pointer support = this->template GetInput<ImageType>(0);
80   typename ImageType::Pointer object = this->template GetInput<ImageType>(1);
81   typename ImageType::Pointer target = this->template GetInput<ImageType>(2);
82
83   // Create filter
84   typedef clitk::RelativePositionAnalyzerFilter<ImageType> FilterType;
85   typename FilterType::Pointer filter = FilterType::New();
86   
87   // Set global Options 
88   filter->SetInputSupport(support);
89   filter->SetInputObject(object);
90   filter->SetInputTarget(target);
91   SetOptionsFromArgsInfoToFilter<FilterType>(filter);
92
93   // Go !
94   filter->Update();
95   
96   // Write/Save results
97   //  typename ImageType::Pointer output = filter->GetOutput();
98   //this->template SetNextOutput<ImageType>(output); 
99
100 }
101 //--------------------------------------------------------------------
102
103