]> Creatis software - clitk.git/blob - itk/clitkRelativePositionAnalyzerFilter.txx
Add first version of RelativePositionAnalyzer
[clitk.git] / itk / clitkRelativePositionAnalyzerFilter.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 ImageType>
21 clitk::RelativePositionAnalyzerFilter<ImageType>::
22 RelativePositionAnalyzerFilter():
23 itk::ImageToImageFilter<ImageType, ImageType>()
24 {
25   this->SetNumberOfRequiredInputs(3); // support, object, target
26   VerboseFlagOff();
27 }
28 //--------------------------------------------------------------------
29
30
31 //--------------------------------------------------------------------
32 template <class ImageType>
33 void 
34 clitk::RelativePositionAnalyzerFilter<ImageType>::
35 SetInputSupport(const ImageType * image) 
36 {
37   // Process object is not const-correct so the const casting is required.
38   this->SetNthInput(0, const_cast<ImageType *>(image));
39 }
40 //--------------------------------------------------------------------
41   
42
43 //--------------------------------------------------------------------
44 template <class ImageType>
45 void 
46 clitk::RelativePositionAnalyzerFilter<ImageType>::
47 SetInputObject(const ImageType * image) 
48 {
49   // Process object is not const-correct so the const casting is required.
50   this->SetNthInput(1, const_cast<ImageType *>(image));
51 }
52 //--------------------------------------------------------------------
53   
54
55 //--------------------------------------------------------------------
56 template <class ImageType>
57 void 
58 clitk::RelativePositionAnalyzerFilter<ImageType>::
59 SetInputTarget(const ImageType * image) 
60 {
61   // Process object is not const-correct so the const casting is required.
62   this->SetNthInput(1, const_cast<ImageType *>(image));
63 }
64 //--------------------------------------------------------------------
65   
66
67 //--------------------------------------------------------------------
68 template <class ImageType>
69 void 
70 clitk::RelativePositionAnalyzerFilter<ImageType>::
71 PrintOptions() 
72 {
73   DD("TODO");
74 }
75 //--------------------------------------------------------------------
76
77
78 //--------------------------------------------------------------------
79 template <class ImageType>
80 void 
81 clitk::RelativePositionAnalyzerFilter<ImageType>::
82 GenerateData() 
83 {
84   DD("Update");
85   // Get input pointer
86   m_Support = dynamic_cast<ImageType*>(itk::ProcessObject::GetInput(0));
87   m_Object = dynamic_cast<ImageType*>(itk::ProcessObject::GetInput(1));
88   m_Target = dynamic_cast<ImageType*>(itk::ProcessObject::GetInput(2));
89   static const unsigned int dim = ImageType::ImageDimension;
90
91   /*
92     Prerequisite:
93     - target fully inside support ? 
94   */
95   
96   //for(int i=0; i<m_ListOfOrientation.size(); i++) {
97   //DD(i);
98     
99     // Compute Fuzzy map
100
101     // Get minimal value in the target area
102
103     // Or -> analyze floating point values inside the target area (histo ?)
104
105     // Set threshold and compute new support
106     
107     // Compute ratio of area before/after
108     // http://www.itk.org/Doxygen/html/classitk_1_1LabelStatisticsImageFilter.html#details
109     /*
110     typedef itk::LabelStatisticsImageFilter<ImageType, ImageType> StatisticsImageFilterType;
111     typename StatisticsImageFilterType::Pointer statisticsFilter = StatisticsImageFilterType::New();
112     statisticsFilter->SetInput(m_Input);
113     statisticsFilter->SetLabelInput(m_Input);
114     statisticsFilter->Update();
115     int n = labelStatisticsImageFilter->GetCount(GetForegroundValue());
116     DD(n);
117     statisticsFilter = StatisticsImageFilterType::New();
118     statisticsFilter->SetInput(m_Output);
119     statisticsFilter->SetLabelInput(m_Output);
120     statisticsFilter->Update();
121     int m = labelStatisticsImageFilter->GetCount(GetForegroundValue());
122     DD(m);
123     */
124     
125     // Print results
126     
127   //}
128
129   
130   // Final Step -> set output TODO
131   // this->SetNthOutput(0, working_image);
132   //  this->GraftOutput(working_image);
133 }
134 //--------------------------------------------------------------------
135