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://www.centreleonberard.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 //--------------------------------------------------------------------
20 template <class ImageType>
21 clitk::RelativePositionAnalyzerFilter<ImageType>::
22 RelativePositionAnalyzerFilter():
23 itk::ImageToImageFilter<ImageType, ImageType>()
25 this->SetNumberOfRequiredInputs(3); // support, object, target
28 //--------------------------------------------------------------------
31 //--------------------------------------------------------------------
32 template <class ImageType>
34 clitk::RelativePositionAnalyzerFilter<ImageType>::
35 SetInputSupport(const ImageType * image)
37 // Process object is not const-correct so the const casting is required.
38 this->SetNthInput(0, const_cast<ImageType *>(image));
40 //--------------------------------------------------------------------
43 //--------------------------------------------------------------------
44 template <class ImageType>
46 clitk::RelativePositionAnalyzerFilter<ImageType>::
47 SetInputObject(const ImageType * image)
49 // Process object is not const-correct so the const casting is required.
50 this->SetNthInput(1, const_cast<ImageType *>(image));
52 //--------------------------------------------------------------------
55 //--------------------------------------------------------------------
56 template <class ImageType>
58 clitk::RelativePositionAnalyzerFilter<ImageType>::
59 SetInputTarget(const ImageType * image)
61 // Process object is not const-correct so the const casting is required.
62 this->SetNthInput(1, const_cast<ImageType *>(image));
64 //--------------------------------------------------------------------
67 //--------------------------------------------------------------------
68 template <class ImageType>
70 clitk::RelativePositionAnalyzerFilter<ImageType>::
75 //--------------------------------------------------------------------
78 //--------------------------------------------------------------------
79 template <class ImageType>
81 clitk::RelativePositionAnalyzerFilter<ImageType>::
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;
93 - target fully inside support ?
96 //for(int i=0; i<m_ListOfOrientation.size(); i++) {
101 // Get minimal value in the target area
103 // Or -> analyze floating point values inside the target area (histo ?)
105 // Set threshold and compute new support
107 // Compute ratio of area before/after
108 // http://www.itk.org/Doxygen/html/classitk_1_1LabelStatisticsImageFilter.html#details
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());
117 statisticsFilter = StatisticsImageFilterType::New();
118 statisticsFilter->SetInput(m_Output);
119 statisticsFilter->SetLabelInput(m_Output);
120 statisticsFilter->Update();
121 int m = labelStatisticsImageFilter->GetCount(GetForegroundValue());
130 // Final Step -> set output TODO
131 // this->SetNthOutput(0, working_image);
132 // this->GraftOutput(working_image);
134 //--------------------------------------------------------------------