Commit 4836215c authored by Romain Garrigues's avatar Romain Garrigues
Browse files

Modifications du code pour la compilation sous Visual C++ 6.0 (windows)

parent 199c9e20
......@@ -175,15 +175,15 @@ void FrostImageFilter< TInputImage, TOutputImage>::ThreadedGenerateData(
}
dPixel = (FrostFiltre/NormFiltre);
/*dPixel = (FrostFiltre/NormFiltre);
if (finite(dPixel)==0){
dPixel = 0.;
}
}*/
// Modif pour VC++
/*if (NormFiltre==0.)
if (NormFiltre==0.)
dPixel=0.;
else
dPixel=FrostFiltre/NormFiltre;*/
dPixel=FrostFiltre/NormFiltre;
it.Set( static_cast<OutputPixelType>( dPixel ) );
......
......@@ -60,7 +60,9 @@ public:
typedef TOutputImage OutputImageType;
typedef typename OutputImageType::Pointer OutputImagePointer;
typedef typename OutputImageType::RegionType OutputImageRegionType;
typedef typename OutputImageType::PixelType OutputImagePixelType;
typedef typename OutputImageType::PixelType OutputImagePixelType;
typedef itk::ProcessObject ProcessObjectType;
/** Connect one of the operands for pixel-wise addition */
......
......@@ -75,7 +75,7 @@ BinaryFunctorNeighborhoodImageFilter<TInputImage1, TInputImage2, TOutputImage, T
int threadId)
{
unsigned int i;
//unsigned int i;
itk::ZeroFluxNeumannBoundaryCondition<TInputImage1> nbc1;
itk::ZeroFluxNeumannBoundaryCondition<TInputImage2> nbc2;
......@@ -83,9 +83,9 @@ BinaryFunctorNeighborhoodImageFilter<TInputImage1, TInputImage2, TOutputImage, T
// ImageToImageFilter::GetInput(int) always returns a pointer to a
// TInputImage1 so it cannot be used for the second input.
Input1ImagePointer inputPtr1
= dynamic_cast<const TInputImage1*>(itk::ProcessObject::GetInput(0));
= dynamic_cast<const TInputImage1*>(ProcessObjectType::GetInput(0));
Input2ImagePointer inputPtr2
= dynamic_cast<const TInputImage2*>(itk::ProcessObject::GetInput(1));
= dynamic_cast<const TInputImage2*>(ProcessObjectType::GetInput(1));
OutputImagePointer outputPtr = this->GetOutput(0);
......
......@@ -63,6 +63,7 @@ public:
typedef typename OutputImageType::RegionType OutputImageRegionType;
typedef typename OutputImageType::PixelType OutputImagePixelType;
typedef itk::ProcessObject ProcessObjectType;
/** Connect one of the operands for pixel-wise addition */
void SetInput1( const TInputImage1 * image1);
......
......@@ -77,7 +77,7 @@ BinaryFunctorNeighborhoodJoinHistogramImageFilter<TInputImage1,TInputImage2,TOut
{
// Calculate min and max image values in input1 image.
Input1ImagePointer pInput1Image
= dynamic_cast<const TInputImage1*>(itk::ProcessObject::GetInput(0));
= dynamic_cast<const TInputImage1*>(ProcessObjectType::GetInput(0));
Input1ImagePixelType minInput1, maxInput1;
itk::ImageRegionConstIterator<Input1ImageType> fiIt(pInput1Image,
......@@ -104,7 +104,7 @@ BinaryFunctorNeighborhoodJoinHistogramImageFilter<TInputImage1,TInputImage2,TOut
// Calculate min and max image values in input2 image.
Input2ImagePointer pInput2Image
= dynamic_cast<const TInputImage2*>(itk::ProcessObject::GetInput(1));
= dynamic_cast<const TInputImage2*>(ProcessObjectType::GetInput(1));
Input2ImagePixelType minInput2, maxInput2;
itk::ImageRegionConstIterator<Input2ImageType> miIt(pInput2Image,
pInput2Image->GetBufferedRegion());
......@@ -186,7 +186,7 @@ BinaryFunctorNeighborhoodJoinHistogramImageFilter<TInputImage1, TInputImage2, TO
this->Initialize();
//m_Functor->SetHistogram(m_Histogram);
unsigned int i;
// unsigned int i;
itk::ZeroFluxNeumannBoundaryCondition<TInputImage1> nbc1;
itk::ZeroFluxNeumannBoundaryCondition<TInputImage2> nbc2;
......@@ -194,9 +194,9 @@ BinaryFunctorNeighborhoodJoinHistogramImageFilter<TInputImage1, TInputImage2, TO
// ImageToJoinHistogramImageFilter::GetInput(int) always returns a pointer to a
// TInputImage1 so it cannot be used for the second input.
Input1ImagePointer inputPtr1
= dynamic_cast<const TInputImage1*>(itk::ProcessObject::GetInput(0));
= dynamic_cast<const TInputImage1*>(ProcessObjectType::GetInput(0));
Input2ImagePointer inputPtr2
= dynamic_cast<const TInputImage2*>(itk::ProcessObject::GetInput(1));
= dynamic_cast<const TInputImage2*>(ProcessObjectType::GetInput(1));
OutputImagePointer outputPtr = this->GetOutput(0);
......
......@@ -234,10 +234,10 @@ protected:
inline TOutput Qxijkl(VectorType va, VectorType vb, VectorType vc, VectorType vd)
{
IteratorType ita;
IteratorType itb;
IteratorType itc;
IteratorType itd;
// IteratorType ita;
// IteratorType itb;
// IteratorType itc;
// IteratorType itd;
TOutput Eabcd_c = Exyztc(va, vb, vc, vd);
......
......@@ -155,11 +155,12 @@ CommandLineArgumentParser
// Clear the result
outResult->Clear();
int i;
m_ProgramName = std::string(argv[0]);
int index(0);
// Go through the arguments
for(int i=1; i < argc; i++)
for(i=1; i < argc; i++)
{
// Get the next argument
std::string arg(argv[i]);
......@@ -230,7 +231,7 @@ CommandLineArgumentParser
}
// Controle que toutes les options obligatoire sont présentes dans la ligne d'argument
for(int i=0 ; i < m_OptionList.size() ; i++ )
for(i=0 ; i < m_OptionList.size() ; i++ )
{
if ( (m_OptionList[i].Obligatory == true) && (m_OptionList[i].Finded == false) )
{
......@@ -278,14 +279,16 @@ CommandLineArgumentParser
os << " Usage : "<<m_ProgramName<<std::endl;
// Calcul de la largeur max en caractere de l'affichage des options (pour mise en page)
int largeurmax(-1);
for(int i=0 ; i < m_OptionList.size() ; i++ )
int i;
for(i=0 ; i < m_OptionList.size() ; i++ )
{
int largeur = m_OptionList[i].CommonName.size() + m_OptionList[i].Synonim.size();
if ( largeur > largeurmax ) largeurmax = largeur;
}
// Controle que toutes les options obligatoire sont présentes dans la ligne d'argument
for(int i=0 ; i < m_OptionList.size() ; i++ )
for(i=0 ; i < m_OptionList.size() ; i++ )
{
int largeur = m_OptionList[i].CommonName.size() + m_OptionList[i].Synonim.size();
os << " ";
......
......@@ -56,9 +56,8 @@ public:
void PrintSelf(std::ostream& os/*, itk::Indent indent*/) const;
template< typename TypeValeur >
TypeValeur GetParameter(const char *option, unsigned int number=0)const;
TypeValeur GetParameter(const char *option, unsigned int number=0) const;
std::string GetStringParameter(const char *option, unsigned int number=0) const;
......@@ -162,6 +161,12 @@ private:
};
// Not defined in class CommandArgumentParser to avoid known bug on VC++ 6.0
// (explicit template instanciation on class methods are forbidden in this compiler)
/*template< typename TypeValeur >
TypeValeur GetParameter(CommandLineArgumentParseResult* parser,
const char *option, unsigned int number=0);*/
}
......
......@@ -9,7 +9,7 @@ namespace otb
{
template< typename TypeValeur >
template<typename TypeValeur >
TypeValeur
CommandLineArgumentParseResult
::GetParameter(const char *option, unsigned int number)const
......@@ -22,6 +22,19 @@ CommandLineArgumentParseResult
return lValeur;
}
/*template<typename TypeValeur >
TypeValeur
GetParameter(CommandLineArgumentParseResult* parser,
TypeValeur *option, unsigned int number)
{
std::string parameter = parser->GetStringParameter((char*)(option), number);
TypeValeur lValeur;
::otb::StringStream flux;
flux << parameter;
flux >> lValeur;
return lValeur;
}*/
} // end namespace otb
......
......@@ -55,6 +55,8 @@ public:
typedef typename Superclass::InputSpatialObjectType InputLineType;
typedef typename InputLineType::PointListType PointListType;
typedef itk::ProcessObject ProcessObjectType;
/** Method for management of the "object factory". */
......
......@@ -43,7 +43,7 @@ void
DrawLineSpatialObjectFilter<TInputImage, TOutputImage>
::SetInputLine(const InputLineType *line)
{
this->itk::ProcessObject::SetNthInput(0,
this->ProcessObjectType::SetNthInput(0,
const_cast< InputLineType * >( line ) );
}
......@@ -54,7 +54,7 @@ DrawLineSpatialObjectFilter<TInputImage, TOutputImage>
::GetInput(void)
{
return static_cast<InputLineType *>
(this->itk::ProcessObject::GetInput(0) );
(this->ProcessObjectType::GetInput(0) );
}
......@@ -63,7 +63,7 @@ void
DrawLineSpatialObjectFilter<TInputImage, TOutputImage>
::SetInputImage(const InputImageType *image)
{
this->itk::ProcessObject::SetNthInput(1,
this->ProcessObjectType::SetNthInput(1,
const_cast< InputImageType * >( image ) );
}
......@@ -79,7 +79,7 @@ DrawLineSpatialObjectFilter<TInputImage, TOutputImage>
}
return static_cast<const InputImageType *>
(this->itk::ProcessObject::GetInput(1) );
(this->ProcessObjectType::GetInput(1) );
}
template <class TInputImage, class TOutputImage>
......@@ -148,8 +148,10 @@ DrawLineSpatialObjectFilter<TInputImage, TOutputImage>
if ( (DeltaX >= DeltaY) && (DeltaX > 0.) )
{
double Xmin, Xmax;
Xmin = std::min(x1,x2);
Xmax = std::max(x1,x2);
/*Xmin = std::min(x1,x2);
Xmax = std::max(x1,x2);*/
Xmin = x1 < x2 ? x1 : x2;
Xmax = x1 > x2 ? x1 : x2;
// Slope of the line y=slope*(x-x1)+y1
double Slope = (y2-y1) / (x2-x1) ;
......@@ -171,9 +173,11 @@ DrawLineSpatialObjectFilter<TInputImage, TOutputImage>
else if ( DeltaX < DeltaY )
{
double Ymin, Ymax;
Ymin = std::min(y1,y2);
Ymax = std::max(y1,y2);
/*Ymin = std::min(y1,y2);
Ymax = std::max(y1,y2);*/
Ymin = y1 < y2 ? y1 : y2;
Ymax = y1 > y2 ? y1 : y2;
double SlopeInv = (x2-x1) / (y2-y1) ;
for ( double y = Ymin; y <= Ymax; y++)
......
......@@ -66,6 +66,7 @@ public:
typedef itk::RescaleIntensityImageFilter< InputImageType,
OutputImageType > RescalerType;
typedef itk::ProcessObject ProcessObjectType;
/** Method for management of the "object factory". */
itkNewMacro(Self);
......
......@@ -43,7 +43,7 @@ void
DrawLineSpatialObjectListFilter<TInputImage, TOutputImage>
::SetInputLineSpatialObjectList(const LinesListType * list)
{
this->itk::ProcessObject::SetNthInput(1,
this->ProcessObjectType::SetNthInput(1,
const_cast< LinesListType * >( list ) );
}
......@@ -54,8 +54,9 @@ typename DrawLineSpatialObjectListFilter<TInputImage, TOutputImage>::LinesListTy
DrawLineSpatialObjectListFilter<TInputImage, TOutputImage>
::GetInputLineSpatialObjectList(void)
{
return static_cast<const LinesListType *>
(this->itk::ProcessObject::GetInput(1) );
//ROMAIN
return static_cast</*const */LinesListType *>
(this->ProcessObjectType::GetInput(1) );
}
template <class TInputImage, class TOutputImage>
......
......@@ -19,6 +19,9 @@
#include "itkImageIteratorWithIndex.h"
#include "itkImageRegionIteratorWithIndex.h"
#include "itkImageRegionConstIteratorWithIndex.h"
namespace otb
{
......@@ -92,13 +95,20 @@ DrawPathFilter<TInputImage,TInputPath,TOutputImage>
cindex = vertexList->GetElement(i+1);
RealType x2 = cindex[0];
RealType y2 = cindex[1];
RealType DeltaX = std::abs(x1-x2);
RealType DeltaY = std::abs(y1-y2);
RealType Xmin = std::min( x1 , x2 );
RealType Xmax = std::max( x1 , x2 );
RealType Ymin = std::min( y1 , y2 );
RealType Ymax = std::max( y1 , y2 );
RealType DeltaX = fabs(x1-x2);
RealType DeltaY = fabs(y1-y2);
// Modifs pour compil sous VC++
//RealType Xmin = std::min( x1 , x2 );
//RealType Xmax = std::max( x1 , x2 );
//RealType Ymin = std::min( y1 , y2 );
//RealType Ymax = std::max( y1 , y2 );
RealType Xmin = x1<x2 ? x1 : x2 ;
RealType Xmax = x1>x2 ? x1 : x2 ;
RealType Ymin = y1<y2 ? y1 : y2 ;
RealType Ymax = y1>y2 ? y1 : y2 ;
if(DeltaX>0 && DeltaY>0)
{
......
......@@ -65,6 +65,8 @@ public:
typedef typename OutputImageType::SizeType OutputImageSizeType;
typedef typename OutputImageType::ValueType OutputImageValueType;
typedef typename OutputImageType::IndexType OutputImageIndexType;
typedef itk::ProcessObject ProcessObjectType;
/** ImageDimension constants */
itkStaticConstMacro(InputImageDimension, unsigned int,
......
......@@ -48,7 +48,7 @@ void
DrawPathListFilter<TInputImage,TInputPath,TOutputImage>
::SetImageInput(const InputImageType *image)
{
this->itk::ProcessObject::SetNthInput(0,
this->ProcessObjectType::SetNthInput(0,
const_cast< InputImageType * >( image ) );
}
......@@ -64,7 +64,7 @@ DrawPathListFilter<TInputImage,TInputPath,TOutputImage>
}
return static_cast<const InputImageType *>
(this->itk::ProcessObject::GetInput(0) );
(this->ProcessObjectType::GetInput(0) );
}
......@@ -74,11 +74,11 @@ void
DrawPathListFilter<TInputImage,TInputPath,TOutputImage>
::SetPathInput( InputPathListType *path)
{
// this->itk::ProcessObject::SetNthInput(1,
// this->ProcessObjectType::SetNthInput(1,
// const_cast< InputPathListType * >( path ) );
// Attention: A modifier
this->itk::ProcessObject::SetNthInput(1,NULL);
this->ProcessObjectType::SetNthInput(1,NULL);
m_PathList = path;
}
......@@ -99,7 +99,7 @@ DrawPathListFilter<TInputImage,TInputPath,TOutputImage>
return (ptr);
// return static_cast<const TInputPath * >
// (this->itk::ProcessObject::GetInput(1) );
// (this->ProcessObjectType::GetInput(1) );
}
......@@ -109,7 +109,7 @@ void
DrawPathListFilter<TInputImage,TInputPath,TOutputImage>
::SetImageOutput(OutputImageType *image)
{
this->itk::ProcessObject::SetNthOutput(0,
this->ProcessObjectType::SetNthOutput(0,
static_cast< OutputImageType * >( image ) );
}
......@@ -125,7 +125,7 @@ DrawPathListFilter<TInputImage,TInputPath,TOutputImage>
}
return static_cast<OutputImageType * >
(this->itk::ProcessObject::GetOutput(0) );
(this->ProcessObjectType::GetOutput(0) );
}
......@@ -193,13 +193,18 @@ DrawPathListFilter<TInputImage,TInputPath,TOutputImage>
RealType x2 = cindex[0];
RealType y2 = cindex[1];
RealType DeltaX = std::abs(x1-x2);
/*RealType DeltaX = std::abs(x1-x2);
RealType DeltaY = std::abs(y1-y2);
RealType Xmin = std::min( x1 , x2 );
RealType Xmax = std::max( x1 , x2 );
RealType Ymin = std::min( y1 , y2 );
RealType Ymax = std::max( y1 , y2 );
RealType Ymax = std::max( y1 , y2 );*/
RealType DeltaX = fabs(x1-x2);
RealType DeltaY = fabs(y1-y2);
RealType Xmin = x1<x2 ? x1 : x2;
RealType Xmax = x1>x2 ? x1 : x2;
RealType Ymin = y1<y2 ? y1 : y2;
RealType Ymax = y1>y2 ? y1 : y2;
if(DeltaX>0 && DeltaY>0)
{
......
......@@ -68,6 +68,7 @@ public:
/** Definition of the size of the images. */
typedef typename InputImageType::SizeType SizeType;
typedef itk::ProcessObject ProcessObjectType;
/** Set/Get the input image */
void SetInput(const InputImageType *image);
......
......@@ -56,7 +56,7 @@ void
ImageToLineSpatialObjectListFilter<TInputImage>
::SetOutput(const LinesListType *list)
{
this->itk::ProcessObject::SetNthOutput(0,
this->ProcessObjectType::SetNthOutput(0,
const_cast< LinesListType * >( list ) );
}
......@@ -67,7 +67,7 @@ ImageToLineSpatialObjectListFilter<TInputImage>
::GetOutput(void)
{
return static_cast<LinesListType *>
(this->itk::ProcessObject::GetOutput(0) );
(this->ProcessObjectType::GetOutput(0) );
}
......
......@@ -34,6 +34,8 @@ public:
typedef itk::SmartPointer<Self> Pointer;
typedef itk::SmartPointer<const Self> ConstPointer;
typedef itk::ProcessObject ProcessObjectType;
/** Method for creation through the object factory. */
itkNewMacro(Self);
......
......@@ -14,7 +14,7 @@
#define __otbImageToPathListFilter_txx
#include "otbImageToPathListFilter.h"
#include "itkProcessObject.h"
namespace otb
{
......@@ -39,11 +39,10 @@ ImageToPathListFilter<TInputImage,TOutputPath>
//OTB-FA-00010-CS
::SetInput(const InputImageType *image)
{
// We have 1 input: an image
// Process object is not const-correct so the const_cast is required here
this->itk::ProcessObject::SetNthInput(0,
const_cast< InputImageType * >( image ) );
// We have 1 input: an image
// Process object is not const-correct so the const_cast is required here
this->ProcessObjectType::SetNthInput(0,const_cast< InputImageType * >( image ) );
}
template <class TInputImage, class TOutputPath>
......@@ -52,13 +51,15 @@ ImageToPathListFilter<TInputImage,TOutputPath>
//OTB-FA-00010-CS
::GetInput(void)
{
if (this->GetNumberOfInputs() < 1)
if (this->GetNumberOfInputs() < 1)
{
return 0;
}
return static_cast<const TInputImage * >
(this->itk::ProcessObject::GetInput(0) );
(this->ProcessObjectType::GetInput(0) );
}
/**
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment