Orfeo Toolbox  3.16
itkLabelImageToStatisticsLabelMapFilter.txx
Go to the documentation of this file.
1 /*=========================================================================
2 
3  Program: Insight Segmentation & Registration Toolkit
4  Module: $RCSfile: itkLabelImageToStatisticsLabelMapFilter.txx,v $
5  Language: C++
6  Date: $Date: 2009-08-07 08:27:57 $
7  Version: $Revision: 1.1 $
8 
9  Copyright (c) Insight Software Consortium. All rights reserved.
10  See ITKCopyright.txt or http://www.itk.org/HTML/Copyright.htm for details.
11 
12  This software is distributed WITHOUT ANY WARRANTY; without even
13  the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
14  PURPOSE. See the above copyright notices for more information.
15 
16 =========================================================================*/
17 #ifndef __itkLabelImageToStatisticsLabelMapFilter_txx
18 #define __itkLabelImageToStatisticsLabelMapFilter_txx
19 
21 #include "itkProgressAccumulator.h"
22 
23 
24 namespace itk {
25 
26 template<class TInputImage, class TFeatureImage, class TOutputImage>
29 {
31  m_ComputeFeretDiameter = false;
32  m_ComputePerimeter = false;
33  m_NumberOfBins = 128;
34  m_ComputeHistogram = true;
35  this->SetNumberOfRequiredInputs(2);
36 }
37 
38 template<class TInputImage, class TFeatureImage, class TOutputImage>
39 void
42 {
43  // call the superclass' implementation of this method
44  Superclass::GenerateInputRequestedRegion();
45 
46  // We need all the input.
47  InputImagePointer input = const_cast<InputImageType *>(this->GetInput());
48  if( input )
49  {
50  input->SetRequestedRegion( input->GetLargestPossibleRegion() );
51  }
52 }
53 
54 
55 template<class TInputImage, class TFeatureImage, class TOutputImage>
56 void
59 {
60  this->GetOutput()
61  ->SetRequestedRegion( this->GetOutput()->GetLargestPossibleRegion() );
62 }
63 
64 
65 template<class TInputImage, class TFeatureImage, class TOutputImage>
66 void
69 {
70  // Create a process accumulator for tracking the progress of this minipipeline
72  progress->SetMiniPipelineFilter(this);
73 
74  // Allocate the output
75  this->AllocateOutputs();
76 
77  typename LabelizerType::Pointer labelizer = LabelizerType::New();
78  labelizer->SetInput( this->GetInput() );
79  labelizer->SetBackgroundValue( m_BackgroundValue );
80  labelizer->SetNumberOfThreads( this->GetNumberOfThreads() );
81  progress->RegisterInternalFilter(labelizer, .5f);
82 
83  typename LabelObjectValuatorType::Pointer valuator = LabelObjectValuatorType::New();
84  valuator->SetInput( labelizer->GetOutput() );
85  valuator->SetFeatureImage( this->GetFeatureImage() );
86  valuator->SetNumberOfThreads( this->GetNumberOfThreads() );
87  valuator->SetComputePerimeter( m_ComputePerimeter );
88  valuator->SetComputeFeretDiameter( m_ComputeFeretDiameter );
89  valuator->SetComputeHistogram( m_ComputeHistogram );
90  valuator->SetNumberOfBins( m_NumberOfBins );
91  progress->RegisterInternalFilter(valuator, .5f);
92 
93  valuator->GraftOutput( this->GetOutput() );
94  valuator->Update();
95  this->GraftOutput( valuator->GetOutput() );
96 }
97 
98 
99 template<class TInputImage, class TFeatureImage, class TOutputImage>
100 void
102 ::PrintSelf(std::ostream &os, Indent indent) const
103 {
104  Superclass::PrintSelf(os, indent);
105 
106  os << indent << "BackgroundValue: " << static_cast<typename NumericTraits<OutputImagePixelType>::PrintType>(m_BackgroundValue) << std::endl;
107  os << indent << "ComputeFeretDiameter: " << m_ComputeFeretDiameter << std::endl;
108  os << indent << "ComputePerimeter: " << m_ComputePerimeter << std::endl;
109  os << indent << "ComputeHistogram: " << m_ComputeHistogram << std::endl;
110  os << indent << "NumberOfBins: " << m_NumberOfBins << std::endl;
111 }
112 
113 }// end namespace itk
114 #endif

Generated at Sat May 18 2013 23:49:18 for Orfeo Toolbox with doxygen 1.8.3.1