Skip to content
Snippets Groups Projects
Commit 88c19981 authored by Cyrille Valladeau's avatar Cyrille Valladeau
Browse files

MRG

parents 5b500842 f82bad56
Branches
Tags
No related merge requests found
/*=========================================================================
Program: ORFEO Toolbox
Language: C++
Date: $Date$
Version: $Revision$
Copyright (c) Centre National d'Etudes Spatiales. All rights reserved.
See OTBCopyright.txt 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 __otbLineSpatialObjectListToPointSetFilter_h
#define __otbLineSpatialObjectListToPointSetFilter_h
#if defined(_MSC_VER)
#pragma warning ( disable : 4786 )
#endif
#include "itkProcessObject.h"
#include "otbLineSpatialObjectList.h"
#include "itkLineSpatialObject.h"
namespace otb
{
/** \class LineSpatialObjectListToPointSetFilter
* \brief Base class for all process objects that output PointSets And use LineSpatialObjectList
* as input.
*
*
*/
template <class TLinesList , class TPointSet>
class ITK_EXPORT LineSpatialObjectListToPointSetFilter : public itk::ProcessObject
{
public:
/** Standard class typedefs. */
typedef LineSpatialObjectListToPointSetFilter Self;
typedef itk::ProcessObject Superclass;
typedef itk::SmartPointer<Self> Pointer;
typedef itk::SmartPointer<const Self> ConstPointer;
/** Method for creation through the object factory. */
itkNewMacro(Self);
/** Run-time type information (and related methods). */
itkTypeMacro(LineSpatialObjectListToPointSetFilter,itk::ProcessObject);
/** Some convenient typedefs. */
typedef TLinesList LinesListType;
typedef typename LinesListType::LineType LineType;
/** typedef support for output*/
typedef TPointSet PointSetType;
typedef itk::ProcessObject ProcessObjectType;
/** Set/Get the input image */
virtual void SetInput(const LinesListType *list);
virtual const LinesListType* GetInput(void);
/** Set/Get the list of LineSpatialObject of this process object. */
virtual void SetOutput(const PointSetType *pointSet);
virtual PointSetType* GetOutput(void);
protected:
LineSpatialObjectListToPointSetFilter();
virtual ~LineSpatialObjectListToPointSetFilter() {}
void PrintSelf(std::ostream& os, itk::Indent indent) const;
private:
LineSpatialObjectListToPointSetFilter(const Self&); //purposely not implemented
void operator=(const Self&); //purposely not implemented
};
} // end namespace otb
#ifndef OTB_MANUAL_INSTANTIATION
#include "otbLineSpatialObjectListToPointSetFilter.txx"
#endif
#endif
/*=========================================================================
Program: ORFEO Toolbox
Language: C++
Date: $Date$
Version: $Revision$
Copyright (c) Centre National d'Etudes Spatiales. All rights reserved.
See OTBCopyright.txt 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 __otbLineSpatialObjectListToPointSetFilter_txx
#define __otbLineSpatialObjectListToPointSetFilter_txx
#include "otbLineSpatialObjectListToPointSetFilter.h"
namespace otb
{
/**
*
*/
template<class TLinesList , class TPointSet >
LineSpatialObjectListToPointSetFilter<TLinesList,TPointSet>::LineSpatialObjectListToPointSetFilter()
{
this->SetNumberOfRequiredInputs(1);
this->SetNumberOfRequiredOutputs(1);
typename PointSetType::Pointer pointSet = PointSetType::New();
this->SetOutput(pointSet );
}
template<class TLinesList , class TPointSet >
void
LineSpatialObjectListToPointSetFilter<TLinesList,TPointSet>
::SetInput(const LinesListType *list)
{
this->itk::ProcessObject::SetNthInput(0,
const_cast<LinesListType * >( list ) );
}
template<class TLinesList , class TPointSet >
const typename LineSpatialObjectListToPointSetFilter<TLinesList,TPointSet>:: LinesListType*
LineSpatialObjectListToPointSetFilter<TLinesList,TPointSet>
::GetInput(void)
{
return static_cast<const LinesListType *>
(this->itk::ProcessObject::GetInput(0) );
}
template<class TLinesList , class TPointSet >
void
LineSpatialObjectListToPointSetFilter<TLinesList,TPointSet>
::SetOutput(const PointSetType *pointSet)
{
this->ProcessObjectType::SetNthOutput(0,
const_cast< PointSetType * >( pointSet ) );
}
template<class TLinesList , class TPointSet >
typename LineSpatialObjectListToPointSetFilter<TLinesList,TPointSet>:: PointSetType*
LineSpatialObjectListToPointSetFilter<TLinesList,TPointSet>
::GetOutput(void)
{
return static_cast<PointSetType *>
(this->ProcessObjectType::GetOutput(0) );
}
/**
*
*/
template<class TLinesList , class TPointSet >
void
LineSpatialObjectListToPointSetFilter<TLinesList,TPointSet>
::PrintSelf(std::ostream& os, itk::Indent indent) const
{
Superclass::PrintSelf(os,indent);
}
} // end namespace otb
#endif
......@@ -44,7 +44,6 @@
#include "otbLocalHoughFilter.h"
#include "otbFillGapsFilter.h"
#include "otbDrawLineSpatialObjectListFilter.h"
#include "otbLineSegmentDetector.h"
#include "itkRescaleIntensityImageFilter.h"
#include "otbLineSpatialObjectList.h"
......@@ -112,10 +111,7 @@ int main( int argc, char * argv[] )
InternalImageType > DetectorType;
typedef otb::PixelSuppressionByDirectionImageFilter< InternalImageType,
InternalImageType > PixelSuppressionType;
//typedef otb::LocalHoughFilter< InternalImageType > LocalHoughType;
typedef otb::LineSegmentDetector<InternalImageType, InternalPixelType> LocalHoughType;
typedef otb::LocalHoughFilter< InternalImageType > LocalHoughType;
typedef otb::FillGapsFilter FillGapsType;
typedef otb::DrawLineSpatialObjectListFilter< InternalImageType,
OutputImageType > DrawLineListType;
......@@ -200,7 +196,7 @@ int main( int argc, char * argv[] )
rescaler->SetInput(pixelSuppression->GetOutput() );
localHough->SetInput( pixelSuppression->GetOutput() );
localHough->SetInput( rescaler->GetOutput() );
fillGaps->SetInput ( localHough->GetOutput() );
......@@ -247,12 +243,12 @@ int main( int argc, char * argv[] )
pixelSuppression->SetRadius( PixelSuppressionRadius );
pixelSuppression->SetAngularBeam( PixelSuppressionAngularBeam );
//PixelSuppressionType::SizeType LocalHoughRadius;
//LocalHoughRadius[0] = LocalHoughRadiusX;
//LocalHoughRadius[1] = LocalHoughRadiusY;
PixelSuppressionType::SizeType LocalHoughRadius;
LocalHoughRadius[0] = LocalHoughRadiusX;
LocalHoughRadius[1] = LocalHoughRadiusY;
//localHough->SetRadius( LocalHoughRadius );
//localHough->SetNumberOfLines( LocalHoughNumberOfLines );
localHough->SetRadius( LocalHoughRadius );
localHough->SetNumberOfLines( LocalHoughNumberOfLines );
fillGaps->SetRadius( FillGapsRadius );
fillGaps->SetAngularBeam( FillGapsAngularBeam );
......
......@@ -270,6 +270,11 @@ ADD_TEST(coTuPathListToHistogramGeneratorNew ${COMMON_TESTS3}
ADD_TEST(coTuPathListToHistogramGenerator ${COMMON_TESTS3}
otbPathListToHistogramGenerator 100 2)
# ------- otb::LineSpatialObjectListToPointSetFilter ------------------------------
ADD_TEST(coTuLineSpatialObjectListToPointSetFilter ${COMMON_TESTS3}
otbLineSpatialObjectListToPointSetFilterNew)
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ otbCommonTests4 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
......@@ -599,6 +604,7 @@ otbDrawLineSpatialObjectList.cxx
otbImageToLineSpatialObjectListNew.cxx
otbPathListToHistogramGeneratorNew.cxx
otbPathListToHistogramGenerator.cxx
otbLineSpatialObjectListToPointSetFilterNew.cxx
)
SET(BasicCommon_SRCS4
otbHistogramStatisticsFunction.cxx
......
......@@ -36,4 +36,5 @@ void RegisterTests()
REGISTER_TEST(otbImageToLineSpatialObjectListNew);
REGISTER_TEST(otbPathListToHistogramGeneratorNew);
REGISTER_TEST(otbPathListToHistogramGenerator);
REGISTER_TEST(otbLineSpatialObjectListToPointSetFilterNew);
}
/*=========================================================================
Program: ORFEO Toolbox
Language: C++
Date: $Date$
Version: $Revision$
Copyright (c) Centre National d'Etudes Spatiales. All rights reserved.
See OTBCopyright.txt 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.
=========================================================================*/
#if defined(_MSC_VER)
#pragma warning ( disable : 4786 )
#endif
#include "itkPointSet.h"
#include "otbLineSpatialObjectList.h"
#include <iostream>
#include "otbLineSpatialObjectListToPointSetFilter.h"
int otbLineSpatialObjectListToPointSetFilterNew( int argc, char* argv[] )
{
typedef float InputPixelType;
typedef otb::LineSpatialObjectList LinesListType;
typedef itk::PointSet<InputPixelType> PointSetType;
typedef otb::LineSpatialObjectListToPointSetFilter<LinesListType,
PointSetType> FilterType;
FilterType::Pointer filter = FilterType::New();
return EXIT_SUCCESS;
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment