Commit e686968f authored by Antoine Regimbeau's avatar Antoine Regimbeau

REFAC: Major cleaning of commented code

parent 707df065
......@@ -635,31 +635,6 @@ public:
otbGetParameterImageMacro(ComplexFloatVectorImage);
otbGetParameterImageMacro(ComplexDoubleVectorImage);
/* Get a complex image value
*
* Can be called for types :
* \li ParameterType_ComplexInputImage
*/
/*
#define otbGetParameterComplexImageMacro( Image ) \
Image##Type * GetParameter##Image( std::string parameter ) \
{ \
Image##Type::Pointer ret; \
Parameter* param = GetParameterByKey(parameter); \
ComplexInputImageParameter* paramDown = dynamic_cast<ComplexInputImageParameter*>(param); \
if (paramDown) \
{ \
ret = paramDown->Get##Image(); \
} \
return ret; \
}
otbGetParameterComplexImageMacro(ComplexFloatImage);
otbGetParameterComplexImageMacro(ComplexDoubleImage);
otbGetParameterComplexImageMacro(ComplexFloatVectorImage);
otbGetParameterComplexImageMacro(ComplexDoubleVectorImage);*/
/* Get an image list value
*
* Can be called for types :
......
......@@ -106,15 +106,6 @@ the macro otbGetParameterImageMacro of otbWrapperApplication.h */
template <class TComplexInputImage, class TOutputImage>
TOutputImage* CastImage();
/** Cast an image to an image of the same type
* Image to Image, VectorImage to VectorImage, RGBAImage to RGBAImage. */
// template <class TComplexInputImage, class TOutputImage>
// TOutputImage* SimpleCastImage();
/** Cast an image to a vector image. */
// template <class TComplexInputImage, class TOutputImage>
// TOutputImage* CastVectorImageFromImage();
bool HasValue() const ITK_OVERRIDE;
void ClearValue() ITK_OVERRIDE;
......@@ -132,9 +123,6 @@ protected:
/** Readers typedefs */
// typedef otb::ImageFileReader<ComplexFloatImageType> ComplexFloatReaderType;
// typedef otb::ImageFileReader<ComplexDoubleImageType> ComplexDoubleReaderType;
typedef otb::ImageFileReader<ComplexFloatVectorImageType> ComplexFloatVectorReaderType;
typedef otb::ImageFileReader<ComplexDoubleVectorImageType> ComplexDoubleVectorReaderType;
......@@ -153,33 +141,6 @@ private:
}; // End class ComplexInputImage Parameter
// template specializations of CastImage<> should be declared in header
// so that the linker knows they exist when building OTB Applications
/*#define otbDefineCastImageMacro(ComplexInputImageType, OutputImageType) \
template<> OutputImageType * \
ComplexInputImageParameter::CastImage<ComplexInputImageType , OutputImageType>(); \
#define otbGenericDefineCastImageMacro(ComplexInputImageType, prefix) \
otbDefineCastImageMacro(ComplexInputImageType, ComplexFloat##prefix##ImageType) \
otbDefineCastImageMacro(ComplexInputImageType, ComplexDouble##prefix##ImageType)
*/
/********************************************************************
********************** Image -> Image
*********************************************************************/
// otbGenericDefineCastImageMacro(ComplexFloatImageType, )
// otbGenericDefineCastImageMacro(ComplexDoubleImageType, )
/*********************************************************************
********************** VectorImage -> VectorImage
**********************************************************************/
// otbGenericDefineCastImageMacro(ComplexFloatVectorImageType, Vector)
// otbGenericDefineCastImageMacro(ComplexDoubleVectorImageType, Vector)
} // End namespace Wrapper
} // End namespace otb
......
......@@ -153,44 +153,6 @@ ComplexInputImageParameter::CastImage()
// <<" to "<<typeid(TOutputImage).name()<<" not authorized.");
}
/*template <class TComplexInputImage, class TOutputImage>
TOutputImage*
ComplexInputImageParameter::SimpleCastImage()
{
TComplexInputImage* realComplexInputImage = dynamic_cast<TComplexInputImage*>(m_Image.GetPointer());
typedef itk::CastImageFilter<TComplexInputImage, TOutputImage> CasterType;
typename CasterType::Pointer caster = CasterType::New();
caster->SetInput(realComplexInputImage);
caster->UpdateOutputInformation();
m_Image = caster->GetOutput();
m_Caster = caster;
return caster->GetOutput();
}
template <class TComplexInputImage, class TOutputImage>
TOutputImage*
ComplexInputImageParameter::CastVectorImageFromImage()
{
TComplexInputImage* realComplexInputImage = dynamic_cast<TComplexInputImage*>(m_Image.GetPointer());
typedef ImageToVectorImageCastFilter<TComplexInputImage, TOutputImage> CasterType;
typename CasterType::Pointer caster = CasterType::New();
caster->SetInput(realComplexInputImage);
caster->UpdateOutputInformation();
m_Image = caster->GetOutput();
m_Caster = caster;
return caster->GetOutput();
}*/
template <class TComplexInputImage>
void
ComplexInputImageParameter::SetImage(TComplexInputImage* image)
......
......@@ -122,24 +122,16 @@ protected:
template <class TInputVectorImageType>
void SwitchVectorImageWrite();
//FloatVectorImageType::Pointer m_Image;
ImageBaseType::Pointer m_Image;
std::string m_FileName;
ComplexImagePixelType m_ComplexPixelType;
ComplexImagePixelType m_DefaultComplexPixelType;
// typedef otb::ImageFileWriter<ComplexFloatImageType> ComplexFloatWriterType;
// typedef otb::ImageFileWriter<ComplexDoubleImageType> ComplexDoubleWriterType;
typedef otb::ImageFileWriter<ComplexInt16VectorImageType> ComplexVectorInt16WriterType;
typedef otb::ImageFileWriter<ComplexInt32VectorImageType> ComplexVectorInt32WriterType;
typedef otb::ImageFileWriter<ComplexFloatVectorImageType> ComplexVectorFloatWriterType;
typedef otb::ImageFileWriter<ComplexDoubleVectorImageType> ComplexVectorDoubleWriterType;
// ComplexFloatWriterType::Pointer m_ComplexFloatWriter;
// ComplexDoubleWriterType::Pointer m_ComplexDoubleWriter;
ComplexVectorInt16WriterType::Pointer m_ComplexVectorInt16Writer;
ComplexVectorInt32WriterType::Pointer m_ComplexVectorInt32Writer;
ComplexVectorFloatWriterType::Pointer m_ComplexVectorFloatWriter;
......
......@@ -107,17 +107,6 @@ public:
template <class TInputImage, class TOutputImage>
TOutputImage* CastImage();
/** Cast an image to an image of the same type
* Image to Image, VectorImage to VectorImage, RGBAImage to RGBAImage. */
// template <class TInputImage, class TOutputImage>
// TOutputImage* SimpleCastImage();
/** Cast an image to a vector image. */
// template <class TInputImage, class TOutputImage>
// TOutputImage* CastVectorImageFromImage();
bool HasValue() const ITK_OVERRIDE;
void ClearValue() ITK_OVERRIDE;
......@@ -181,90 +170,6 @@ private:
}; // End class InputImage Parameter
// template specializations of CastImage<> should be declared in header
// so that the linker knows they exist when building OTB Applications
/*
#define otbDeclareCastImageMacro(InputImageType, OutputImageType) \
template<> OTBApplicationEngine_EXPORT OutputImageType * \
InputImageParameter::CastImage<InputImageType , OutputImageType>(); \
#define otbGenericDeclareCastImageMacro(InputImageType, prefix) \
otbDeclareCastImageMacro(InputImageType, UInt8##prefix##ImageType) \
otbDeclareCastImageMacro(InputImageType, UInt16##prefix##ImageType) \
otbDeclareCastImageMacro(InputImageType, Int16##prefix##ImageType) \
otbDeclareCastImageMacro(InputImageType, UInt32##prefix##ImageType) \
otbDeclareCastImageMacro(InputImageType, Int32##prefix##ImageType) \
otbDeclareCastImageMacro(InputImageType, Float##prefix##ImageType) \
otbDeclareCastImageMacro(InputImageType, Double##prefix##ImageType)
*/
/*********************************************************************
********************** Image -> Image
**********************************************************************/
/*
otbGenericDeclareCastImageMacro(UInt8ImageType, )
otbGenericDeclareCastImageMacro(Int16ImageType, )
otbGenericDeclareCastImageMacro(UInt16ImageType, )
otbGenericDeclareCastImageMacro(Int32ImageType, )
otbGenericDeclareCastImageMacro(UInt32ImageType, )
otbGenericDeclareCastImageMacro(FloatImageType, )
otbGenericDeclareCastImageMacro(DoubleImageType, )
otbDeclareCastImageMacro( ComplexDoubleImageType , ComplexDoubleImageType )
otbDeclareCastImageMacro( ComplexDoubleImageType , ComplexFloatImageType )
otbDeclareCastImageMacro( ComplexFloatImageType , ComplexDoubleImageType )
otbDeclareCastImageMacro( ComplexFloatImageType , ComplexFloatImageType )
*/
/*********************************************************************
********************** VectorImage -> VectorImage
**********************************************************************/
/*
otbGenericDeclareCastImageMacro(UInt8VectorImageType, Vector)
otbGenericDeclareCastImageMacro(Int16VectorImageType, Vector)
otbGenericDeclareCastImageMacro(UInt16VectorImageType, Vector)
otbGenericDeclareCastImageMacro(Int32VectorImageType, Vector)
otbGenericDeclareCastImageMacro(UInt32VectorImageType, Vector)
otbGenericDeclareCastImageMacro(FloatVectorImageType, Vector)
otbGenericDeclareCastImageMacro(DoubleVectorImageType, Vector)
otbDeclareCastImageMacro( ComplexDoubleVectorImageType ,
ComplexDoubleVectorImageType )
otbDeclareCastImageMacro( ComplexDoubleVectorImageType ,
ComplexFloatVectorImageType )
otbDeclareCastImageMacro( ComplexFloatVectorImageType ,
ComplexDoubleVectorImageType )
otbDeclareCastImageMacro( ComplexFloatVectorImageType ,
ComplexFloatVectorImageType )
*/
/*********************************************************************
********************** Image -> VectorImage
**********************************************************************/
/*
otbGenericDeclareCastImageMacro(UInt8ImageType, Vector)
otbGenericDeclareCastImageMacro(Int16ImageType, Vector)
otbGenericDeclareCastImageMacro(UInt16ImageType, Vector)
otbGenericDeclareCastImageMacro(Int32ImageType, Vector)
otbGenericDeclareCastImageMacro(UInt32ImageType, Vector)
otbGenericDeclareCastImageMacro(FloatImageType, Vector)
otbGenericDeclareCastImageMacro(DoubleImageType, Vector)
otbDeclareCastImageMacro( ComplexDoubleImageType ,
ComplexDoubleVectorImageType )
otbDeclareCastImageMacro( ComplexDoubleImageType ,
ComplexFloatVectorImageType )
otbDeclareCastImageMacro( ComplexFloatImageType , ComplexDoubleVectorImageType )
otbDeclareCastImageMacro( ComplexFloatImageType , ComplexFloatVectorImageType )
#undef otbDeclareCastImageMacro
#undef otbGenericDeclareCastImageMacro
*/
} // End namespace Wrapper
} // End namespace otb
......
......@@ -24,8 +24,6 @@
#include "otbWrapperInputImageParameter.h"
#include "itkUnaryFunctorImageFilter.h"
// #include "itkCastImageFilter.h"
// #include "otbImageToVectorImageCastFilter.h"
#include "otbClampImageFilter.h"
namespace otb
......@@ -246,52 +244,6 @@ InputImageParameter::CastImage()
// itkExceptionMacro("Cast from "<<typeid(TInputImage).name()<<" to "<<typeid(TOutputImage).name()<<" not authorized.");
}
/*template <class TInputImage, class TOutputImage>
TOutputImage*
InputImageParameter::SimpleCastImage()
{
if ( dynamic_cast<TOutputImage*> (m_Image.GetPointer()) )
{
return dynamic_cast<TOutputImage*> (m_Image.GetPointer());
}
else
{
TInputImage* realInputImage = dynamic_cast<TInputImage*>(m_Image.GetPointer());
typedef ClampImageFilter<TInputImage, TOutputImage> CasterType;
typename CasterType::Pointer caster = CasterType::New();
caster->SetInput(realInputImage);
caster->UpdateOutputInformation();
m_Image = caster->GetOutput();
m_Caster = caster;
return caster->GetOutput();
}
}
template <class TInputImage, class TOutputImage>
TOutputImage*
InputImageParameter::CastVectorImageFromImage()
{
TInputImage* realInputImage = dynamic_cast<TInputImage*>(m_Image.GetPointer());
typedef ClampImageFilter<TInputImage, TOutputImage> CasterType;
typename CasterType::Pointer caster = CasterType::New();
caster->SetInput(realInputImage);
caster->UpdateOutputInformation();
m_Image = caster->GetOutput();
m_Caster = caster;
return caster->GetOutput();
}
*/
template <class TInputImage>
void
InputImageParameter::SetImage(TInputImage* image)
......
......@@ -119,18 +119,9 @@ protected:
/** Destructor */
~OutputImageParameter() ITK_OVERRIDE;
// template <class TInputImageType>
// void SwitchImageWrite();
// template <class TInputImageType>
// void SwitchCImageWrite();
template <class TInputVectorImageType>
void SwitchVectorImageWrite();
// template <class TInputVectorImageType>
// void SwitchVectorCImageWrite();
template <class TInputVectorImageType>
void SwitchRGBImageWrite();
......@@ -143,14 +134,6 @@ protected:
ImagePixelType m_PixelType;
ImagePixelType m_DefaultPixelType;
// typedef otb::ImageFileWriter<UInt8ImageType> UInt8WriterType;
// typedef otb::ImageFileWriter<Int16ImageType> Int16WriterType;
// typedef otb::ImageFileWriter<UInt16ImageType> UInt16WriterType;
// typedef otb::ImageFileWriter<Int32ImageType> Int32WriterType;
// typedef otb::ImageFileWriter<UInt32ImageType> UInt32WriterType;
// typedef otb::ImageFileWriter<FloatImageType> FloatWriterType;
// typedef otb::ImageFileWriter<DoubleImageType> DoubleWriterType;
typedef otb::ImageFileWriter<UInt8VectorImageType> VectorUInt8WriterType;
typedef otb::ImageFileWriter<Int16VectorImageType> VectorInt16WriterType;
typedef otb::ImageFileWriter<UInt16VectorImageType> VectorUInt16WriterType;
......@@ -162,26 +145,11 @@ protected:
typedef otb::ImageFileWriter<UInt8RGBAImageType> RGBAUInt8WriterType;
typedef otb::ImageFileWriter<UInt8RGBImageType> RGBUInt8WriterType;
// Complex Image
// typedef otb::ImageFileWriter<ComplexInt16ImageType> ComplexInt16WriterType;
// typedef otb::ImageFileWriter<ComplexInt32ImageType> ComplexInt32WriterType;
// typedef otb::ImageFileWriter<ComplexFloatImageType> ComplexFloatWriterType;
// typedef otb::ImageFileWriter<ComplexDoubleImageType> ComplexDoubleWriterType;
typedef otb::ImageFileWriter<ComplexInt16VectorImageType> ComplexVectorInt16WriterType;
typedef otb::ImageFileWriter<ComplexInt32VectorImageType> ComplexVectorInt32WriterType;
typedef otb::ImageFileWriter<ComplexFloatVectorImageType> ComplexVectorFloatWriterType;
typedef otb::ImageFileWriter<ComplexDoubleVectorImageType> ComplexVectorDoubleWriterType;
// UInt8WriterType::Pointer m_UInt8Writer;
// Int16WriterType::Pointer m_Int16Writer;
// UInt16WriterType::Pointer m_UInt16Writer;
// Int32WriterType::Pointer m_Int32Writer;
// UInt32WriterType::Pointer m_UInt32Writer;
// FloatWriterType::Pointer m_FloatWriter;
// DoubleWriterType::Pointer m_DoubleWriter;
VectorUInt8WriterType::Pointer m_VectorUInt8Writer;
VectorInt16WriterType::Pointer m_VectorInt16Writer;
VectorUInt16WriterType::Pointer m_VectorUInt16Writer;
......@@ -193,11 +161,6 @@ protected:
RGBUInt8WriterType::Pointer m_RGBUInt8Writer;
RGBAUInt8WriterType::Pointer m_RGBAUInt8Writer;
// ComplexInt16WriterType::Pointer m_ComplexInt16Writer;
// ComplexInt32WriterType::Pointer m_ComplexInt32Writer;
// ComplexFloatWriterType::Pointer m_ComplexFloatWriter;
// ComplexDoubleWriterType::Pointer m_ComplexDoubleWriter;
ComplexVectorInt16WriterType::Pointer m_ComplexVectorInt16Writer;
ComplexVectorInt32WriterType::Pointer m_ComplexVectorInt32Writer;
ComplexVectorFloatWriterType::Pointer m_ComplexVectorFloatWriter;
......
......@@ -31,13 +31,6 @@ set( OTBApplicationEngine_SRC
otbWrapperInputFilenameListParameter.cxx
otbWrapperOutputImageParameter.cxx
otbWrapperInputImageParameter.cxx
#otbWrapperInputImageParameterUInt8.cxx
#otbWrapperInputImageParameterInt16.cxx
#otbWrapperInputImageParameterUInt16.cxx
#otbWrapperInputImageParameterInt32.cxx
#otbWrapperInputImageParameterUInt32.cxx
#otbWrapperInputImageParameterFloat.cxx
#otbWrapperInputImageParameterDouble.cxx
otbWrapperParameterKey.cxx
otbWrapperDocExampleStructure.cxx
otbWrapperInputVectorDataParameter.cxx
......
......@@ -21,8 +21,6 @@
#include "otbWrapperComplexOutputImageParameter.h"
#include "itkUnaryFunctorImageFilter.h"
#include "otbClampImageFilter.h"
// #include "itkCastImageFilter.h"
// #include "itkVectorCastImageFilter.h"
#ifdef OTB_USE_MPI
......@@ -102,9 +100,6 @@ ComplexOutputImageParameter::ConvertStringToPixelType(const std::string &value,
void ComplexOutputImageParameter::InitializeWriters()
{
// m_ComplexFloatWriter = ComplexFloatWriterType::New();
// m_ComplexDoubleWriter = ComplexDoubleWriterType::New();
m_ComplexVectorInt16Writer = ComplexVectorInt16WriterType::New();
m_ComplexVectorInt32Writer = ComplexVectorInt32WriterType::New();
m_ComplexVectorFloatWriter = ComplexVectorFloatWriterType::New();
......@@ -213,27 +208,6 @@ ComplexOutputImageParameter::SwitchImageWrite()
}
}
// template <class TInputVectorImageType>
// void
// ComplexOutputImageParameter::SwitchVectorImageWrite()
// {
// switch(m_ComplexPixelType )
// {
// case ComplexImagePixelType_float:
// {
// CastAndWriteImage<TInputVectorImageType,ComplexFloatVectorImageType>(m_Image,m_ComplexVectorFloatWriter,m_FileName,m_RAMValue);
// break;
// }
// case ComplexImagePixelType_double:
// {
// CastAndWriteImage<TInputVectorImageType,ComplexDoubleVectorImageType>(m_Image,m_ComplexVectorDoubleWriter,m_FileName,m_RAMValue);
// break;
// }
// }
// }
void
ComplexOutputImageParameter::Write()
{
......@@ -279,16 +253,6 @@ ComplexOutputImageParameter::Write()
itk::ProcessObject*
ComplexOutputImageParameter::GetWriter()
{
// int type = 1;
// 0 : image
// 1 : VectorImage
// if ( dynamic_cast<ComplexFloatVectorImageType*>( m_Image.GetPointer()) ||
// dynamic_cast<ComplexDoubleVectorImageType*>(m_Image.GetPointer()))
// {
// type = 1;
// }
itk::ProcessObject* writer = ITK_NULLPTR;
switch ( GetComplexPixelType() )
{
......@@ -302,18 +266,12 @@ ComplexOutputImageParameter::GetWriter()
}
case ComplexImagePixelType_float:
{
// if( type == 1 )
writer = m_ComplexVectorFloatWriter;
// else
// writer = m_ComplexFloatWriter;
break;
}
case ComplexImagePixelType_double:
{
// if( type == 1 )
writer = m_ComplexVectorDoubleWriter;
// else
// writer = m_ComplexDoubleWriter;
break;
}
}
......
......@@ -149,14 +149,6 @@ OutputImageParameter::ConvertStringToPixelType(const std::string &value, ImagePi
void OutputImageParameter::InitializeWriters()
{
// m_UInt8Writer = UInt8WriterType::New();
// m_Int16Writer = Int16WriterType::New();
// m_UInt16Writer = UInt16WriterType::New();
// m_Int32Writer = Int32WriterType::New();
// m_UInt32Writer = UInt32WriterType::New();
// m_FloatWriter = FloatWriterType::New();
// m_DoubleWriter = DoubleWriterType::New();
m_VectorUInt8Writer = VectorUInt8WriterType::New();
m_VectorInt16Writer = VectorInt16WriterType::New();
m_VectorUInt16Writer = VectorUInt16WriterType::New();
......@@ -168,11 +160,6 @@ void OutputImageParameter::InitializeWriters()
m_RGBUInt8Writer = RGBUInt8WriterType::New();
m_RGBAUInt8Writer = RGBAUInt8WriterType::New();
// m_ComplexInt16Writer = ComplexInt16WriterType::New();
// m_ComplexInt32Writer = ComplexInt32WriterType::New();
// m_ComplexFloatWriter = ComplexFloatWriterType::New();
// m_ComplexDoubleWriter = ComplexDoubleWriterType::New();
m_ComplexVectorInt16Writer = ComplexVectorInt16WriterType::New();
m_ComplexVectorInt32Writer = ComplexVectorInt32WriterType::New();
m_ComplexVectorFloatWriter = ComplexVectorFloatWriterType::New();
......@@ -243,205 +230,6 @@ ClampAndWriteVectorImage( itk::ImageBase<2> * in ,
}
}
/*template <typename TInput, typename TOutput >
void
ClampAndWriteImage( itk::ImageBase<2> * in ,
otb::ImageFileWriter<TOutput > * writer ,
const std::string & filename ,
const unsigned int & ramValue ,
typename itk::ImageToImageFilter< TInput , TOutput > * clampFilter = otb::ClampImageFilter< TInput , TOutput >::New() )
{
clampFilter->SetInput( dynamic_cast<TInput*>(in));
bool useStandardWriter = true;
#ifdef OTB_USE_MPI
otb::MPIConfig::Pointer mpiConfig = otb::MPIConfig::Instance();
if (mpiConfig->GetNbProcs() > 1)
{
useStandardWriter = false;
// Get file extension
std::string extension = itksys::SystemTools::GetFilenameExtension(filename);
if(extension == ".vrt")
{
// Use the WriteMPI function
WriteMPI(clampFilter->GetOutput(),filename,ramValue);
}
#ifdef OTB_USE_SPTW
else if (extension == ".tif")
{
// Use simple parallel tiff writer
typedef otb::SimpleParallelTiffWriter<TOutput> SPTWriterType;
typename SPTWriterType::Pointer sptWriter = SPTWriterType::New();
sptWriter->SetFileName(filename);
sptWriter->SetInput(clampFilter->GetOutput());
sptWriter->SetAutomaticAdaptativeStreaming(ramValue);
sptWriter->Update();
}
#endif
else
{
itkGenericExceptionMacro("File format "<<extension<<" not supported for parallel writing with MPI. Supported formats are .vrt and .tif. Extended filenames are not supported.");
}
}
#endif
if(useStandardWriter)
{
writer->SetFileName( filename );
writer->SetInput(clampFilter->GetOutput());
writer->SetAutomaticAdaptativeStreaming(ramValue);
writer->Update();
}
}*/
/*template <class TInput>
void
OutputImageParameter::SwitchImageWrite()
{
switch(m_PixelType )
{
case ImagePixelType_uint8:
{
ClampAndWriteImage< TInput , UInt8ImageType >(
m_Image ,
m_UInt8Writer ,
m_FileName ,
m_RAMValue );
break;
}
case ImagePixelType_int16:
{
ClampAndWriteImage< TInput , Int16ImageType >(
m_Image ,
m_Int16Writer ,
m_FileName ,
m_RAMValue );
break;
}
case ImagePixelType_uint16:
{
ClampAndWriteImage< TInput , UInt16ImageType >(
m_Image ,
m_UInt16Writer ,
m_FileName ,