]> Creatis software - clitk.git/blob - tools/clitkLabelImageOverlapMeasureGenericFilter.txx
Add clitkImage2Dicom tool
[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_clitkDice_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   //this->SetIOVerbose(mArgsInfo.verbose_flag);
51   if (mArgsInfo.imagetypes_flag) this->PrintAvailableImageTypes();
52   if (mArgsInfo.input1_given) this->AddInputFilename(mArgsInfo.input1_arg);
53   if (mArgsInfo.input2_given) this->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   f->SetVerboseFlag(mArgsInfo.verbose_flag);
69   f->SetLongFlag(mArgsInfo.long_flag);
70 }
71 //--------------------------------------------------------------------
72
73
74 //--------------------------------------------------------------------
75 // Update with the number of dimensions and the pixeltype
76 //--------------------------------------------------------------------
77 template<class ArgsInfoType>
78 template<class ImageType>
79 void clitk::LabelImageOverlapMeasureGenericFilter<ArgsInfoType>::
80 UpdateWithInputImageType()
81 {
82   // Reading input
83   typename ImageType::Pointer input1 = this->template GetInput<ImageType>(0);
84   typename ImageType::Pointer input2 = this->template GetInput<ImageType>(1);
85
86   // Create filter
87   typedef clitk::LabelImageOverlapMeasureFilter<ImageType> FilterType;
88   typename FilterType::Pointer filter = FilterType::New();
89
90   // Set global Options
91   filter->SetInput(0, input1);
92   filter->SetInput(1, input2);
93   SetOptionsFromArgsInfoToFilter<FilterType>(filter);
94
95   // Go !
96   filter->Update();
97
98   // Write/Save results
99   // typename ImageType::Pointer output = filter->GetOutput();
100   // this->template SetNextOutput<ImageType>(output);
101 }
102 //--------------------------------------------------------------------