Skip to content
Snippets Groups Projects
Commit f3dfcfff authored by Caroline Ruffel's avatar Caroline Ruffel
Browse files

nomsg

parent 327d36b8
No related branches found
No related tags found
No related merge requests found
......@@ -8,8 +8,8 @@
$Id$
=========================================================================*/
#ifndef __otbAssymetricFusionOfLineDetectorImageFilter_h
#define __otbAssymetricFusionOfLineDetectorImageFilter_h
#ifndef __otbAssymmetricFusionOfLineDetectorImageFilter_h
#define __otbAssymmetricFusionOfLineDetectorImageFilter_h
#include "itkImageToImageFilter.h"
......@@ -21,14 +21,14 @@
namespace otb
{
/** \class AssymetricFusionOfLineDtectorImageFilter
/** \class AssymmetricFusionOfLineDetectorImageFilter
*
*/
template <class TInputImage,
class TOutputImage,
class InterpolatorType = itk::BSplineInterpolateImageFunction<TInputImage> >
class AssymetricFusionOfLineDetectorImageFilter : public itk::ImageToImageFilter< TInputImage, TOutputImage >
class AssymmetricFusionOfLineDetectorImageFilter : public itk::ImageToImageFilter< TInputImage, TOutputImage >
{
public:
......@@ -46,14 +46,14 @@ public:
typedef TOutputImage InputImageType2;
typedef AssymetricFusionOfLineDetectorImageFilter Self;
typedef AssymmetricFusionOfLineDetectorImageFilter Self;
typedef itk::ImageToImageFilter< InputImageType, OutputImageType> Superclass;
typedef itk::SmartPointer<Self> Pointer;
typedef itk::SmartPointer<const Self> ConstPointer;
itkNewMacro(Self);
itkTypeMacro(AssymetricFusionOfLineDetectorImageFilter, ImageToImageFilter);
itkTypeMacro(AssymmetricFusionOfLineDetectorImageFilter, ImageToImageFilter);
typedef typename InputImageType::PixelType InputPixelType;
typedef typename InputImageType::SizeType SizeType;
......@@ -76,8 +76,8 @@ public:
itkGetConstReferenceMacro(WidthLine, unsigned int);
protected:
AssymetricFusionOfLineDetectorImageFilter();
virtual ~AssymetricFusionOfLineDetectorImageFilter() {};
AssymmetricFusionOfLineDetectorImageFilter();
virtual ~AssymmetricFusionOfLineDetectorImageFilter() {};
typedef otb::LineRatioDetector< InputImageType, OutputImageType, InterpolatorType > LineRatioType;
typedef otb::LineCorrelationDetector< InputImageType, OutputImageType, InterpolatorType > LineCorrelationType;
......@@ -88,7 +88,7 @@ protected:
void PrintSelf(std::ostream& os, itk::Indent indent) const;
private:
AssymetricFusionOfLineDetectorImageFilter(const Self&); //purposely not implemented
AssymmetricFusionOfLineDetectorImageFilter(const Self&); //purposely not implemented
void operator=(const Self&); //purposely not implemented
/** Length of the linear feature = 2*m_LengthLine+1 */
......@@ -104,7 +104,7 @@ private:
} // end namespace otb
#ifndef OTB_MANUAL_INSTANTIATION
#include "otbAssymetricFusionOfLineDetectorImageFilter.txx"
#include "otbAssymmetricFusionOfLineDetectorImageFilter.txx"
#endif
......
......@@ -8,10 +8,10 @@
$Id$
=========================================================================*/
#ifndef __otbAssymetricFusionOfLineDetectorImageFilter_txx
#define __otbAssymetricFusionOfLineDetectorImageFilter_txx
#ifndef __otbAssymmetricFusionOfLineDetectorImageFilter_txx
#define __otbAssymmetricFusionOfLineDetectorImageFilter_txx
#include "otbAssymetricFusionOfLineDetectorImageFilter.h"
#include "otbAssymmetricFusionOfLineDetectorImageFilter.h"
namespace otb
......@@ -21,8 +21,8 @@ namespace otb
*
*/
template <class TInputImage, class TOutputImage, class InterpolatorType>
AssymetricFusionOfLineDetectorImageFilter<TInputImage, TOutputImage, InterpolatorType>
::AssymetricFusionOfLineDetectorImageFilter()
AssymmetricFusionOfLineDetectorImageFilter<TInputImage, TOutputImage, InterpolatorType>
::AssymmetricFusionOfLineDetectorImageFilter()
{
m_LengthLine = 1;
m_WidthLine = 0;
......@@ -35,7 +35,7 @@ AssymetricFusionOfLineDetectorImageFilter<TInputImage, TOutputImage, Interpolato
template <class TInputImage, class TOutputImage, class InterpolatorType>
void
AssymetricFusionOfLineDetectorImageFilter<TInputImage, TOutputImage, InterpolatorType>
AssymmetricFusionOfLineDetectorImageFilter<TInputImage, TOutputImage, InterpolatorType>
::GenerateData()
{
m_LineRatio->SetInput( this->GetInput() );
......@@ -60,7 +60,7 @@ AssymetricFusionOfLineDetectorImageFilter<TInputImage, TOutputImage, Interpolato
*/
template <class TInputImage, class TOutput, class InterpolatorType>
void
AssymetricFusionOfLineDetectorImageFilter<TInputImage, TOutput, InterpolatorType>
AssymmetricFusionOfLineDetectorImageFilter<TInputImage, TOutput, InterpolatorType>
::PrintSelf(std::ostream& os, itk::Indent indent) const
{
Superclass::PrintSelf( os, indent );
......
......@@ -98,6 +98,8 @@ private:
SizeType m_Radius;
InputRealType m_AngularBeam;
double m_Distance;
};
} // end namespace otb
......
......@@ -35,6 +35,7 @@ PixelSuppressionByDirectionImageFilter<TInputImage, TOutputImage>::PixelSuppress
{
m_Radius.Fill(1);
m_AngularBeam = static_cast<InputRealType>(0.);
m_Distance = sqrt(2.);
}
template <class TInputImage, class TOutputImage>
......@@ -168,9 +169,32 @@ void PixelSuppressionByDirectionImageFilter< TInputImage, TOutputImage>::Threade
typename TInputImage::IndexType bitIndex;
//---------------------------------------------------------------------------
InputPixelType PixelValue;
// location of the pixel central in the input image
int Xc, Yc;
// Pixel location in the system axis of the region
int x, y;
// Distance between pixel (x,y) and the pixel central of the region
double DistanceXY;
double tanXY;
double MintanXcYc, MaxtanXcYc;
// Pixel Direction
double DirectionXcYc, DirectionXY;
//---------------------------------------------------------------------------
// Distance max between two pixels neighbours
m_Distance = static_cast<double>(m_Radius[0]*sqrt(2.));
// Process each of the boundary faces. These are N-d regions which border
// the edge of the buffer.
for (fit=faceList.begin(); fit != faceList.end(); ++fit)
......@@ -183,31 +207,58 @@ void PixelSuppressionByDirectionImageFilter< TInputImage, TOutputImage>::Threade
bit.OverrideBoundaryCondition(&cbc);
bit.GoToBegin();
// ---------------------------------------------------------------------------
InputPixelType PixelValue;
// ---------------------------------------------------------------------------
while ( ! bit.IsAtEnd() )
{
// Location of the pixel central of the region
bitIndex = bit.GetIndex();
Xc = bitIndex[0];
Yc = bitIndex[1];
DirectionXcYc = static_cast<double>( bit.GetCenterPixel() );
MintanXcYc = tan( DirectionXcYc - m_AngularBeam );
MaxtanXcYc = tan( DirectionXcYc + m_AngularBeam );
PixelValue = itin.Get();
// Loop on the region
for (i = 0; i < neighborhoodSize; ++i)
{
// Pixel location in the system axis of the region
bitIndex = bit.GetIndex(i);
x = bitIndex[0] - Xc;
y = bitIndex[1] - Yc;
// Distance between pixel (x,y) and pixel central
DistanceXY = static_cast<double>(sqrt(x*x+y*y));
// If the pixel (x,y) is inside the circle of radius m_Distance
if ( DistanceXY < m_Distance )
{
tanXY = static_cast<double>(y/x);
if ( (MintanXcYc <= tanXY) and
(tanXY <= MaxtanXcYc) )
{
DirectionXY = static_cast<double>(bit.GetPixel(i));
if ( ((DirectionXcYc - m_AngularBeam) <= DirectionXY) and
(DirectionXY <= (DirectionXcYc + m_AngularBeam)) )
// Assignment of this value to the output pixel
itout.Set( static_cast<OutputPixelType>(PixelValue) );
}
}
} // end of the loop on the pixels of the region
// Assignment of this value to the output pixel
itout.Set( static_cast<OutputPixelType>(PixelValue) );
++bit;
++itin;
++itout;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment