diff --git a/Code/FeatureExtraction/otbAssymetricFusionOfLineDetectorImageFilter.h b/Code/FeatureExtraction/otbAssymetricFusionOfLineDetectorImageFilter.h new file mode 100755 index 0000000000000000000000000000000000000000..e61b195d869777b8e76de3313fef9672b10b0a5b --- /dev/null +++ b/Code/FeatureExtraction/otbAssymetricFusionOfLineDetectorImageFilter.h @@ -0,0 +1,111 @@ +/*========================================================================= + + Programme : OTB (ORFEO ToolBox) + Auteurs : CS - C.Ruffel + Language : C++ + Date : 29 mars 2006 + Role : Associative Symetrical Sum of Line Detector Image Filter + $Id$ + +=========================================================================*/ +#ifndef __otbAssymetricFusionOfLineDetectorImageFilter_h +#define __otbAssymetricFusionOfLineDetectorImageFilter_h + +#include "itkImageToImageFilter.h" + +#include "otbLineRatioDetector.h" +#include "otbLineCorrelationDetector.h" +#include "otbAssociativeSymmetricalSumImageFilter.h" + + +namespace otb +{ + +/** \class AssymetricFusionOfLineDtectorImageFilter + * + */ + +template <class TInputImage, + class TOutputImage, + class InterpolatorType = itk::BSplineInterpolateImageFunction<TInputImage> > +class AssymetricFusionOfLineDetectorImageFilter : public itk::ImageToImageFilter< TInputImage, TOutputImage > +{ +public: + + itkStaticConstMacro( InputImageDimension, + unsigned int, + TInputImage::ImageDimension); + itkStaticConstMacro( OutputImageDimension, + unsigned int, + TOutputImage::ImageDimension); + + typedef TInputImage InputImageType; + typedef TOutputImage OutputImageType; + + typedef TOutputImage InputImageType1; + typedef TOutputImage InputImageType2; + + + typedef AssymetricFusionOfLineDetectorImageFilter Self; + typedef itk::ImageToImageFilter< InputImageType, OutputImageType> Superclass; + typedef itk::SmartPointer<Self> Pointer; + typedef itk::SmartPointer<const Self> ConstPointer; + + itkNewMacro(Self); + + itkTypeMacro(AssymetricFusionOfLineDetectorImageFilter, ImageToImageFilter); + + typedef typename InputImageType::PixelType InputPixelType; + typedef typename InputImageType::SizeType SizeType; + + typedef typename OutputImageType::PixelType OutputPixelType; + + typedef typename InputImageType::SizeType SizeType; + + + /** Set the length of the linear feature. */ + itkSetMacro(LengthLine, unsigned int); + + /** Get the length of the linear feature. */ + itkGetConstReferenceMacro(LengthLine, unsigned int); + + /** Set the width of the linear feature. */ + itkSetMacro(WidthLine, unsigned int); + + /** Get the length of the linear feature. */ + itkGetConstReferenceMacro(WidthLine, unsigned int); + +protected: + AssymetricFusionOfLineDetectorImageFilter(); + virtual ~AssymetricFusionOfLineDetectorImageFilter() {}; + + typedef otb::LineRatioDetector< InputImageType, OutputImageType, InterpolatorType > LineRatioType; + typedef otb::LineCorrelationDetector< InputImageType, OutputImageType, InterpolatorType > LineCorrelationType; + typedef otb::AssociativeSymmetricalSumImageFilter< InputImageType1, InputImageType2, OutputImageType > AssSymSumType; + + virtual void GenerateData(); + + void PrintSelf(std::ostream& os, itk::Indent indent) const; + +private: + AssymetricFusionOfLineDetectorImageFilter(const Self&); //purposely not implemented + void operator=(const Self&); //purposely not implemented + + /** Length of the linear feature = 2*m_LengthLine+1 */ + unsigned int m_LengthLine; + + /** Width of the linear feature = 2*m_WidthLine+1 */ + unsigned int m_WidthLine; + + typename LineRatioType::Pointer m_LineRatio; + typename LineCorrelationType::Pointer m_LineCorrelation; + typename AssSymSumType::Pointer m_AssSymSum; +}; +} // end namespace otb + +#ifndef OTB_MANUAL_INSTANTIATION +#include "otbAssymetricFusionOfLineDetectorImageFilter.txx" +#endif + + +#endif diff --git a/Code/FeatureExtraction/otbAssymetricFusionOfLineDetectorImageFilter.txx b/Code/FeatureExtraction/otbAssymetricFusionOfLineDetectorImageFilter.txx new file mode 100755 index 0000000000000000000000000000000000000000..51dcc1aa3837b398ee65b670ab96ea7546e855e1 --- /dev/null +++ b/Code/FeatureExtraction/otbAssymetricFusionOfLineDetectorImageFilter.txx @@ -0,0 +1,76 @@ +/*========================================================================= + + Programme : OTB (ORFEO ToolBox) + Auteurs : CS - C.Ruffel + Language : C++ + Date : 29 mars 2006 + Role : Associative Symetrical Sum of Line Detector Image Filter + $Id$ + +=========================================================================*/ +#ifndef __otbAssymetricFusionOfLineDetectorImageFilter_txx +#define __otbAssymetricFusionOfLineDetectorImageFilter_txx + +#include "otbAssymetricFusionOfLineDetectorImageFilter.h" + + +namespace otb +{ + +/** + * + */ +template <class TInputImage, class TOutputImage, class InterpolatorType> +AssymetricFusionOfLineDetectorImageFilter<TInputImage, TOutputImage, InterpolatorType> +::AssymetricFusionOfLineDetectorImageFilter() +{ + m_LengthLine = 1; + m_WidthLine = 0; + + + m_LineRatio = LineRatioType::New(); + m_LineCorrelation = LineCorrelationType::New(); + m_AssSymSum = AssSymSumType::New(); +} + +template <class TInputImage, class TOutputImage, class InterpolatorType> +void +AssymetricFusionOfLineDetectorImageFilter<TInputImage, TOutputImage, InterpolatorType> +::GenerateData() +{ + m_LineRatio->SetInput( this->GetInput() ); + m_LineRatio->SetLengthLine( this->m_LengthLine ); + m_LineRatio->SetWidthLine( this->m_WidthLine ); + + m_LineCorrelation->SetInput( this->GetInput() ); + m_LineCorrelation->SetLengthLine( this->m_LengthLine ); + m_LineCorrelation->SetWidthLine( this->m_WidthLine ); + + m_AssSymSum->SetInput1( m_LineRatio->GetOutput() ); + m_AssSymSum->SetInput2( m_LineCorrelation->GetOutput() ); + + m_AssSymSum->GraftOutput(this->GetOutput() ); + m_AssSymSum->Update(); + this->GraftOutput(m_AssSymSum->GetOutput() ); +} + + +/** + * Standard "PrintSelf" method + */ +template <class TInputImage, class TOutput, class InterpolatorType> +void +AssymetricFusionOfLineDetectorImageFilter<TInputImage, TOutput, InterpolatorType> +::PrintSelf(std::ostream& os, itk::Indent indent) const +{ + Superclass::PrintSelf( os, indent ); + os << indent << "Length: " << m_LengthLine << std::endl; + os << indent << "Width: " << m_WidthLine << std::endl; + +} + + +} // end namespace otb + + +#endif diff --git a/Code/FeatureExtraction/otbLineCorrelationDetector.txx b/Code/FeatureExtraction/otbLineCorrelationDetector.txx index 8074c100e108ba11a0be30eeebb0de0394e61bee..ca8083b9790679601e2e0020923eb92a4723ab0b 100755 --- a/Code/FeatureExtraction/otbLineCorrelationDetector.txx +++ b/Code/FeatureExtraction/otbLineCorrelationDetector.txx @@ -359,7 +359,8 @@ void LineCorrelationDetector<TInputImage, TOutput, InterpolatorType>::PrintSelf(std::ostream& os, itk::Indent indent) const { Superclass::PrintSelf( os, indent ); - os << indent << "Radius: " << m_Radius << std::endl; + os << indent << "Length: " << m_LengthLine << std::endl; + os << indent << "Width: " << m_WidthLine << std::endl; } diff --git a/Code/FeatureExtraction/otbLineRatioDetector.txx b/Code/FeatureExtraction/otbLineRatioDetector.txx index 54abaa84455c45544be3fbf332f9d442c9f50315..b3ae73d0f9629700f83746e9d43cd40087719c93 100755 --- a/Code/FeatureExtraction/otbLineRatioDetector.txx +++ b/Code/FeatureExtraction/otbLineRatioDetector.txx @@ -315,7 +315,9 @@ void LineRatioDetector<TInputImage, TOutput, InterpolatorType>::PrintSelf(std::ostream& os, itk::Indent indent) const { Superclass::PrintSelf( os, indent ); - os << indent << "Radius: " << m_Radius << std::endl; + os << indent << "Length: " << m_LengthLine << std::endl; + os << indent << "Width: " << m_WidthLine << std::endl; + }