diff --git a/Code/BasicFilters/otbStreamingResampleImageFilter.h b/Code/BasicFilters/otbStreamingResampleImageFilter.h index 62b4bd5eed4219b061eb0e2095a532a706a24c5e..40954530629e3cf42f34f1790745214e4e4f3e33 100644 --- a/Code/BasicFilters/otbStreamingResampleImageFilter.h +++ b/Code/BasicFilters/otbStreamingResampleImageFilter.h @@ -31,7 +31,7 @@ namespace otb * This class add streaming aspect on it::ResampleImageFilter */ -template <class TInputImage, class TOutputImage, class TInterpolatorPrecisionType> +template <class TInputImage, class TOutputImage, class TInterpolatorPrecisionType=double> class ITK_EXPORT StreamingResampleImageFilter : public itk::ResampleImageFilter< TInputImage, TOutputImage, TInterpolatorPrecisionType > { public: diff --git a/Code/BasicFilters/otbStreamingResampleImageFilter.txx b/Code/BasicFilters/otbStreamingResampleImageFilter.txx index 8623469480387e664256929b57223e1d07ee4377..637353f4ee7eadc9b06b3634ec89c416c9316be6 100644 --- a/Code/BasicFilters/otbStreamingResampleImageFilter.txx +++ b/Code/BasicFilters/otbStreamingResampleImageFilter.txx @@ -49,7 +49,6 @@ void StreamingResampleImageFilter<TInputImage,TOutputImage,TInterpolatorPrecisionType> ::GenerateInputRequestedRegion() { - Superclass::GenerateInputRequestedRegion(); if ( this->GetInput() ) @@ -170,17 +169,8 @@ StreamingResampleImageFilter<TInputImage,TOutputImage,TInterpolatorPrecisionType otbDebugMacro(<< "Final Region (After Crop) : Index(" << region.GetIndex()[0] << "," << region.GetIndex()[1] << ") Size(" << region.GetSize()[0] << "," << region.GetSize()[1] << ")"); } - } -/*template<class TInputImage, class TOutputImage, class TInterpolatorPrecisionType> -void -StreamingResampleImageFilter<TInputImage,TOutputImage,TInterpolatorPrecisionType> -::SetInterpolatorNeighborhoodRadius(unsigned int radius) -{ - m_InterpolatorNeighborhoodRadius = radius; -// m_RadiusIsDeterminedByUser = true; -}*/ template<class TInputImage, class TOutputImage, class TInterpolatorPrecisionType> diff --git a/Code/Common/otbStreamingTraits.h b/Code/Common/otbStreamingTraits.h index d2e5d1256fad7ac708918691cd40f75b4075365b..809694fd774a13dd9d42d7315af6d91f0168dc5f 100644 --- a/Code/Common/otbStreamingTraits.h +++ b/Code/Common/otbStreamingTraits.h @@ -92,7 +92,7 @@ class ITK_EXPORT StreamingTraits { case SET_NUMBER_OF_STREAM_DIVISIONS : { - numDivisions = numberOfStreamDivision; + numDivisions = numberOfStreamDivision; } break; case SET_BUFFER_MEMORY_SIZE : diff --git a/Code/IO/otbStreamingImageFileWriter.h b/Code/IO/otbStreamingImageFileWriter.h index d7505842311babcf2a3468c172632fef8923aee7..797d4493cdeeebfd534da437fdd72e57ff6db3b4 100755 --- a/Code/IO/otbStreamingImageFileWriter.h +++ b/Code/IO/otbStreamingImageFileWriter.h @@ -98,8 +98,10 @@ public: */ void SetAutomaticNumberOfStreamDivisions(void); - /** Set the tiling mode for streaming division */ + /** Set the tiling automatic mode for streaming division */ void SetTilingStreamDivisions(void); + /** Choose number of divisions in tiling streaming division */ + void SetTilingStreamDivisions(unsigned long); /** Return the string to indicate the method use to calculate number of stream divisions. */ std::string GetMethodUseToCalculateNumberOfStreamDivisions(void); diff --git a/Code/IO/otbStreamingImageFileWriter.txx b/Code/IO/otbStreamingImageFileWriter.txx index f777c0fa048c2f526f8b7f4c18aa2f3aa68b05af..2fef00b833adbfc3a6389d6a8f8fd467274da3d4 100755 --- a/Code/IO/otbStreamingImageFileWriter.txx +++ b/Code/IO/otbStreamingImageFileWriter.txx @@ -73,7 +73,7 @@ StreamingImageFileWriter<TInputImage> { m_BufferMemorySize = memory_size_divisions; m_CalculationDivision = SET_BUFFER_MEMORY_SIZE; - this->Modified(); + this->Modified(); } /** @@ -86,7 +86,7 @@ StreamingImageFileWriter<TInputImage> { m_BufferNumberOfLinesDivisions = nb_lines_divisions; m_CalculationDivision = SET_BUFFER_NUMBER_OF_LINES; - this->Modified(); + this->Modified(); } /** @@ -99,7 +99,7 @@ StreamingImageFileWriter<TInputImage> { m_NumberOfStreamDivisions = nb_divisions; m_CalculationDivision = SET_NUMBER_OF_STREAM_DIVISIONS; - this->Modified(); + this->Modified(); } /** @@ -124,7 +124,18 @@ StreamingImageFileWriter<TInputImage> { m_CalculationDivision = SET_TILING_STREAM_DIVISIONS; m_RegionSplitter = itk::ImageRegionMultidimensionalSplitter<InputImageDimension>::New(); - this->Modified(); + this->Modified(); +} + +template <class TInputImage> +void +StreamingImageFileWriter<TInputImage> +::SetTilingStreamDivisions(unsigned long nb_divisions) +{ + m_CalculationDivision = SET_NUMBER_OF_STREAM_DIVISIONS; + m_NumberOfStreamDivisions = nb_divisions; + m_RegionSplitter = itk::ImageRegionMultidimensionalSplitter<InputImageDimension>::New(); + this->Modified(); } /** @@ -258,7 +269,6 @@ unsigned long StreamingImageFileWriter<TInputImage> ::CalculateNumberOfStreamDivisions(void) { - otbDebugMacro(<< "TEST CalculateNumberOfStreamDivisions"); return StreamingTraitsType ::CalculateNumberOfStreamDivisions(this->GetInput(), @@ -278,7 +288,6 @@ void StreamingImageFileWriter<TInputImage> ::UpdateOutputData(itk::DataObject *itkNotUsed(output)) { - otbDebugMacro(<< "TEST UpdateOutputData"); unsigned int idx; @@ -402,9 +411,9 @@ StreamingImageFileWriter<TInputImage> else { numDivisions = static_cast<unsigned int>(CalculateNumberOfStreamDivisions()); - otbGenericMsgDebugMacro(<< "NumberOfStreamDivisions : " << numDivisions); + otbDebugMacro(<< "NumberOfStreamDivisions : " << numDivisions); numDivisionsFromSplitter = m_RegionSplitter->GetNumberOfSplits(outputRegion, numDivisions); - otbGenericMsgDebugMacro(<< "NumberOfStreamSplitterDivisions : " << numDivisionsFromSplitter); + otbDebugMacro(<< "NumberOfStreamSplitterDivisions : " << numDivisionsFromSplitter); /** In tiling streaming mode, we keep the number of divisions calculed by splitter */ if ((numDivisionsFromSplitter < numDivisions)||(m_CalculationDivision==SET_TILING_STREAM_DIVISIONS)) @@ -418,8 +427,6 @@ StreamingImageFileWriter<TInputImage> * piece, and copy the results into the output image. */ InputImageRegionType streamRegion; -// streamRegion = m_RegionSplitter->GetSplit(0, numDivisions, -// outputRegion); // On s'appuie sur 'outputPtr' pour d�terminer les initialiser le 'm_ImageIO' // Setup the ImageIO @@ -468,11 +475,11 @@ StreamingImageFileWriter<TInputImage> streamRegion = m_RegionSplitter->GetSplit(piece, numDivisions, outputRegion); - otbGenericMsgDebugMacro(<< "Piece : " << piece); - otbGenericMsgDebugMacro(<< "RegionSplit : Index(" << streamRegion.GetIndex()[0] + otbDebugMacro(<< "Piece : " << piece ); + otbDebugMacro(<< "RegionSplit : Index(" << streamRegion.GetIndex()[0] << "," << streamRegion.GetIndex()[1] << ") Size(" << streamRegion.GetSize()[0] - << "," << streamRegion.GetSize()[1] << ")"); + << "," << streamRegion.GetSize()[1] << ")" ); inputPtr->SetRequestedRegion(streamRegion); diff --git a/Code/Projections/otbCompositeTransform.h b/Code/Projections/otbCompositeTransform.h new file mode 100644 index 0000000000000000000000000000000000000000..f75aa79ef7051ade64d99a91aa45c96f6f0a550f --- /dev/null +++ b/Code/Projections/otbCompositeTransform.h @@ -0,0 +1,135 @@ +/*========================================================================= + + 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 __otbCompositeTransform_h +#define __otbCompositeTransform_h + +#include <iostream> +#include <sstream> +#include <stdio.h> +#include "itkTransform.h" +#include "itkMacro.h" +#include "otbMapProjection.h" + +namespace otb +{ + + +/** \class CompositeTransform + + * \brief Class which compose two itk::Transform to obtain one itk::Transform + * T1 T2 T3 + * (x,y) -> (x',y') -> (x'',y'') => (x,y) -> (x'',y'') + * \ingroup Transform + */ +template <class TFirstTransform, + class TSecondTransform, + class TScalarType=double, + unsigned int NInputDimensions=2, + unsigned int NOutputDimensions=2> +class ITK_EXPORT CompositeTransform: public itk::Transform<TScalarType, // Data type for scalars + NInputDimensions, // Number of dimensions in the input space + NOutputDimensions> // Number of dimensions in the output space +{ +public : + + + /** Standard class typedefs */ + typedef itk::Transform< TScalarType, + NInputDimensions, + NOutputDimensions > Superclass; + typedef CompositeTransform Self; + typedef itk::SmartPointer<Self> Pointer; + typedef itk::SmartPointer<const Self> ConstPointer; + + typedef TFirstTransform FirstTransformType; + typedef typename TFirstTransform::Pointer FirstTransformPointerType; + typedef TSecondTransform SecondTransformType; + typedef typename TSecondTransform::Pointer SecondTransformPointerType; + + /** Standard vector type for this class. */ + typedef typename Superclass::InputVectorType InputVectorType; + typedef typename Superclass::OutputVectorType OutputVectorType; + + /** Standard covariant vector type for this class */ + typedef typename Superclass::InputCovariantVectorType InputCovariantVectorType; + typedef typename Superclass::OutputCovariantVectorType OutputCovariantVectorType; + + /** Standard vnl_vector type for this class. */ + typedef typename Superclass::InputVnlVectorType InputVnlVectorType; + typedef typename Superclass::OutputVnlVectorType OutputVnlVectorType; + + /** Standard coordinate point type for this class */ + typedef typename Superclass::InputPointType InputPointType; + typedef typename Superclass::OutputPointType OutputPointType; + + /** Method for creation through the object factory. */ + itkNewMacro( Self ); + + /** Run-time type information (and related methods). */ + itkTypeMacro( CompositeTransform, itk::Transform ); + + itkStaticConstMacro(InputSpaceDimension, unsigned int, NInputDimensions); + itkStaticConstMacro(OutputSpaceDimension, unsigned int, NOutputDimensions); + itkStaticConstMacro(SpaceDimension, unsigned int, NInputDimensions); + itkStaticConstMacro(ParametersDimension, unsigned int,NInputDimensions*(NInputDimensions+1)); + + /** Set first transformation */ + itkSetObjectMacro(FirstTransform,FirstTransformType); + + /** Set second transformation */ + itkSetObjectMacro(SecondTransform,SecondTransformType); + + + /** Method to transform a point. */ + virtual OutputPointType TransformPoint(const InputPointType & ) const; + + /** Method to transform a vector. */ + virtual OutputVectorType TransformVector(const InputVectorType &) const; + + /** Method to transform a vnl_vector. */ + virtual OutputVnlVectorType TransformVector(const InputVnlVectorType &) const; + + /** Method to transform a CovariantVector. */ + virtual OutputCovariantVectorType TransformCovariantVector(const InputCovariantVectorType &) const; + + /** Compute MapProjection1 coordinates to MapProjection2 coordinates. */ + OutputPointType ComputeProjection1ToProjection2(const InputPointType &point1); + + /** Compute MapProjection1 coordinates to MapProjection2 coordinates. */ + InputPointType ComputeProjection2ToProjection1(const OutputPointType &point2); + +protected: + CompositeTransform(); + ~CompositeTransform(); + + FirstTransformPointerType m_FirstTransform; + SecondTransformPointerType m_SecondTransform; + +private: + CompositeTransform(const Self&); //purposely not implemented + void operator=(const Self&); //purposely not implemented + +}; + +} // namespace otb + +#ifndef OTB_MANUAL_INSTANTIATION +#include "otbCompositeTransform.txx" +#endif + +#endif diff --git a/Code/Projections/otbCompositeTransform.txx b/Code/Projections/otbCompositeTransform.txx new file mode 100644 index 0000000000000000000000000000000000000000..5ea6d7dd1f08cca78cdf4cca58460e114f8d0a85 --- /dev/null +++ b/Code/Projections/otbCompositeTransform.txx @@ -0,0 +1,103 @@ +/*========================================================================= + + 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 __otbCompositeTransform_txx +#define __otbCompositeTransform_txx + +#include "otbCompositeTransform.h" + +namespace otb +{ + +template<class TFirstTransform, class TSecondTransform, class TScalarType, unsigned int NInputDimensions, unsigned int NOutputDimensions> +CompositeTransform<TFirstTransform, TSecondTransform, TScalarType, NInputDimensions, NOutputDimensions> +::CompositeTransform() : Superclass(SpaceDimension,ParametersDimension) +{ + m_FirstTransform = FirstTransformType::New(); + m_SecondTransform = SecondTransformType::New(); +} + +template<class TFirstTransform, class TSecondTransform, class TScalarType, unsigned int NInputDimensions, unsigned int NOutputDimensions> +CompositeTransform<TFirstTransform, TSecondTransform, TScalarType, NInputDimensions, NOutputDimensions> +::~CompositeTransform() +{ +} + + +template<class TFirstTransform, class TSecondTransform, class TScalarType, unsigned int NInputDimensions, unsigned int NOutputDimensions> +typename CompositeTransform<TFirstTransform, TSecondTransform, TScalarType, NInputDimensions, NOutputDimensions>::OutputPointType +CompositeTransform<TFirstTransform, TSecondTransform, TScalarType, NInputDimensions, NOutputDimensions> +::TransformPoint(const InputPointType &point1) const +{ + InputPointType pointTmp; + OutputPointType point2; + + pointTmp=m_FirstTransform->TransformPoint(point1); + point2=m_SecondTransform->TransformPoint(pointTmp); + + return point2; +} + +template<class TFirstTransform, class TSecondTransform, class TScalarType, unsigned int NInputDimensions, unsigned int NOutputDimensions> +typename CompositeTransform<TFirstTransform, TSecondTransform, TScalarType, NInputDimensions, NOutputDimensions>::OutputVectorType +CompositeTransform<TFirstTransform, TSecondTransform, TScalarType,NInputDimensions, NOutputDimensions> +::TransformVector(const InputVectorType &vector1) const +{ + InputVectorType vectorTmp; + OutputVectorType vector2; + + vectorTmp=m_FirstTransform->TransformVector(vector1); + vector2=m_SecondTransform->TransformVector(vectorTmp); + + return vector2; +} + +template<class TFirstTransform, class TSecondTransform, class TScalarType, unsigned int NInputDimensions, unsigned int NOutputDimensions> +typename CompositeTransform<TFirstTransform, TSecondTransform, TScalarType, NInputDimensions, NOutputDimensions>::OutputVnlVectorType +CompositeTransform<TFirstTransform, TSecondTransform, TScalarType,NInputDimensions, NOutputDimensions> +::TransformVector(const InputVnlVectorType &vnlVector1) const +{ + InputVnlVectorType vnlVectorTmp; + OutputVnlVectorType vnlVector2; + + vnlVectorTmp=m_FirstTransform->TransformVector(vnlVector1); + vnlVector2=m_SecondTransform->TransformVector(vnlVectorTmp); + + return vnlVector2; +} + +template<class TFirstTransform, class TSecondTransform, class TScalarType, unsigned int NInputDimensions, unsigned int NOutputDimensions> +typename CompositeTransform<TFirstTransform, TSecondTransform, TScalarType, NInputDimensions, NOutputDimensions>::OutputCovariantVectorType +CompositeTransform<TFirstTransform, TSecondTransform, TScalarType,NInputDimensions, NOutputDimensions> +::TransformCovariantVector(const InputCovariantVectorType &covariantVector1) const +{ + InputCovariantVectorType covariantVectorTmp; + OutputCovariantVectorType covariantVector2; + + covariantVectorTmp=m_FirstTransform->TransformCovariantVector(covariantVector1); + covariantVector2=m_SecondTransform->TransformCovariantVector(covariantVectorTmp); + + return covariantVector2; +} + + + + +} // namespace otb + +#endif + diff --git a/Code/Projections/otbInverseSensorModel.txx b/Code/Projections/otbInverseSensorModel.txx index e7928a9d2643a71e46ba6810e059a7ef6e89ae29..f24a6511db388209f0b858dd46bc0b30d3c9f659 100644 --- a/Code/Projections/otbInverseSensorModel.txx +++ b/Code/Projections/otbInverseSensorModel.txx @@ -55,6 +55,7 @@ InverseSensorModel< TScalarType,NInputDimensions,NOutputDimensions,NParametersDi ::TransformPoint(const InputPointType &point) const { +// std::cout << "InverseSensorModel Before : (" << point[0] << "," << point[1] << ")" << std::endl; //On transforme le type "itk::point" en type "ossim::ossimGpt" ossimGpt ossimGPoint(point[0], point[1]); @@ -73,6 +74,7 @@ InverseSensorModel< TScalarType,NInputDimensions,NOutputDimensions,NParametersDi outputPoint[0]=ossimDPoint.x; outputPoint[1]=ossimDPoint.y; +// std::cout << "InverseSensorModel After : (" << outputPoint[0] << "," << outputPoint[1] << ")" << std::endl; return outputPoint; } diff --git a/Code/Projections/otbComposite.h b/Code/Projections/otbMapToMapProjection.h similarity index 87% rename from Code/Projections/otbComposite.h rename to Code/Projections/otbMapToMapProjection.h index 8505b2f6ebb951cf1e4bac76bf5877c18d2cc597..899700d5e3625f79fbdff3e0a9ba65a919701c5f 100644 --- a/Code/Projections/otbComposite.h +++ b/Code/Projections/otbMapToMapProjection.h @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbComposite_h -#define __otbComposite_h +#ifndef __otbMapToMapProjection_h +#define __otbMapToMapProjection_h #include <iostream> #include <sstream> @@ -29,7 +29,7 @@ namespace otb { -/** \class Composite +/** \class MapToMapProjection * \brief Class for switching from a Map Projection coordinates to other Map Projection coordinates. * It converts MapProjection1 coordinates to MapProjection2 coordinates by using MapProjection methods. @@ -42,7 +42,7 @@ template <class TInputMapProjection, class TScalarType=double, unsigned int NInputDimensions=2, unsigned int NOutputDimensions=2> -class ITK_EXPORT Composite: public itk::Transform<TScalarType, // Data type for scalars +class ITK_EXPORT MapToMapProjection: public itk::Transform<TScalarType, // Data type for scalars NInputDimensions, // Number of dimensions in the input space NOutputDimensions> // Number of dimensions in the output space { @@ -53,7 +53,7 @@ public : typedef itk::Transform< TScalarType, NInputDimensions, NOutputDimensions > Superclass; - typedef Composite Self; + typedef MapToMapProjection Self; typedef itk::SmartPointer<Self> Pointer; typedef itk::SmartPointer<const Self> ConstPointer; @@ -68,7 +68,7 @@ public : itkNewMacro( Self ); /** Run-time type information (and related methods). */ - itkTypeMacro( Composite, itk::Transform ); + itkTypeMacro( MapToMapProjection, itk::Transform ); itkStaticConstMacro(InputSpaceDimension, unsigned int, NInputDimensions); itkStaticConstMacro(OutputSpaceDimension, unsigned int, NOutputDimensions); @@ -88,14 +88,14 @@ public : InputPointType ComputeProjection2ToProjection1(const OutputPointType &point2); protected: - Composite(); - ~Composite(); + MapToMapProjection(); + ~MapToMapProjection(); TInputMapProjection* m_InputMapProjection; TOutputMapProjection* m_OutputMapProjection; private: - Composite(const Self&); //purposely not implemented + MapToMapProjection(const Self&); //purposely not implemented void operator=(const Self&); //purposely not implemented }; @@ -103,7 +103,7 @@ private: } // namespace otb #ifndef OTB_MANUAL_INSTANTIATION -#include "otbComposite.txx" +#include "otbMapToMapProjection.txx" #endif #endif diff --git a/Code/Projections/otbComposite.txx b/Code/Projections/otbMapToMapProjection.txx similarity index 65% rename from Code/Projections/otbComposite.txx rename to Code/Projections/otbMapToMapProjection.txx index 95d50544a9c11f9681d8ef189e98e59dfcafad40..e6b3790a36e2f72206085e47033b2e7353dfb795 100644 --- a/Code/Projections/otbComposite.txx +++ b/Code/Projections/otbMapToMapProjection.txx @@ -15,31 +15,31 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbComposite_txx -#define __otbComposite_txx +#ifndef __otbMapToMapProjection_txx +#define __otbMapToMapProjection_txx -#include "otbComposite.h" +#include "otbMapToMapProjection.h" namespace otb { template<class TInputMapProjection, class TOutputMapProjection, class TScalarType, unsigned int NInputDimensions, unsigned int NOutputDimensions> -Composite<TInputMapProjection, TOutputMapProjection, TScalarType, NInputDimensions, NOutputDimensions> -::Composite() +MapToMapProjection<TInputMapProjection, TOutputMapProjection, TScalarType, NInputDimensions, NOutputDimensions> +::MapToMapProjection() : Superclass(SpaceDimension,ParametersDimension) { } template<class TInputMapProjection, class TOutputMapProjection, class TScalarType, unsigned int NInputDimensions, unsigned int NOutputDimensions> -Composite<TInputMapProjection, TOutputMapProjection, TScalarType, NInputDimensions, NOutputDimensions> -::~Composite() +MapToMapProjection<TInputMapProjection, TOutputMapProjection, TScalarType, NInputDimensions, NOutputDimensions> +::~MapToMapProjection() { } ///M�thode pour passer de la projection 1 � la projection 2 template<class TInputMapProjection, class TOutputMapProjection, class TScalarType, unsigned int NInputDimensions, unsigned int NOutputDimensions> -typename Composite<TInputMapProjection, TOutputMapProjection, TScalarType, NInputDimensions, NOutputDimensions>::OutputPointType -Composite<TInputMapProjection, TOutputMapProjection, TScalarType, NInputDimensions, NOutputDimensions>::ComputeProjection1ToProjection2(const InputPointType &point1) +typename MapToMapProjection<TInputMapProjection, TOutputMapProjection, TScalarType, NInputDimensions, NOutputDimensions>::OutputPointType +MapToMapProjection<TInputMapProjection, TOutputMapProjection, TScalarType, NInputDimensions, NOutputDimensions>::ComputeProjection1ToProjection2(const InputPointType &point1) { InputPointType geopoint; OutputPointType point2; @@ -54,8 +54,8 @@ Composite<TInputMapProjection, TOutputMapProjection, TScalarType, NInputDimensio ///M�thode pour passer de la projection 2 � la projection 1 template<class TInputMapProjection, class TOutputMapProjection, class TScalarType, unsigned int NInputDimensions, unsigned int NOutputDimensions> -typename Composite<TInputMapProjection, TOutputMapProjection, TScalarType, NInputDimensions, NOutputDimensions>::InputPointType -Composite<TInputMapProjection, TOutputMapProjection, TScalarType, NInputDimensions, NOutputDimensions>::ComputeProjection2ToProjection1(const OutputPointType &point2) +typename MapToMapProjection<TInputMapProjection, TOutputMapProjection, TScalarType, NInputDimensions, NOutputDimensions>::InputPointType +MapToMapProjection<TInputMapProjection, TOutputMapProjection, TScalarType, NInputDimensions, NOutputDimensions>::ComputeProjection2ToProjection1(const OutputPointType &point2) { OutputPointType geopoint; diff --git a/Code/Projections/otbOrthoRectificationFilter.h b/Code/Projections/otbOrthoRectificationFilter.h new file mode 100644 index 0000000000000000000000000000000000000000..b52b7441b323d2ca15c75ce0a0df62cbbf1fac49 --- /dev/null +++ b/Code/Projections/otbOrthoRectificationFilter.h @@ -0,0 +1,133 @@ +/*========================================================================= + + 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 __otbOrthoRectificationFilter_h +#define __otbOrthoRectificationFilter_h + +#include <iostream> +#include <sstream> +#include <stdio.h> + +#include "otbMapProjection.h" +#include "otbStreamingResampleImageFilter.h" +#include "otbCompositeTransform.h" + +namespace otb +{ + +/** Macro used to access Resampler class */ +/*#define otbSetResampleMacro(name, type)\ + virtual void SetResample##name( const type & _arg)\ + {\ + if (m_Resampler->Get##name() != _arg)\ + {\ + m_Resampler->Set##name(_arg);\ + this->Modified();\ + }\ + }\*/ + +/**Template otbOrthoRectificationFilter.txx +* Cette classe permet de passer d'une MapProjection � une autre en passant par un point g�ographique. +* Ceci pour �viter TOUTES les combinaisons possibles de passage d'une proj. carto � une autre. +* Template: Pour v�rifier les types. +**/ +template <class TInputImage, + class TOutputImage, + class TMapProjection, + class TInterpolatorPrecision=double> +class ITK_EXPORT OrthoRectificationFilter : public StreamingResampleImageFilter<TInputImage, TOutputImage,TInterpolatorPrecision> +{ +public : + + /** Standard class typedefs */ + typedef StreamingResampleImageFilter<TInputImage, TOutputImage,TInterpolatorPrecision> Superclass; + typedef OrthoRectificationFilter Self; + typedef itk::SmartPointer<Self> Pointer; + typedef itk::SmartPointer<const Self> ConstPointer; + + +// typedef otb::StreamingResampleImageFilter< TInputImage, TOutputImage > ResamplerType; +// typedef typename ResamplerType::Pointer ResamplerPointerType; + typedef typename TInputImage::IndexType IndexType; + typedef typename TInputImage::SizeType SizeType; + typedef typename TInputImage::SpacingType SpacingType; + typedef typename TInputImage::PointType PointType; + typedef typename TInputImage::RegionType RegionType; + + typedef typename TOutputImage::PixelType OutputPixelType; + + typedef TMapProjection MapProjectionType; + typedef typename TMapProjection::Pointer MapProjectionPointerType; + + typedef InverseSensorModel<double> SensorModelType; + typedef typename SensorModelType::Pointer SensorModelPointerType; + + typedef CompositeTransform<SensorModelType,MapProjectionType> CompositeTransformType; + typedef typename CompositeTransformType::Pointer CompositeTransformPointerType; + + typedef typename Superclass::InterpolatorType InterpolatorType; +// typedef typename InterpolatorType::Pointer InterpolatorPointerType; + + /** Method for creation through the object factory. */ + itkNewMacro( Self ); + + /** Run-time type information (and related methods). */ + itkTypeMacro( OrthoRectificationFilter, StreamingResampleImageFilter ); + + /** Accessors */ + itkSetMacro(MapProjection, MapProjectionPointerType); + itkGetMacro(MapProjection, MapProjectionPointerType); + +protected: + OrthoRectificationFilter(); + ~OrthoRectificationFilter(); + void PrintSelf(std::ostream& os, itk::Indent indent) const; + + virtual void GenerateInputRequestedRegion(); + + +private: + + OrthoRectificationFilter(const Self&); //purposely not implemented + void operator=(const Self&); //purposely not implemented + + /** Calculate transformation model from sensor model & map projection composition */ + void ComputeResampleTransformationModel(); + + void Modified(); + + /** Boolean used to know if transformation model computation is needed */ + bool m_IsComputed; + SensorModelPointerType m_SensorModel; + MapProjectionPointerType m_MapProjection; + CompositeTransformPointerType m_CompositeTransform; + + + +}; + + + + + +} // namespace otb + +#ifndef OTB_MANUAL_INSTANTIATION +#include "otbOrthoRectificationFilter.txx" +#endif + +#endif diff --git a/Code/Projections/otbOrthoRectificationFilter.txx b/Code/Projections/otbOrthoRectificationFilter.txx new file mode 100644 index 0000000000000000000000000000000000000000..2ff358482c8bcdcf82f26f16dfec82bc4569583a --- /dev/null +++ b/Code/Projections/otbOrthoRectificationFilter.txx @@ -0,0 +1,118 @@ +/*========================================================================= + + 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 _otbOrthoRectificationFilter_txx +#define _otbOrthoRectificationFilter_txx +#include "otbOrthoRectificationFilter.h" + +#include "itkLinearInterpolateImageFunction.h" + +/*#include "itkObjectFactory.h" +#include "itkConvertPixelBuffer.h" +#include "itkImageRegion.h" +#include "itkPixelTraits.h" +#include "itkVectorImage.h" +#include "itkMetaDataObject.h" + +#include "otbMacro.h" +#include "otbSystem.h" +#include "otbImageIOFactory.h" +#include "otbMetaDataKey.h" +#include "otbImageKeywordlist.h" + +#include "imaging/ossimImageHandlerRegistry.h" +#include "imaging/ossimImageHandler.h" +#include "init/ossimInit.h" +#include "base/ossimKeywordlist.h" + +#include <itksys/SystemTools.hxx> +#include <fstream>*/ + +namespace otb +{ + + +template <class TInputImage, class TOutputImage, class TMapProjection, class TInterpolatorPrecision> +OrthoRectificationFilter<TInputImage, TOutputImage, TMapProjection, TInterpolatorPrecision> +::OrthoRectificationFilter() : otb::StreamingResampleImageFilter<TInputImage, TOutputImage,TInterpolatorPrecision>() +{ +// m_Resampler = ResamplerType::New(); + m_SensorModel = SensorModelType::New(); + m_MapProjection = MapProjectionType::New(); + m_CompositeTransform = CompositeTransformType::New(); + m_IsComputed = false; +} + +template <class TInputImage, class TOutputImage, class TMapProjection, class TInterpolatorPrecision> +OrthoRectificationFilter<TInputImage, TOutputImage, TMapProjection, TInterpolatorPrecision> +::~OrthoRectificationFilter() +{ +} + +template <class TInputImage, class TOutputImage, class TMapProjection, class TInterpolatorPrecision> +void OrthoRectificationFilter<TInputImage, TOutputImage, TMapProjection, TInterpolatorPrecision> +::PrintSelf(std::ostream& os, itk::Indent indent) const +{ + Superclass::PrintSelf(os, indent); + + os << indent << "OrthoRectification" << "\n"; +} + + +template <class TInputImage, class TOutputImage, class TMapProjection, class TInterpolatorPrecision> +void +OrthoRectificationFilter<TInputImage, TOutputImage, TMapProjection, TInterpolatorPrecision> +::GenerateInputRequestedRegion() +{ + this->ComputeResampleTransformationModel(); + + Superclass::GenerateInputRequestedRegion(); +} + +template <class TInputImage, class TOutputImage, class TMapProjection, class TInterpolatorPrecision> +void +OrthoRectificationFilter<TInputImage, TOutputImage, TMapProjection, TInterpolatorPrecision> +::ComputeResampleTransformationModel() +{ + if (m_IsComputed == false) + { + typename TOutputImage::Pointer output = this->GetOutput(); + + // Get OSSIM sensor model from image keywordlist + m_SensorModel->SetImageGeometry(output->GetImageKeywordlist()); + + m_CompositeTransform->SetFirstTransform(m_SensorModel); + m_CompositeTransform->SetSecondTransform(m_MapProjection); + + this->SetTransform(m_CompositeTransform); + + m_IsComputed = true; + } +} + +template <class TInputImage, class TOutputImage, class TMapProjection, class TInterpolatorPrecision> +void +OrthoRectificationFilter<TInputImage, TOutputImage, TMapProjection, TInterpolatorPrecision> +::Modified() +{ + m_IsComputed = false; + this->Modified(); +} + +} //namespace otb + +#endif diff --git a/Testing/Code/BasicFilters/otbStreamingResampleImageFilterCompareWithITK.cxx b/Testing/Code/BasicFilters/otbStreamingResampleImageFilterCompareWithITK.cxx index 55010b584a2a294a25f8cf4799460235620e4a2c..ef07b25935a0a6a06a701c9fd65c4723a4a38447 100644 --- a/Testing/Code/BasicFilters/otbStreamingResampleImageFilterCompareWithITK.cxx +++ b/Testing/Code/BasicFilters/otbStreamingResampleImageFilterCompareWithITK.cxx @@ -101,8 +101,9 @@ int otbStreamingResampleImageFilterCompareWithITK(int argc, char * argv[]) writerITKFilter->Update(); writerOTBFilter->SetInput(resamplerOTB->GetOutput()); - writerOTBFilter->SetTilingStreamDivisions(); +// writerOTBFilter->SetTilingStreamDivisions(); writerOTBFilter->SetFileName(outputOTBFilename); + writerOTBFilter->SetNumberOfStreamDivisions(10); writerOTBFilter->Update(); } diff --git a/Testing/Code/IO/CMakeLists.txt b/Testing/Code/IO/CMakeLists.txt index 8cebf37807f25f225ada5d1d2f8dd099a8ed11de..1258a79af0998c9cafc36a6fc03d9e0c58ed583d 100755 --- a/Testing/Code/IO/CMakeLists.txt +++ b/Testing/Code/IO/CMakeLists.txt @@ -954,6 +954,16 @@ ADD_TEST(ioTvStreamingImageFileWriterCalculateNumberOfDivisions_TILING_STREAM_DI ${TEMP}/ioStreamingImageFileWriterCalculateNumberOfDivisions_TILING_STREAM_DIVISIONS.tif TILING_STREAM_DIVISIONS ) +# 7. TILING_STREAM_DIVISIONS with number of divisions +ADD_TEST(ioTvStreamingImageFileWriterCalculateNumberOfDivisions_TILING_NUMBER_OF_STREAM_DIVISIONS ${IO_TESTS} + --compare-image ${TOL} ${INPUTDATA}/ToulouseQuickBird_Extrait_1500_3750.tif + ${TEMP}/ioStreamingImageFileWriterCalculateNumberOfDivisions_TILING_NUMBER_OF_STREAM_DIVISIONS.tif + otbStreamingImageFileWriterTestCalculateNumberOfDivisions + ${INPUTDATA}/ToulouseQuickBird_Extrait_1500_3750.tif + ${TEMP}/ioStreamingImageFileWriterCalculateNumberOfDivisions_TILING_NUMBER_OF_STREAM_DIVISIONS.tif + TILING_NUMBER_OF_STREAM_DIVISIONS + 100 + ) ADD_TEST(ioTvStreamingIFWriterWithFilter ${IO_TESTS} --compare-image ${TOL} ${BASELINE}/ioStreamingImageFileWriterWithFilter_1_100.hdr diff --git a/Testing/Code/IO/otbStreamingImageFileWriterTestCalculateNumberOfDivisions.cxx b/Testing/Code/IO/otbStreamingImageFileWriterTestCalculateNumberOfDivisions.cxx index 64920bdaf2a6c626b16f236c44ec2a5f9e55a0f0..4dcf1903fe0cb184abfa66b79f2a9050277985c9 100755 --- a/Testing/Code/IO/otbStreamingImageFileWriterTestCalculateNumberOfDivisions.cxx +++ b/Testing/Code/IO/otbStreamingImageFileWriterTestCalculateNumberOfDivisions.cxx @@ -72,6 +72,11 @@ int otbStreamingImageFileWriterTestCalculateNumberOfDivisions (int argc, char* a { writer->SetTilingStreamDivisions(); } + else if( MethodCalculateNumberOfStreamDivision == "TILING_NUMBER_OF_STREAM_DIVISIONS" ) + { + std::cout << "Number : " << ::atoi(argv[4]) << std::endl; + writer->SetTilingStreamDivisions(::atoi(argv[4])); + } else if( MethodCalculateNumberOfStreamDivision == "DEFAULT" ) { diff --git a/Testing/Code/Projections/CMakeLists.txt b/Testing/Code/Projections/CMakeLists.txt index edc7562ac858b65770aa64be52da811b7c5c2bd8..4a60abd88888065633ea002039922da193efa6ad 100755 --- a/Testing/Code/Projections/CMakeLists.txt +++ b/Testing/Code/Projections/CMakeLists.txt @@ -61,28 +61,60 @@ ADD_TEST(prTvRegionProjectionToulouse ${PROJECTIONS_TESTS} 500 500 10 +# 0.1 +# 0.1 ) ADD_TEST(prTvRegionProjectionResamplerToulouse ${PROJECTIONS_TESTS} otbRegionProjectionResampler ${IMAGEDATA}/TOULOUSE/QuickBird/000000128955_01_P001_PAN/02APR01105228-P1BS-000000128955_01_P001.TIF - ${TEMP}/RegionProjectionResamplerToulouse.hdr + ${TEMP}/prTvRegionProjectionResamplerToulouse.hdr 43.60 1.44 # Coordonn�es Lat/Long du Capitole Toulouse 2000 2000 200 + 0.00001 + 0.00001 + ) + +ADD_TEST(prTvRegionProjectionResamplerCevennes ${PROJECTIONS_TESTS} + otbRegionProjectionResampler + ${IMAGEDATA}/CEVENNES/06FEB12104912-P1BS-005533998070_01_P001.TIF + ${TEMP}/prTvRegionProjectionResamplerCevennes.tif + 44.08 + 3.7 + 500 + 500 + 10 + 0.00001 + 0.00001 ) -# ADD_TEST(prTvRegionProjectionCevennes ${PROJECTIONS_TESTS} -# otbRegionProjection -# ${IMAGEDATA}/CEVENNES/06FEB12104912-P1BS-005533998070_01_P001.TIF -# ${TEMP}/RegionProjectionCevennes.png -# 44.08 -# 3.7 -# 2000 -# 2000 -# 200 -# ) +ADD_TEST(prTvRegionProjectionCevennes ${PROJECTIONS_TESTS} + otbRegionProjection + ${IMAGEDATA}/CEVENNES/06FEB12104912-P1BS-005533998070_01_P001.TIF + ${TEMP}/prTvRegionProjectionCevennes.png + 44.08 + 3.7 + 500 + 500 + 10 +# 0.00001 +# 0.00001 + ) + +ADD_TEST(prTvOrthoRectificationCevennes ${PROJECTIONS_TESTS} + otbOrthoRectificationFilter + ${IMAGEDATA}/CEVENNES/06FEB12104912-P1BS-005533998070_01_P001.TIF + ${TEMP}/prTvOrthoRectificationCevennes.tif + 44.08 + 3.7 + 500 + 500 + 10 + 0.00001 + 0.00001 + ) # ADD_TEST(prTvSensorImageToCartoCevennes ${PROJECTIONS_TESTS} @@ -122,6 +154,7 @@ otbCreateProjectionWithOTB.cxx otbCreateInverseForwardSensorModel.cxx otbRegionProjection.cxx otbRegionProjectionResampler.cxx +otbOrthoRectificationFilter.cxx otbSensorImageToCarto.cxx otbSensorImageDEMToCarto.cxx ) diff --git a/Testing/Code/Projections/otbOrthoRectificationFilter.cxx b/Testing/Code/Projections/otbOrthoRectificationFilter.cxx new file mode 100644 index 0000000000000000000000000000000000000000..abfb02cba70a2ac546186e359866f43241632168 --- /dev/null +++ b/Testing/Code/Projections/otbOrthoRectificationFilter.cxx @@ -0,0 +1,167 @@ +/*========================================================================= + + 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 "otbOrthoRectificationFilter.h" +#include "otbMapProjections.h" + +#include "init/ossimInit.h" + + + +int otbOrthoRectificationFilter( int argc, char* argv[] ) +{ + try + { + + 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<unsigned char, 2> CharImageType; + typedef otb::Image<unsigned int, 2> ImageType; + typedef otb::ImageFileReader<ImageType> ReaderType; +// typedef otb::ImageFileWriter<ImageType> WriterType; + typedef otb::StreamingImageFileWriter<ImageType> WriterType; + + +// typedef otb::InverseSensorModel<double> ModelType; + typedef itk::LinearInterpolateImageFunction<ImageType, double > InterpolatorType; + + typedef otb::StreamingResampleImageFilter<ImageType,ImageType> ResamplerType; + typedef otb::UtmProjection utmMapProjectionType ; + typedef otb::OrthoRectificationFilter<ImageType, ImageType, utmMapProjectionType> OrthoRectifFilterType ; + typedef otb::InverseSensorModel<double> ModelType; + + //Allocate pointer + ReaderType::Pointer reader=ReaderType::New(); + WriterType::Pointer writer=WriterType::New(); +// ModelType::Pointer model=ModelType::New(); + InterpolatorType::Pointer interpolator=InterpolatorType::New(); + ModelType::Pointer model= ModelType::New(); + +// ResamplerType::Pointer orthoRectifFilter=ResamplerType::New(); + OrthoRectifFilterType::Pointer orthoRectifFilter=OrthoRectifFilterType::New(); + + // Set parameters ... + reader->SetFileName(argv[1]); + writer->SetFileName(argv[2]); + + // Read meta data (ossimKeywordlist) + reader->GenerateOutputInformation(); + model->SetImageGeometry(reader->GetOutput()->GetImageKeywordlist()); + +// std::cout << "Model1: " << model << std::endl; + + orthoRectifFilter->SetInput(reader->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); //latitude de l'origine. + origin[1]=strtod(argv[4], NULL); //longitude de l'origine. + orthoRectifFilter->SetOutputOrigin(origin); +// orthoRectifFilter->SetTransform( model ); +// model->SetImageGeometry(reader->GetOutput()->GetImageKeywordlist()); +// resampler->SetTransform(model); +// resampler->SetInterpolator(interpolator); +// orthoRectifFilter->SetResampler(resampler); +// orthoRectifFilter->SetInterpolator(interpolator); + +// orthoRectifFilter->SetResampler(resampler); +// orthoRectifFilter->SetTransform( model ); + + writer->SetInput(orthoRectifFilter->GetOutput()); + + writer->SetTilingStreamDivisions(20); + // writer->SetNumberOfStreamDivisions(1000); + otbGenericMsgDebugMacro(<< "Update writer ..." ); + writer->Update(); + + } + catch( itk::ExceptionObject & err ) + { + std::cout << "Exception itk::ExceptionObject levee !" << std::endl; + std::cout << err << std::endl; + return EXIT_FAILURE; + } + catch( std::bad_alloc & err ) + { + std::cout << "Exception bad_alloc : "<<(char*)err.what()<< std::endl; + return EXIT_FAILURE; + } + catch( ... ) + { + std::cout << "Exception levee inconnue !" << std::endl; + return EXIT_FAILURE; + } + return EXIT_SUCCESS; + + }//Fin main() + diff --git a/Testing/Code/Projections/otbProjectionBaseNew.cxx b/Testing/Code/Projections/otbProjectionBaseNew.cxx index 548648a941851fec8e83189ed5ed70573dfdf7c4..8f8461aa2bb8c2f4fb17ae40a31753c5ef8cea59 100755 --- a/Testing/Code/Projections/otbProjectionBaseNew.cxx +++ b/Testing/Code/Projections/otbProjectionBaseNew.cxx @@ -24,7 +24,7 @@ #include <iostream> #include "otbMapProjections.h" -#include "otbComposite.h" +#include "otbMapToMapProjection.h" int otbProjectionBaseNew( int argc, char* argv[] ) { @@ -33,8 +33,8 @@ int otbProjectionBaseNew( int argc, char* argv[] ) otb::AlbersProjection::Pointer lAlbersProjection = otb::AlbersProjection::New(); otb::AzimEquDistProjection::Pointer lAzimEquDistProjection = otb::AzimEquDistProjection::New(); - typedef otb::Composite<otb::AlbersProjection,otb::AzimEquDistProjection> CompositeType; - CompositeType::Pointer lComposite = CompositeType::New(); + typedef otb::MapToMapProjection<otb::AlbersProjection,otb::AzimEquDistProjection> MapToMapProjectionType; + MapToMapProjectionType::Pointer lMapToMapProjection = MapToMapProjectionType::New(); } catch( itk::ExceptionObject & err ) diff --git a/Testing/Code/Projections/otbProjectionsTests.cxx b/Testing/Code/Projections/otbProjectionsTests.cxx index 5618a60c01ad4bf02f2f5ea59126395d9674e489..edb451afa5b52fabae395037ad01c220e37b247a 100755 --- a/Testing/Code/Projections/otbProjectionsTests.cxx +++ b/Testing/Code/Projections/otbProjectionsTests.cxx @@ -35,6 +35,7 @@ REGISTER_TEST(otbCreateProjectionWithOTB); REGISTER_TEST(otbCreateInverseForwardSensorModel); REGISTER_TEST(otbRegionProjection); REGISTER_TEST(otbRegionProjectionResampler); +REGISTER_TEST(otbOrthoRectificationFilter); REGISTER_TEST(otbSensorImageToCarto); REGISTER_TEST(otbSensorImageDEMToCarto); } diff --git a/Testing/Code/Projections/otbRegionProjectionResampler.cxx b/Testing/Code/Projections/otbRegionProjectionResampler.cxx index bcaf46e826094443f96ce9d8638e806f9b4ab336..d33f662cec974391b267a4443b397ea6222813a0 100755 --- a/Testing/Code/Projections/otbRegionProjectionResampler.cxx +++ b/Testing/Code/Projections/otbRegionProjectionResampler.cxx @@ -38,6 +38,7 @@ #include "otbImageFileReader.h" #include "otbImageFileWriter.h" #include "otbStreamingImageFileWriter.h" +#include "otbStreamingResampleImageFilter.h" #include "itkExceptionObject.h" #include "itkExtractImageFilter.h" @@ -59,7 +60,7 @@ int otbRegionProjectionResampler( int argc, char* argv[] ) ossimInit::instance()->initialize(argc, argv); - if(argc!=8) + 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; @@ -69,7 +70,7 @@ int otbRegionProjectionResampler( int argc, char* argv[] ) typedef otb::Image<unsigned char, 2> CharImageType; - typedef otb::Image<unsigned int, 2> ImageType; + typedef otb::Image<unsigned short, 2> ImageType; typedef otb::ImageFileReader<ImageType> ReaderType; // typedef otb::ImageFileWriter<ImageType> WriterType; typedef otb::StreamingImageFileWriter<ImageType> WriterType; @@ -78,9 +79,10 @@ int otbRegionProjectionResampler( int argc, char* argv[] ) ImageType, double > InterpolatorType; typedef itk::RescaleIntensityImageFilter<ImageType,CharImageType> RescalerType; - typedef itk::ResampleImageFilter< ImageType, ImageType > - ResamplerType; - +// typedef itk::ResampleImageFilter< ImageType, ImageType > +// ResamplerType; + typedef otb::StreamingResampleImageFilter< ImageType, ImageType > + ResamplerType; ImageType::IndexType start; ImageType::SizeType size; ImageType::SpacingType spacing; @@ -117,8 +119,8 @@ int otbRegionProjectionResampler( int argc, char* argv[] ) region.SetSize(size); region.SetIndex(start); - spacing[0]=0.00001; - spacing[1]=0.00001; + spacing[0]=atof(argv[8]); + spacing[1]=atof(argv[9]); origin[0]=strtod(argv[3], NULL); //latitude de l'origine. origin[1]=strtod(argv[4], NULL); //longitude de l'origine. @@ -145,7 +147,8 @@ int otbRegionProjectionResampler( int argc, char* argv[] ) // rescaler->SetInput( resampler->GetOutput() ); writer->SetInput(resampler->GetOutput()); - writer->SetNumberOfStreamDivisions(1000); +// writer->SetNumberOfStreamDivisions(1000); + writer->SetTilingStreamDivisions(); otbGenericMsgDebugMacro(<< "Update writer ..." ); writer->Update();