]> Creatis software - clitk.git/blob - tools/clitkLabelImageOverlapMeasureGenericFilter.txx
GateAsciiImageIO is now cross-platform using itksys::RegularExpression
[clitk.git] / tools / clitkLabelImageOverlapMeasureGenericFilter.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::LabelImageOverlapMeasureGenericFilter<ArgsInfoType>::
22 LabelImageOverlapMeasureGenericFilter():
23   ImageToImageGenericFilter<Self>("LabelImageOverlapMeasure")
24 {
25   // Default values
26   cmdline_parser_clitkLabelImageOverlapMeasure_init(&mArgsInfo);
27   //InitializeImageType<2>();
28   InitializeImageType<3>();
29 }
30 //--------------------------------------------------------------------
31
32
33 //--------------------------------------------------------------------
34 template<class ArgsInfoType>
35 template<unsigned int Dim>
36 void clitk::LabelImageOverlapMeasureGenericFilter<ArgsInfoType>::
37 InitializeImageType() 
38 {  
39   ADD_IMAGE_TYPE(Dim, uchar);
40 }
41 //--------------------------------------------------------------------
42   
43
44 //--------------------------------------------------------------------
45 template<class ArgsInfoType>
46 void clitk::LabelImageOverlapMeasureGenericFilter<ArgsInfoType>::
47 SetArgsInfo(const ArgsInfoType & a) 
48 {
49   mArgsInfo=a;
50   SetIOVerbose(mArgsInfo.verbose_flag);
51   if (mArgsInfo.imagetypes_flag) this->PrintAvailableImageTypes();
52   if (mArgsInfo.input1_given) AddInputFilename(mArgsInfo.input1_arg);
53   if (mArgsInfo.input2_given) AddInputFilename(mArgsInfo.input2_arg);
54 }
55 //--------------------------------------------------------------------
56
57
58 //--------------------------------------------------------------------
59 // Update with the number of dimensions and the pixeltype
60 //--------------------------------------------------------------------
61 template<class ArgsInfoType>
62 template<class FilterType>
63 void clitk::LabelImageOverlapMeasureGenericFilter<ArgsInfoType>::
64 SetOptionsFromArgsInfoToFilter(FilterType * f) 
65 {
66   f->SetLabel1(mArgsInfo.label1_arg);  
67   f->SetLabel2(mArgsInfo.label2_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::LabelImageOverlapMeasureGenericFilter<ArgsInfoType>::
76 UpdateWithInputImageType() 
77
78   // Reading input
79   typename ImageType::Pointer input1 = this->template GetInput<ImageType>(0);
80   typename ImageType::Pointer input2 = this->template GetInput<ImageType>(1);
81
82   // Create filter
83   typedef clitk::LabelImageOverlapMeasureFilter<ImageType> FilterType;
84   typename FilterType::Pointer filter = FilterType::New();
85   
86   // Set global Options 
87   filter->SetInput(0, input1);
88   filter->SetInput(1, input2);
89   SetOptionsFromArgsInfoToFilter<FilterType>(filter);
90
91   // Go !
92   filter->Update();
93   
94   // Write/Save results
95   // typename ImageType::Pointer output = filter->GetOutput();
96   // this->template SetNextOutput<ImageType>(output); 
97 }
98 //--------------------------------------------------------------------
99
100