Commit 6371eb51 authored by Thomas Feuvrier's avatar Thomas Feuvrier

Fusion de la branche (branche-1.0) r1124:HEAD dans le trunk.

parent 52abf31e

Too many changes to show.

To preserve performance only 1000 of 1000+ files are displayed.

......@@ -49,7 +49,7 @@ ENDIF("${CMAKE_MAJOR_VERSION}.${CMAKE_MINOR_VERSION}" MATCHES "^1\\.8$")
# OTB version number. An even minor number corresponds to releases.
SET(OTB_VERSION_MAJOR "1")
SET(OTB_VERSION_MINOR "0")
SET(OTB_VERSION_PATCH "1")
SET(OTB_VERSION_PATCH "2")
# Version string should not include patch level. The major.minor is
# enough to distinguish available features of the toolkit.
......@@ -273,8 +273,8 @@ IF(WIN32)
ENDIF(WIN32)
OPTION(BUILD_EXAMPLES "Generer les exemples." ON)
OPTION(BUILD_TESTING "Generer les tests." ON)
OPTION(BUILD_EXAMPLES "Generer les exemples." OFF)
OPTION(BUILD_TESTING "Generer les tests." OFF)
#-----------------------------------------------------------------------------
# Dispatch the build into the proper subdirectories.
......
......@@ -18,10 +18,11 @@
#include "otbSystem.h"
#include <string.h> // strdup
#include <ctype.h> //toupper, tolower
#if (defined(WIN32) || defined(WIN32CE)) && !defined(__CYGWIN__) && !defined(__MINGW32__)
#if (defined(WIN32) || defined(WIN32CE)) && !defined(__CYGWIN__)
/*=====================================================================
WIN32 / MSVC++ implementation
*====================================================================*/
......@@ -104,7 +105,31 @@ System::GetShortFileName( const std::string& filename )
return( shortFileName );
}
#if (defined(WIN32) || defined(WIN32CE)) && !defined(__CYGWIN__)
// Set to upper a string
std::string System::SetToUpper( const std::string& str )
{
std::string lString(str);
for(int i=0 ; i<lString.size() ; i++)
{
lString[i]=toupper(lString[i]);
}
return(lString);
}
// Set to lower a string
std::string System::SetToLower( const std::string& str )
{
std::string lString(str);
for(int i=0 ; i<lString.size() ; i++)
{
lString[i]=tolower(lString[i]);
}
return(lString);
}
#if (defined(WIN32) || defined(WIN32CE)) && !defined(__CYGWIN__) && !defined(__MINGW32__)
/*=====================================================================
WIN32 / MSVC++ implementation
......
......@@ -38,7 +38,7 @@ namespace otb
/** \class System
* \brief System operations.
*
* System operations, filename manipulations, etc.
* System operations, filename or strings manipulations, etc.
*
*/
class ITK_EXPORT System
......@@ -60,6 +60,10 @@ public:
static std::string GetPathName( const std::string& filename );
/** Get the short filename of the file name */
static std::string GetShortFileName( const std::string& filename );
/** Set to upper a string */
static std::string SetToUpper( const std::string& str );
/** Set to upper a string */
static std::string SetToLower( const std::string& str );
/** Get list of file find in a directory */
static std::vector<std::string> Readdir(std::string pszPath);
......
......@@ -67,9 +67,10 @@ public:
itkGetConstReferenceMacro(SigmaI, double);
itkSetMacro(Alpha,double);
itkGetConstReferenceMacro(Alpha, double);
itkSetMacro(Threshold,InputPixelType);
itkGetConstReferenceMacro(Threshold, InputPixelType);
itkSetMacro(LowerThreshold,InputPixelType);
itkGetConstReferenceMacro(LowerThreshold, InputPixelType);
itkSetMacro(UpperThreshold,InputPixelType);
itkGetConstReferenceMacro(UpperThreshold, InputPixelType);
protected:
HarrisImageToPointSetFilter();
......@@ -83,7 +84,8 @@ private:
HarrisImageToPointSetFilter(const Self&); //purposely not implemented
void operator=(const Self&); //purposely not implemented
InputPixelType m_Threshold;
InputPixelType m_LowerThreshold;
InputPixelType m_UpperThreshold;
double m_SigmaD;
double m_SigmaI;
double m_Alpha;
......
......@@ -34,7 +34,9 @@ HarrisImageToPointSetFilter<TInputImage, TOutputPointSet>
m_SigmaD = 1.0;
m_SigmaI = 1.0;
m_Alpha = 1.0;
m_Threshold = itk::NumericTraits<InputPixelType>::max();
m_LowerThreshold = itk::NumericTraits<InputPixelType>::NonpositiveMin();
m_UpperThreshold = itk::NumericTraits<InputPixelType>::max();
m_HarrisFilter = HarrisImageFilterType::New();
m_ThresholdFilter = ThresholdImageToPointSetType::New();
......@@ -54,7 +56,8 @@ HarrisImageToPointSetFilter<TInputImage, TOutputPointSet>
m_HarrisFilter->SetAlpha( m_Alpha );
m_ThresholdFilter->SetInput(0,m_HarrisFilter->GetOutput() );
m_ThresholdFilter->SetThreshold(m_Threshold );
m_ThresholdFilter->SetLowerThreshold(m_LowerThreshold);
m_ThresholdFilter->SetUpperThreshold(m_UpperThreshold);
m_ThresholdFilter->SetOutput(pointList );
m_ThresholdFilter->Update();
......@@ -74,7 +77,8 @@ HarrisImageToPointSetFilter<TInputImage, TOutputPointSet>
os << indent << "Sigma_D : " << this->m_SigmaD << std::endl;
os << indent << "Sigma_I : " << this->m_SigmaI << std::endl;
os << indent << "Alpha : " << this->m_Alpha << std::endl;
os << indent << "Threshold : " << this->m_Threshold << std::endl;
os << indent << "LowerThreshold : " << this->m_LowerThreshold << std::endl;
os << indent << "UpperThreshold : " << this->m_UpperThreshold << std::endl;
}
......
......@@ -123,7 +123,7 @@ protected:
virtual void GenerateOutputInformation(){}; // do nothing
virtual void GenerateData();
virtual std::vector<double> tab(int n,double p,double m);
virtual void AngleCalculate( const InputImageType* InputImageIn,RealImageTypePointer AngleImage);
virtual void AngleCalculate( const InputImageType* InputImageIn);
SizeType m_Size;
double m_Spacing[InputImageDimension];
......@@ -142,6 +142,8 @@ private:
double m_MinGradNorm; /// Minimum gradient norm to define a direction, default 2.
double m_Eps; /// -log10(max. number of false alarms), default 0
std::vector<float> m_seglist;
RealImageType * m_AngleImage; //Angle image use by GenerateData and AngleCalculate methods
};
} // end namespace otb
......
......@@ -222,7 +222,7 @@ ImageToPathListAlignFilter<TInputImage,TOutputPath>
template <class TInputImage, class TOutputPath>
void
ImageToPathListAlignFilter<TInputImage,TOutputPath>
::AngleCalculate(const InputImageType* InputImage, RealImageTypePointer AngleImage)
::AngleCalculate(const InputImageType* InputImage)
{
float threshold;
int n,p,x,y;
......@@ -238,10 +238,10 @@ ImageToPathListAlignFilter<TInputImage,TOutputPath>
IndexOut[1] = 0;
// region.SetIndex(InputImage->GetLargestPossibleRegion().GetIndex());
region.SetIndex(IndexOut);
AngleImage->SetRegions( region );
AngleImage->SetOrigin(InputImage->GetOrigin());
AngleImage->SetSpacing(InputImage->GetSpacing());
AngleImage->Allocate();
m_AngleImage->SetRegions( region );
m_AngleImage->SetOrigin(InputImage->GetOrigin());
m_AngleImage->SetSpacing(InputImage->GetSpacing());
m_AngleImage->Allocate();
n = Taille[0];
p = Taille[1];
......@@ -255,13 +255,13 @@ ImageToPathListAlignFilter<TInputImage,TOutputPath>
idx[0] = (n-1) ;
idx[1] = x ;
// indice = (n-1)*p +x
AngleImage->SetPixel(idx,static_cast<RealType>(-1000.0));
m_AngleImage->SetPixel(idx,static_cast<RealType>(-1000.0));
}
for (y=0;y<n;y++){
idx[0] = y;
idx[1] = p-1;
// indice = p*y+p-1
AngleImage->SetPixel(idx,static_cast<RealType>(-1000.0));
m_AngleImage->SetPixel(idx,static_cast<RealType>(-1000.0));
}
typename InputImageType::IndexType adr;
......@@ -304,12 +304,11 @@ ImageToPathListAlignFilter<TInputImage,TOutputPath>
norm = gx*gx + gy*gy;
if (norm <=threshold)
AngleImage->SetPixel(adr,static_cast<RealType>(-1000.0));
else AngleImage->SetPixel(adr,static_cast<RealType>(atan2(gx,-gy)));
m_AngleImage->SetPixel(adr,static_cast<RealType>(-1000.0));
else m_AngleImage->SetPixel(adr,static_cast<RealType>(atan2(gx,-gy)));
}
}
template <class TInputImage, class TOutputPath>
void
ImageToPathListAlignFilter<TInputImage,TOutputPath>
......@@ -355,8 +354,9 @@ ImageToPathListAlignFilter<TInputImage,TOutputPath>
n = (int)ceil(hypot((double)nx,(double)ny))+1;
/*** compute angle map of u ***/
RealImageTypePointer AngleImage = RealImageType::New();
this->AngleCalculate( InputImage,AngleImage);
RealImageTypePointer lAngleImagePointer = RealImageType::New();
m_AngleImage = static_cast<RealImageType*>(lAngleImagePointer.GetPointer());
this->AngleCalculate( InputImage );
/*** compute P(k,l) ***/
test = tab(n,1.0/(double)(m_NbGradDirection),(double)(nx*ny)*(double)(nx*ny));
......@@ -430,7 +430,7 @@ ImageToPathListAlignFilter<TInputImage,TOutputPath>
assert( indexAngle[0] >= 0 );
assert( indexAngle[1] >= 0 );
error = static_cast<float>( AngleImage->GetPixel(indexAngle) );
error = static_cast<float>( m_AngleImage->GetPixel(indexAngle) );
if (error>-100.0) {
error -= theta;
while (error<=-M_PI) error += 2.0*M_PI;
......
......@@ -41,12 +41,10 @@ public:
TInputImage::ImageDimension);