Commit a95bda4b authored by Julien Michel's avatar Julien Michel

Supression du ChangeInformationFilter

parent 7396492a
......@@ -15,8 +15,8 @@ the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
PURPOSE. See the above copyright notices for more information.
=========================================================================*/
#ifndef __otbOrthoRectificationFilterBase_h
#define __otbOrthoRectificationFilterBase_h
#ifndef __otbOrthoRectificationFilter_h
#define __otbOrthoRectificationFilter_h
#include <iostream>
#include <sstream>
......@@ -30,7 +30,7 @@ PURPOSE. See the above copyright notices for more information.
namespace otb
{
/** \class OrthoRectificationFilterBase
/** \class OrthoRectificationFilter
*
* \brief Class for Orthorectifying an image
*
......@@ -43,7 +43,7 @@ namespace otb
class TOutputImage,
class TMapProjection,
class TInterpolatorPrecision=double>
class ITK_EXPORT OrthoRectificationFilterBase : public StreamingResampleImageFilter<TInputImage,
class ITK_EXPORT OrthoRectificationFilter : public StreamingResampleImageFilter<TInputImage,
TOutputImage,
TInterpolatorPrecision>
{
......@@ -52,7 +52,7 @@ namespace otb
typedef StreamingResampleImageFilter<TInputImage,
TOutputImage,
TInterpolatorPrecision> Superclass;
typedef OrthoRectificationFilterBase Self;
typedef OrthoRectificationFilter Self;
typedef itk::SmartPointer<Self> Pointer;
typedef itk::SmartPointer<const Self> ConstPointer;
......@@ -77,7 +77,7 @@ namespace otb
itkNewMacro( Self );
/** Run-time type information (and related methods). */
itkTypeMacro( OrthoRectificationFilterBase, StreamingResampleImageFilter );
itkTypeMacro( OrthoRectificationFilter, StreamingResampleImageFilter );
/** Accessors */
virtual void SetMapProjection (MapProjectionType* _arg)
......@@ -105,15 +105,15 @@ namespace otb
virtual void DisableDEM() { m_SensorModel->DisableDEM(); }
protected:
OrthoRectificationFilterBase();
~OrthoRectificationFilterBase();
OrthoRectificationFilter();
~OrthoRectificationFilter();
void PrintSelf(std::ostream& os, itk::Indent indent) const;
virtual void GenerateInputRequestedRegion();
private:
OrthoRectificationFilterBase(const Self&); //purposely not implemented
OrthoRectificationFilter(const Self&); //purposely not implemented
void operator=(const Self&); //purposely not implemented
/** Calculate transformation model from sensor model & map projection composition */
......@@ -136,7 +136,7 @@ namespace otb
} // namespace otb
#ifndef OTB_MANUAL_INSTANTIATION
#include "otbOrthoRectificationFilterBase.txx"
#include "otbOrthoRectificationFilter.txx"
#endif
#endif
......@@ -15,10 +15,10 @@ the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
PURPOSE. See the above copyright notices for more information.
=========================================================================*/
#ifndef _otbOrthoRectificationFilterBase_txx
#define _otbOrthoRectificationFilterBase_txx
#ifndef _otbOrthoRectificationFilter_txx
#define _otbOrthoRectificationFilter_txx
#include "otbOrthoRectificationFilterBase.h"
#include "otbOrthoRectificationFilter.h"
namespace otb
......@@ -28,11 +28,11 @@ namespace otb
class TOutputImage,
class TMapProjection,
class TInterpolatorPrecision>
OrthoRectificationFilterBase<TInputImage,
OrthoRectificationFilter<TInputImage,
TOutputImage,
TMapProjection,
TInterpolatorPrecision>
::OrthoRectificationFilterBase() : StreamingResampleImageFilter<TInputImage,
::OrthoRectificationFilter() : StreamingResampleImageFilter<TInputImage,
TOutputImage,
TInterpolatorPrecision>()
{
......@@ -46,11 +46,11 @@ namespace otb
class TOutputImage,
class TMapProjection,
class TInterpolatorPrecision>
OrthoRectificationFilterBase<TInputImage,
OrthoRectificationFilter<TInputImage,
TOutputImage,
TMapProjection,
TInterpolatorPrecision>
::~OrthoRectificationFilterBase()
::~OrthoRectificationFilter()
{
}
......@@ -58,7 +58,7 @@ namespace otb
class TOutputImage,
class TMapProjection,
class TInterpolatorPrecision>
void OrthoRectificationFilterBase<TInputImage,
void OrthoRectificationFilter<TInputImage,
TOutputImage,
TMapProjection,
TInterpolatorPrecision>
......@@ -75,7 +75,7 @@ namespace otb
class TMapProjection,
class TInterpolatorPrecision>
void
OrthoRectificationFilterBase<TInputImage,
OrthoRectificationFilter<TInputImage,
TOutputImage,
TMapProjection,
TInterpolatorPrecision>
......@@ -91,7 +91,7 @@ namespace otb
class TMapProjection,
class TInterpolatorPrecision>
void
OrthoRectificationFilterBase<TInputImage,
OrthoRectificationFilter<TInputImage,
TOutputImage,
TMapProjection,
TInterpolatorPrecision>
......
......@@ -165,21 +165,6 @@ ADD_TEST(prTvRegionProjectionResamplerCevennes ${PROJECTIONS_TESTS1}
ADD_TEST(prTuOrthoRectificationFilterNew ${PROJECTIONS_TESTS2}
otbOrthoRectificationFilterNew )
# TEST 16
ADD_TEST(prTvOrthoRectificationToulouseBase ${PROJECTIONS_TESTS2}
--compare-image ${EPSILON} ${BASELINE}/prTvOrthoRectificationToulouse_UTM.tif
${TEMP}/prTvOrthoRectificationBaseToulouse_UTM.tif
otbOrthoRectificationFilterBase
${IMAGEDATA}/TOULOUSE/QuickBird/000000128955_01_P001_PAN/02APR01105228-P1BS-000000128955_01_P001.TIF
${TEMP}/prTvOrthoRectificationBaseToulouse_UTM.tif
374100.8
4829184.8
500
500
220
0.5
-0.5
)
# TEST 16.2
ADD_TEST(prTvOrthoRectificationToulouse ${PROJECTIONS_TESTS2}
......@@ -247,23 +232,7 @@ ADD_TEST(prTvOrthoRectificationCevennes ${PROJECTIONS_TESTS2}
# -0.5
# )
#=======================================================================================
# TEST 20
ADD_TEST(prTvOrthoRectificationToulouseBaseWithDEM ${PROJECTIONS_TESTS2}
--compare-image ${EPSILON} ${BASELINE}/prTvOrthoRectificationToulouseWithDEM_UTM.tif
${TEMP}/prTvOrthoRectificationToulouseBaseWithDEM_UTM.tif
otbOrthoRectificationFilterBaseWithDEM
${IMAGEDATA}/TOULOUSE/QuickBird/000000128955_01_P001_PAN/02APR01105228-P1BS-000000128955_01_P001.TIF
${TEMP}/prTvOrthoRectificationToulouseBaseWithDEM_UTM.tif
374100.8
4829184.8
500
500
220
0.5
-0.5
${INPUTDATA}/DEM/srtm_directory/
${TEMP}/prTvOrthoRectificationToulouseBaseWithDEM_UTM.tif
)
# TEST 20.2
ADD_TEST(prTvOrthoRectificationToulouseWithDEM ${PROJECTIONS_TESTS2}
--compare-image ${EPSILON} ${BASELINE}/prTvOrthoRectificationToulouseWithDEM_UTM.tif
......@@ -347,9 +316,7 @@ otbRegionProjectionResampler.cxx
)
SET(Projections_SRCS2
otbOrthoRectificationFilterNew.cxx
otbOrthoRectificationFilterBase.cxx
otbOrthoRectificationFilter.cxx
otbOrthoRectificationFilterBaseWithDEM.cxx
otbOrthoRectificationFilterWithDEM.cxx
#otbSensorImageToCarto.cxx
#otbSensorImageDEMToCarto.cxx
......
......@@ -74,6 +74,9 @@ int otbOrthoRectificationFilter( int argc, char* argv[] )
// Set parameters ...
reader->SetFileName(argv[1]);
writer->SetFileName(argv[2]);
reader->GenerateOutputInformation();
std::cout<<reader->GetOutput()<<std::endl;
orthoRectifFilter->SetInput(reader->GetOutput());
......
/*=========================================================================
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
/*!
*
* PURPOSE:
*
* Application pour projeter une r�gion d'une image en coordonn�es g�ographiques
* en utilisant un Interpolator+regionextractor et un Iterator.
*
*/
// iostream is used for general output
#include <iostream>
#include <iterator>
#include <stdlib.h>
#include "otbMacro.h"
#include "otbImage.h"
#include "otbImageFileReader.h"
#include "otbImageFileWriter.h"
#include "otbStreamingImageFileWriter.h"
#include "otbInverseSensorModel.h"
#include "otbStreamingResampleImageFilter.h"
#include "itkExceptionObject.h"
#include "itkExtractImageFilter.h"
#include "itkResampleImageFilter.h"
#include "itkRescaleIntensityImageFilter.h"
#include "itkImageRegionIteratorWithIndex.h"
#include "itkLinearInterpolateImageFunction.h"
#include "itkChangeInformationImageFilter.h"
#include "otbOrthoRectificationFilterBase.h"
#include "otbMapProjections.h"
#include "init/ossimInit.h"
int otbOrthoRectificationFilterBase( int argc, char* argv[] )
{
ossimInit::instance()->initialize(argc, argv);
if(argc!=10)
{
std::cout << argv[0] <<" <input filename> <output filename> <latitude de l'origine> <longitude de l'origine> <taille_x> <taille_y> <NumberOfstreamDivisions>"
<< std::endl;
return EXIT_FAILURE;
}
typedef otb::Image<double, 2> ImageType;
typedef otb::ImageFileReader<ImageType> ReaderType;
typedef otb::StreamingImageFileWriter<ImageType> WriterType;
typedef otb::UtmInverseProjection UtmMapProjectionType ;
typedef otb::OrthoRectificationFilterBase<ImageType, ImageType, UtmMapProjectionType> OrthoRectifFilterType ;
//Allocate pointer
ReaderType::Pointer reader = ReaderType::New();
WriterType::Pointer writer = WriterType::New();
OrthoRectifFilterType::Pointer orthoRectifFilter = OrthoRectifFilterType::New();
UtmMapProjectionType::Pointer utmMapProjection = UtmMapProjectionType::New();
// Set parameters ...
reader->SetFileName(argv[1]);
writer->SetFileName(argv[2]);
// image origin modification
typedef itk::ChangeInformationImageFilter<ImageType > ChangeInfoFilterType;
ChangeInfoFilterType::Pointer changeInfo = ChangeInfoFilterType::New();
changeInfo->SetInput(reader->GetOutput());
changeInfo->ChangeOriginOn();
ImageType::PointType originNull;
originNull[0]=0;
originNull[1]=0;
changeInfo->SetOutputOrigin(originNull);
changeInfo->GenerateOutputInformation();
orthoRectifFilter->SetInput(changeInfo->GetOutput());
ImageType::IndexType start;
start[0]=0;
start[1]=0;
orthoRectifFilter->SetOutputStartIndex(start);
ImageType::SizeType size;
size[0]=atoi(argv[5]); //Taille en X.
size[1]=atoi(argv[6]); //Taille en Y.
orthoRectifFilter->SetSize(size);
ImageType::SpacingType spacing;
spacing[0]=atof(argv[8]);
spacing[1]=atof(argv[9]);
orthoRectifFilter->SetOutputSpacing(spacing);
ImageType::PointType origin;
origin[0]=strtod(argv[3], NULL); //Coord x en mtres de l'origine.
origin[1]=strtod(argv[4], NULL); //Coord y en mtres de l'origine.
orthoRectifFilter->SetOutputOrigin(origin);
orthoRectifFilter->SetMapProjection(utmMapProjection);
writer->SetInput(orthoRectifFilter->GetOutput());
writer->SetTilingStreamDivisions();
writer->Update();
return EXIT_SUCCESS;
}//Fin main()
/*=========================================================================
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
/*!
*
* PURPOSE:
*
* Application pour projeter une r�gion d'une image en coordonn�es g�ographiques
* en utilisant un Interpolator+regionextractor et un Iterator.
*
*/
// iostream is used for general output
#include <iostream>
#include <iterator>
#include <stdlib.h>
#include "otbMacro.h"
#include "otbImage.h"
#include "otbImageFileReader.h"
#include "otbImageFileWriter.h"
#include "otbStreamingImageFileWriter.h"
#include "otbInverseSensorModel.h"
#include "otbStreamingResampleImageFilter.h"
#include "itkExceptionObject.h"
#include "itkExtractImageFilter.h"
#include "itkResampleImageFilter.h"
#include "itkRescaleIntensityImageFilter.h"
#include "itkImageRegionIteratorWithIndex.h"
#include "itkLinearInterpolateImageFunction.h"
#include "itkChangeInformationImageFilter.h"
#include "otbOrthoRectificationFilterBase.h"
#include "otbMapProjections.h"
#include "init/ossimInit.h"
int otbOrthoRectificationFilterBaseWithDEM( int argc, char* argv[] )
{
ossimInit::instance()->initialize(argc, argv);
if(argc!=12)
{
std::cout << argv[0] <<" <input filename> <output filename> <latitude de l'origine> <longitude de l'origine> <taille_x> <taille_y>";
std::cout << " <NumberOfstreamDivisions> <x_spacing> <y_spacing> <srtm directory> <DEM Image Filename>" << std::endl;
return EXIT_FAILURE;
}
typedef otb::Image<double, 2> ImageType;
typedef otb::ImageFileReader<ImageType> ReaderType;
typedef otb::StreamingImageFileWriter<ImageType> WriterType;
typedef otb::UtmInverseProjection UtmMapProjectionType ;
typedef otb::OrthoRectificationFilterBase<ImageType, ImageType, UtmMapProjectionType> OrthoRectifFilterType ;
//Allocate pointer
ReaderType::Pointer reader=ReaderType::New();
WriterType::Pointer writer=WriterType::New();
OrthoRectifFilterType::Pointer orthoRectifFilter=OrthoRectifFilterType::New();
UtmMapProjectionType::Pointer utmMapProjection = UtmMapProjectionType::New();
// Set parameters ...
reader->SetFileName(argv[1]);
writer->SetFileName(argv[2]);
// Read meta data (ossimKeywordlist)
// reader->GenerateOutputInformation();
// model->SetImageGeometry(reader->GetOutput()->GetImageKeywordlist());
// image origin modification
typedef itk::ChangeInformationImageFilter<ImageType > ChangeInfoFilterType;
ChangeInfoFilterType::Pointer changeInfo = ChangeInfoFilterType::New();
changeInfo->SetInput(reader->GetOutput());
changeInfo->ChangeOriginOn();
ImageType::PointType originNull;
originNull[0]=0;
originNull[1]=0;
changeInfo->SetOutputOrigin(originNull);
changeInfo->GenerateOutputInformation();
orthoRectifFilter->SetInput(changeInfo->GetOutput());
ImageType::IndexType start;
start[0]=0;
start[1]=0;
orthoRectifFilter->SetOutputStartIndex(start);
ImageType::SizeType size;
size[0]=atoi(argv[5]); //Taille en X.
size[1]=atoi(argv[6]); //Taille en Y.
orthoRectifFilter->SetSize(size);
ImageType::SpacingType spacing;
spacing[0]=atof(argv[8]);
spacing[1]=atof(argv[9]);
orthoRectifFilter->SetOutputSpacing(spacing);
ImageType::PointType origin;
origin[0]=strtod(argv[3], NULL); //longitude de l'origine.
origin[1]=strtod(argv[4], NULL); //latitude de l'origine.
orthoRectifFilter->SetOutputOrigin(origin);
utmMapProjection->SetZone(31);
utmMapProjection->SetHemisphere('N');
orthoRectifFilter->SetMapProjection(utmMapProjection);
std::string srtmDirectory(argv[10]);
orthoRectifFilter->SetDEMDirectory(srtmDirectory);
writer->SetInput(orthoRectifFilter->GetOutput());
writer->SetTilingStreamDivisions();
otbGenericMsgDebugMacro(<< "Update writer ..." );
writer->Update();
return EXIT_SUCCESS;
} //End main()
......@@ -19,7 +19,6 @@
#include "otbMacro.h"
#include "otbImage.h"
#include "otbMapProjections.h"
#include "otbOrthoRectificationFilterBase.h"
#include "otbOrthoRectificationFilter.h"
......@@ -28,10 +27,8 @@ int otbOrthoRectificationFilterNew( int argc, char* argv[] )
typedef otb::Image<double, 2> ImageType;
typedef otb::UtmInverseProjection UtmMapProjectionType ;
typedef otb::OrthoRectificationFilter<ImageType, ImageType, UtmMapProjectionType> OrthoRectifFilterType ;
typedef otb::OrthoRectificationFilterBase<ImageType, ImageType, UtmMapProjectionType> OrthoRectifFilterBaseType ;
OrthoRectifFilterType::Pointer orthoRectifFilter=OrthoRectifFilterType::New();
OrthoRectifFilterBaseType::Pointer orthoRectifFilterBase=OrthoRectifFilterBaseType::New();
return EXIT_SUCCESS;
......
......@@ -28,9 +28,7 @@
void RegisterTests()
{
REGISTER_TEST(otbOrthoRectificationFilterNew);
REGISTER_TEST(otbOrthoRectificationFilterBase);
REGISTER_TEST(otbOrthoRectificationFilter);
REGISTER_TEST(otbOrthoRectificationFilterBaseWithDEM);
REGISTER_TEST(otbOrthoRectificationFilterWithDEM);
//REGISTER_TEST(otbSensorImageToCarto);
//REGISTER_TEST(otbSensorImageDEMToCarto);
......
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