1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97
|
/*=========================================================================
Program: Insight Segmentation & Registration Toolkit
Module: $RCSfile: itkSampleMeanShiftBlurringFilter.txx,v $
Language: C++
Date: $Date: 2009-03-04 19:29:54 $
Version: $Revision: 1.7 $
Copyright (c) Insight Software Consortium. All rights reserved.
See ITKCopyright.txt or http://www.itk.org/HTML/Copyright.htm for details.
This software is distributed WITHOUT ANY WARRANTY; without even
the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
PURPOSE. See the above copyright notices for more information.
=========================================================================*/
#ifndef __itkSampleMeanShiftBlurringFilter_txx
#define __itkSampleMeanShiftBlurringFilter_txx
namespace itk {
namespace Statistics {
template< class TSample >
SampleMeanShiftBlurringFilter< TSample >
::SampleMeanShiftBlurringFilter()
{
m_Output = OutputType::New();
m_ModeSeeker = 0;
}
template< class TSample >
SampleMeanShiftBlurringFilter< TSample >
::~SampleMeanShiftBlurringFilter()
{
}
template< class TSample >
void
SampleMeanShiftBlurringFilter< TSample >
::PrintSelf(std::ostream& os, Indent indent) const
{
Superclass::PrintSelf(os,indent);
os << indent << "Output: " << m_Output << std::endl;
}
template< class TSample >
void
SampleMeanShiftBlurringFilter< TSample >
::SetMeanShiftModeSeeker(MeanShiftModeSeekerType* seeker)
{
if ( m_ModeSeeker != seeker )
{
m_ModeSeeker = seeker;
this->Modified();
}
}
template< class TSample >
typename SampleMeanShiftBlurringFilter< TSample >::OutputType*
SampleMeanShiftBlurringFilter< TSample >
::GetOutput()
{
return m_Output.GetPointer();
}
// VS6 cannot compile the following method without the following pragma
#if defined(_MSC_VER)
#pragma inline_depth(0)
#endif
template< class TSample >
void
SampleMeanShiftBlurringFilter< TSample >
::GenerateData()
{
typename InputSampleType::ConstIterator iter = this->GetInputSample()->Begin();
typename InputSampleType::ConstIterator end = this->GetInputSample()->End();
m_Output->SetMeasurementVectorSize( this->GetMeasurementVectorSize() );
m_Output->Clear();
MeasurementVectorType finalPoint;
MeasurementVectorType sample;
while ( iter != end )
{
sample = iter.GetMeasurementVector();
finalPoint = m_ModeSeeker->Evolve( sample );
m_Output->PushBack( finalPoint );
++iter;
}
}
} // end of namespace Statistics
} // end of namespace itk
#endif
|