diff --git a/CMake/ImportLibLAS.cmake b/CMake/ImportLibLAS.cmake index 3a4119154ffc2996a04ce8a06a99112763396b9f..83b49015a5a1117058e8d225f4fd48177f25c5aa 100644 --- a/CMake/ImportLibLAS.cmake +++ b/CMake/ImportLibLAS.cmake @@ -28,6 +28,8 @@ IF(OTB_USE_LIBLAS) MESSAGE(STATUS " Using LibLAS internal version") ENDIF(OTB_USE_EXTERNAL_LIBLAS) +ADD_DEFINITIONS(-DLAS_DISABLE_DLL) + ELSE(OTB_USE_LIBLAS) MESSAGE(STATUS " Disabling LibLAS support") diff --git a/Code/BasicFilters/otbComplexToVectorImageCastFilter.h b/Code/BasicFilters/otbComplexToVectorImageCastFilter.h new file mode 100644 index 0000000000000000000000000000000000000000..dac095af3ffd169aa4aeb103b0dda975132ad129 --- /dev/null +++ b/Code/BasicFilters/otbComplexToVectorImageCastFilter.h @@ -0,0 +1,107 @@ +/*========================================================================= + + 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 __otbComplexToVectorImageCastFilter_h +#define __otbComplexToVectorImageCastFilter_h + +#include "otbUnaryFunctorImageFilter.h" +#include "vnl/vnl_math.h" + +namespace otb +{ + +/** \class ComplexToVectorImageCastFilter + * \brief Transfomr a complex image into a 2 channels vector image. + * The first channel is the real part, the second the imaginary one. + * + * + * \sa ComplexToImaginaryImageFilter + * \sa ComplexToRealImageFilter + */ +namespace Functor { + +template< class TInput, class TOutput> +class ComplexToVector +{ +public: + typedef typename TOutput::ValueType OutputValueType; + + ComplexToVector() {} + ~ComplexToVector() {} + + // This is an obligation to use the functor in otbUnaryFunctorImageFilter + unsigned int GetOutputSize() + { + return 2; + } + + inline TOutput operator()( const TInput & A ) const + { + TOutput output; + output.SetSize(2); + + output[0] = static_cast<OutputValueType>(A.real()); + output[1] = static_cast<OutputValueType>(A.imag()); + + return output; + } +}; +} + +template <class TInputImage, class TOutputImage> +class ITK_EXPORT ComplexToVectorImageCastFilter : + public +otb::UnaryFunctorImageFilter<TInputImage,TOutputImage, + Functor::ComplexToVector< + typename TInputImage::PixelType, + typename TOutputImage::PixelType> > +{ +public: + /** Standard class typedefs. */ + typedef ComplexToVectorImageCastFilter Self; + typedef otb::UnaryFunctorImageFilter< + TInputImage,TOutputImage, + Functor::ComplexToVector< typename TInputImage::PixelType, + typename TOutputImage::PixelType> > Superclass; + typedef itk::SmartPointer<Self> Pointer; + typedef itk::SmartPointer<const Self> ConstPointer; + + /** Method for creation through the object factory. */ + itkNewMacro(Self); + + /** Runtime information support. */ + itkTypeMacro(ComplexToVectorImageCastFilter, + otb::UnaryFunctorImageFilter); + + typedef typename TInputImage::PixelType InputPixelType; + typedef typename TOutputImage::PixelType OutputPixelType; + + +protected: + ComplexToVectorImageCastFilter() {} + virtual ~ComplexToVectorImageCastFilter() {} + +private: + ComplexToVectorImageCastFilter(const Self&); //purposely not implemented + void operator=(const Self&); //purposely not implemented + +}; + +} // end namespace otb + + +#endif diff --git a/Code/Common/otbVariableLengthVectorConverter.txx b/Code/Common/otbVariableLengthVectorConverter.txx index 42931131a5789729f74a6344066f237bb336d95a..ec25d9722fac5d091eef63d3ff7276bb25adb244 100644 --- a/Code/Common/otbVariableLengthVectorConverter.txx +++ b/Code/Common/otbVariableLengthVectorConverter.txx @@ -91,7 +91,7 @@ typename VariableLengthVectorConverter< itk::FixedArray<TInternalInputType, VArr VariableLengthVectorConverter< itk::FixedArray<TInternalInputType, VArrayDimension>, TPrecisionType> ::Convert(InputType input) { - unsigned int p, q, rsltIdx = 0; + unsigned int rsltIdx = 0; OutputType result; result.SetSize(VArrayDimension); diff --git a/Code/IO/otbDEMToImageGenerator.txx b/Code/IO/otbDEMToImageGenerator.txx index 926922f5dd4f7e17bcbf7349e55c90996c76a692..ec926c4f90bb7f139befab14bca063ec006f1d1f 100644 --- a/Code/IO/otbDEMToImageGenerator.txx +++ b/Code/IO/otbDEMToImageGenerator.txx @@ -116,7 +116,6 @@ DEMToImageGenerator<TDEMImage> // Walk the output image, evaluating the height at each pixel IndexType currentindex; PointType phyPoint; - double height; PointType geoPoint; for (outIt.GoToBegin(); !outIt.IsAtEnd(); ++outIt) diff --git a/Code/IO/otbPointSetFileReader.txx b/Code/IO/otbPointSetFileReader.txx index 07bb158c0f6c6f43a964ed05db614ae8fc024a30..8f7d9a98d8feed6838d32b890c2e02dd693fb021 100644 --- a/Code/IO/otbPointSetFileReader.txx +++ b/Code/IO/otbPointSetFileReader.txx @@ -21,11 +21,11 @@ #include "otbPointSetFileReader.h" #include "otbMacro.h" -#include <liblas/laspoint.hpp> -#include <liblas/lasreader.hpp> +#include <liblas/capi/liblas.h> #include <fstream> // std::ifstream #include <iostream> // std::cout +#include <iomanip> namespace otb { @@ -64,22 +64,20 @@ PointSetFileReader<TOutputPointSet> this->TestFileExistanceAndReadability(); - std::ifstream ifs; - ifs.open(m_FileName.c_str(), std::ios::in | std::ios::binary); - liblas::Reader reader(ifs); + LASReaderH reader = LASReader_Create(m_FileName.c_str()); + LASHeaderH header = LASReader_GetHeader(reader); + + otbDebugMacro(<< "Signature: " << LASHeader_GetFileSignature(header)); + otbDebugMacro(<< "Points count: " << LASHeader_GetPointRecordsCount(header)); - liblas::Header const& header = reader.GetHeader(); - - otbDebugMacro(<< "Signature: " << header.GetFileSignature()); - otbDebugMacro(<< "Points count: " << header.GetPointRecordsCount()); - - m_NumberOfPoints = header.GetPointRecordsCount(); - m_MinX = header.GetMinX(); - m_MaxX = header.GetMaxX(); - m_MinY = header.GetMinY(); - m_MaxY = header.GetMaxY(); - ifs.close(); + m_NumberOfPoints = LASHeader_GetPointRecordsCount(header); + m_MinX = LASHeader_GetMinX(header); + m_MaxX = LASHeader_GetMaxX(header); + m_MinY = LASHeader_GetMinY(header); + m_MaxY = LASHeader_GetMaxX(header); + + LASReader_Destroy(reader); } template <class TOutputPointSet> @@ -123,55 +121,52 @@ void PointSetFileReader<TOutputPointSet> ::GenerateData() { typename TOutputPointSet::Pointer output = this->GetOutput(); + + LASReaderH reader = LASReader_Create(m_FileName.c_str()); + LASHeaderH header = LASReader_GetHeader(reader); - std::ifstream ifs; - ifs.open(m_FileName.c_str(), std::ios::in | std::ios::binary); - liblas::Reader reader(ifs); - - liblas::Header const& header = reader.GetHeader(); + otbDebugMacro(<< "Signature: " << LASHeader_GetFileSignature(header)); + otbDebugMacro(<< "Points count: " << LASHeader_GetPointRecordsCount(header)); - otbDebugMacro(<< "Signature: " << header.GetFileSignature()); - otbDebugMacro(<< "Points count: " << header.GetPointRecordsCount()); - - m_NumberOfPoints = header.GetPointRecordsCount(); + m_NumberOfPoints = LASHeader_GetPointRecordsCount(header); //If the output pointset is of dimension 2, altitude is stored as information if (PointType::PointDimension == 2) { - while (reader.ReadNextPoint()) + LASPointH pt = LASPoint_Create(); + while (pt = LASReader_GetNextPoint(reader)) { - liblas::Point const& p = reader.GetPoint(); - + PointType point; - point[0] = p.GetX(); - point[1] = p.GetY(); + point[0] = LASPoint_GetX(pt); + point[1] = LASPoint_GetY(pt); unsigned long i = output->GetNumberOfPoints(); output->SetPoint(i, point); PixelType V; - V = static_cast<PixelType>(p.GetZ()); + V = static_cast<PixelType>(LASPoint_GetZ(pt)); output->SetPointData(i, V); - } } //If the output pointset is of dimension 3, store the altitude as information else if (PointType::PointDimension == 3) { - while (reader.ReadNextPoint()) + LASPointH p = LASPoint_Create(); + while (p = LASReader_GetNextPoint(reader)) { - liblas::Point const& p = reader.GetPoint(); + //liblas::Point const& p = reader.GetPoint(); PointType point; - point[0] = p.GetX(); - point[1] = p.GetY(); - point[2] = p.GetZ(); + point[0] = LASPoint_GetX(p); + point[1] = LASPoint_GetY(p); + point[2] = LASPoint_GetZ(p); unsigned long i = output->GetNumberOfPoints(); output->SetPoint(i, point); PixelType V; - V = static_cast<PixelType>(p.GetZ()); + V = static_cast<PixelType>(LASPoint_GetZ(p)); output->SetPointData(i, V); } @@ -181,7 +176,7 @@ void PointSetFileReader<TOutputPointSet> itkExceptionMacro(<< "Can't handle pointset dimension other than 2 and 3"); } - ifs.close(); + LASReader_Destroy(reader); } template <class TOutputPointSet> diff --git a/Code/ObjectDetection/otbDescriptorsListSampleGenerator.h b/Code/ObjectDetection/otbDescriptorsListSampleGenerator.h index 7226f367ff41385687cc25fd5fd9c2da02eb6309..17316ac263a033c482ecc5927776871a1980bc14 100644 --- a/Code/ObjectDetection/otbDescriptorsListSampleGenerator.h +++ b/Code/ObjectDetection/otbDescriptorsListSampleGenerator.h @@ -158,6 +158,11 @@ public: void Reset(void); void Synthetize(void); + void AddInput(itk::DataObject * dataObject) + { + Superclass::AddInput(dataObject); + } + protected: PersistentDescriptorsListSampleGenerator(); virtual ~PersistentDescriptorsListSampleGenerator(); @@ -292,6 +297,11 @@ public: return this->GetFilter()->GetInput(); } + void AddInput(itk::DataObject * dataObject) + { + this->GetFilter()->AddInput(dataObject); + } + /** Sample locations as a VectorData of points. The label is in the ClassKey feature */ void SetSamplesLocations(InputVectorDataType * input) { diff --git a/Code/ObjectDetection/otbObjectDetectionClassifier.h b/Code/ObjectDetection/otbObjectDetectionClassifier.h index dbda8afcda3b3c8597540550dff5034686393af0..2887302eb586549693e2442b00572245c218b1fc 100644 --- a/Code/ObjectDetection/otbObjectDetectionClassifier.h +++ b/Code/ObjectDetection/otbObjectDetectionClassifier.h @@ -114,6 +114,11 @@ public: typedef itk::Statistics::ListSample<DescriptorType> ListSampleType; + void AddInput(itk::DataObject * dataObject) + { + this->Superclass::AddInput(dataObject); + } + /** SVM model used for classification */ void SetSVMModel(SVMModelType * model); @@ -287,6 +292,11 @@ public: return this->GetFilter()->GetOutputVectorData(); } + void AddInput(itk::DataObject * dataObject) + { + this->GetFilter()->AddInput(dataObject); + } + /** The function to evaluate */ void SetDescriptorsFunction(DescriptorsFunctionType * input) { diff --git a/Examples/Filtering/CMakeLists.txt b/Examples/Filtering/CMakeLists.txt index 2882386d97276e5bffa5535731272377b45a1b88..da29f9a5691ff8ad39fb7981fb32dd88b7e09239 100644 --- a/Examples/Filtering/CMakeLists.txt +++ b/Examples/Filtering/CMakeLists.txt @@ -96,13 +96,13 @@ ADD_TEST(fiTeDanielssonDistanceMapImageFilterTest ${EXE_TESTS} ${TEMP}/DanielssonDistanceMapImageFilterOutput1.png ${BASELINE}/DanielssonDistanceMapImageFilterOutput2.png ${TEMP}/DanielssonDistanceMapImageFilterOutput2.png - ${BASELINE}/DanielssonDistanceMapImageFilterOutput3.mhd - ${TEMP}/DanielssonDistanceMapImageFilterOutput3.mhd + ${BASELINE}/DanielssonDistanceMapImageFilterOutput3.tif + ${TEMP}/DanielssonDistanceMapImageFilterOutput3.tif DanielssonDistanceMapImageFilterTest ${INPUTDATA}/FivePoints.png ${TEMP}/DanielssonDistanceMapImageFilterOutput1.png ${TEMP}/DanielssonDistanceMapImageFilterOutput2.png - ${TEMP}/DanielssonDistanceMapImageFilterOutput3.mhd + ${TEMP}/DanielssonDistanceMapImageFilterOutput3.tif ) # ------- MeanImageFilterTest---------- diff --git a/Testing/Code/BasicFilters/CMakeLists.txt b/Testing/Code/BasicFilters/CMakeLists.txt index ba96a7cf7c94546d9a0e08c58353e204eb717d30..a00f93edc256f664e4f5542fc3e514402c5b9d05 100644 --- a/Testing/Code/BasicFilters/CMakeLists.txt +++ b/Testing/Code/BasicFilters/CMakeLists.txt @@ -1800,6 +1800,20 @@ ADD_TEST(bfTvImaginaryImageToComplexImageFilterTest ${BASICFILTERS_TESTS13} ${INPUTDATA}/GomaAvant.png ) +ADD_TEST(bfTuComplexToVectorImageCastFilterNew ${BASICFILTERS_TESTS13} + otbComplexToVectorImageCastFilterNew +) + +ADD_TEST(bfTuComplexToVectorImageCastFilterTest ${BASICFILTERS_TESTS13} + --compare-image ${NOTOL} + ${TEMP}/bfTvComplexToVectorImageCastFilterTest.tif + ${BASELINE}/bfTvComplexToVectorImageCastFilterTest.tif + otbComplexToVectorImageCastFilterTest + ${INPUTDATA}/RSAT_imagery_HH.tif + ${TEMP}/bfTvComplexToVectorImageCastFilterTest.tif +) + + # A enrichir SET(BasicFilters_SRCS1 @@ -2052,6 +2066,7 @@ otbComplexToIntensityFilterTest.cxx otbRealAndImaginaryImageToComplexImageFilterTest.cxx otbRealImageToComplexImageFilterTest.cxx otbImaginaryImageToComplexImageFilterTest.cxx +otbComplexToVectorImageCastFilter.cxx ) diff --git a/Testing/Code/BasicFilters/otbBandMathImageFilter.cxx b/Testing/Code/BasicFilters/otbBandMathImageFilter.cxx index dc02e71901eee8d631f19a86e392ab54c877d5ee..f6b8e209aeb1952098265a01c5af36818753d3ca 100644 --- a/Testing/Code/BasicFilters/otbBandMathImageFilter.cxx +++ b/Testing/Code/BasicFilters/otbBandMathImageFilter.cxx @@ -193,8 +193,7 @@ int otbBandMathImageFilterWithIdx( int argc, char* argv[]) typedef otb::Image<PixelType, 2> ImageType; typedef otb::BandMathImageFilter<ImageType> FilterType; typedef otb::StreamingImageFileWriter<ImageType> WriterType; - - unsigned int i; + const unsigned int N = 100; unsigned int FAIL_FLAG = 0; diff --git a/Testing/Code/BasicFilters/otbBasicFiltersTests13.cxx b/Testing/Code/BasicFilters/otbBasicFiltersTests13.cxx index d6bdf233b8a3b6b3f017d999651d98e000c529dd..615c791a9c052f82f5220e1835c0a5564ba77eda 100644 --- a/Testing/Code/BasicFilters/otbBasicFiltersTests13.cxx +++ b/Testing/Code/BasicFilters/otbBasicFiltersTests13.cxx @@ -33,4 +33,6 @@ void RegisterTests() REGISTER_TEST(otbRealAndImaginaryImageToComplexImageFilterTest); REGISTER_TEST(otbRealImageToComplexImageFilterTest); REGISTER_TEST(otbImaginaryImageToComplexImageFilterTest); + REGISTER_TEST(otbComplexToVectorImageCastFilterNew); + REGISTER_TEST(otbComplexToVectorImageCastFilterTest); } diff --git a/Testing/Code/BasicFilters/otbComplexToVectorImageCastFilter.cxx b/Testing/Code/BasicFilters/otbComplexToVectorImageCastFilter.cxx new file mode 100644 index 0000000000000000000000000000000000000000..73b77452642272c76107bb472b8976e01be0b6e1 --- /dev/null +++ b/Testing/Code/BasicFilters/otbComplexToVectorImageCastFilter.cxx @@ -0,0 +1,69 @@ +/*========================================================================= + + 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. + +=========================================================================*/ +#include "itkExceptionObject.h" + +#include "otbComplexToVectorImageCastFilter.h" +#include "otbVectorImage.h" +#include "otbImage.h" +#include "otbImageFileReader.h" +#include "otbImageFileWriter.h" + + +int otbComplexToVectorImageCastFilterNew(int argc, char * argv[]) +{ + typedef std::complex<float> ComplexType; + typedef otb::Image<ComplexType, 2> CplxImageType; + typedef otb::VectorImage<float, 2> VectorImageType; + + typedef otb::ComplexToVectorImageCastFilter<CplxImageType, VectorImageType> FilterType; + + // Instantiating object + FilterType::Pointer caster = FilterType::New(); + + + return EXIT_SUCCESS; +} + +int otbComplexToVectorImageCastFilterTest(int argc, char * argv[]) +{ + const char * infname = argv[1]; + const char * outfname = argv[2]; + + typedef std::complex<float> ComplexType; + typedef otb::Image<ComplexType, 2> CplxImageType; + typedef otb::VectorImage<float, 2> VectorImageType; + + typedef otb::ComplexToVectorImageCastFilter<CplxImageType, VectorImageType> FilterType; + typedef otb::ImageFileReader<CplxImageType> ReaderType; + typedef otb::ImageFileWriter<VectorImageType> WriterType; + + + // Instantiating objects + ReaderType::Pointer reader = ReaderType::New(); + WriterType::Pointer writer = WriterType::New(); + FilterType::Pointer caster = FilterType::New(); + + reader->SetFileName(argv[1]); + caster->SetInput(reader->GetOutput()); + writer->SetFileName(argv[2]); + writer->SetInput( caster->GetOutput()); + + writer->Update(); + + return EXIT_SUCCESS; +} diff --git a/Testing/Code/DisparityMap/CMakeLists.txt b/Testing/Code/DisparityMap/CMakeLists.txt index 9e5764970e0bda1aa5a4968ab740e1ce4b61bfc4..199fd525463a58da56a259081e42788c47910153 100644 --- a/Testing/Code/DisparityMap/CMakeLists.txt +++ b/Testing/Code/DisparityMap/CMakeLists.txt @@ -336,6 +336,7 @@ ADD_TEST(feTvFineRegistrationImageFilterTestWithCorrelation ${DISPARITYMAP_TESTS 1 # Grid step 0 # Initial offset x 0 # Initial offset y + 0 0 80 130 # region to proceed ) ADD_TEST(feTvFineRegistrationImageFilterTestWithNormalizedCorrelation ${DISPARITYMAP_TESTS3} @@ -356,6 +357,7 @@ ADD_TEST(feTvFineRegistrationImageFilterTestWithNormalizedCorrelation ${DISPARIT 1 # Grid step 0 # Initial offset x 0 # Initial offset y + 0 0 80 130 # region to proceed ) ADD_TEST(feTvFineRegistrationImageFilterTestWithMeanSquare ${DISPARITYMAP_TESTS3} @@ -376,6 +378,7 @@ ADD_TEST(feTvFineRegistrationImageFilterTestWithMeanSquare ${DISPARITYMAP_TESTS3 1 # Grid step 0 # Initial offset x 0 # Initial offset y + 0 0 80 130 # region to proceed ) ADD_TEST(feTvFineRegistrationImageFilterTestWithMeanReciprocalDifference ${DISPARITYMAP_TESTS3} @@ -396,6 +399,7 @@ ADD_TEST(feTvFineRegistrationImageFilterTestWithMeanReciprocalDifference ${DISPA 1 # Grid step 0 # Initial offset x 0 # Initial offset y + 0 0 80 130 # region to proceed ) # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ diff --git a/Testing/Code/DisparityMap/otbFineRegistrationImageFilterTest.cxx b/Testing/Code/DisparityMap/otbFineRegistrationImageFilterTest.cxx index 6585c9cb3b193a5464c65a41de188b64de841c7c..c9de4c1ce9637c9f0aaf8240cf3a92ae31c8df8a 100644 --- a/Testing/Code/DisparityMap/otbFineRegistrationImageFilterTest.cxx +++ b/Testing/Code/DisparityMap/otbFineRegistrationImageFilterTest.cxx @@ -26,6 +26,8 @@ #include "otbFineRegistrationImageFilter.h" #include "otbStandardFilterWatcher.h" #include "itkTimeProbe.h" +#include "otbExtractROI.h" + #include "itkNormalizedCorrelationImageToImageMetric.h" #include "itkMeanReciprocalSquareDifferenceImageToImageMetric.h" @@ -33,11 +35,12 @@ int otbFineRegistrationImageFilterTest( int argc, char * argv[] ) { - if(argc!=12) + if(argc!=16) { std::cerr<<"Usage: "<<argv[0]<<" fixed_fname moving_fname output_correl output_field radius search_radius "; std::cerr<<"subpixPrecision metric(0=CC,1=NCC,2=MeanSquare,3=Mean reciprocal square difference) "; std::cerr<<"gridStep offsetX offsetY"<<std::endl; + std::cerr<<"ROI : indexX, indexY, startX, startY"<<std::endl; return EXIT_FAILURE; } const char * fixedFileName = argv[1]; @@ -51,16 +54,21 @@ int otbFineRegistrationImageFilterTest( int argc, char * argv[] ) const unsigned int gridStep = atoi(argv[9]); const double offsetx = atof(argv[10]); const double offsety = atof(argv[11]); + const unsigned int startX = atoi(argv[12]); + const unsigned int startY = atoi(argv[13]); + const unsigned int sizeX = atoi(argv[14]); + const unsigned int sizeY = atoi(argv[15]); typedef double PixelType; const unsigned int Dimension = 2; - typedef itk::FixedArray<PixelType,Dimension> DeformationValueType; - typedef otb::Image< PixelType, Dimension > ImageType; - typedef otb::Image<DeformationValueType,Dimension> FieldImageType; - typedef otb::ImageFileReader< ImageType > ReaderType; - typedef otb::ImageFileWriter< ImageType > CorrelWriterType; - typedef otb::ImageFileWriter< FieldImageType> FieldWriterType; + typedef itk::FixedArray<PixelType,Dimension> DeformationValueType; + typedef otb::Image< PixelType, Dimension > ImageType; + typedef otb::Image<DeformationValueType,Dimension> FieldImageType; + typedef otb::ImageFileReader< ImageType > ReaderType; + typedef otb::ImageFileWriter< ImageType > CorrelWriterType; + typedef otb::ImageFileWriter< FieldImageType> FieldWriterType; + typedef otb::ExtractROI<PixelType, PixelType> ExtractFiltertype; typedef otb::FineRegistrationImageFilter<ImageType,ImageType,FieldImageType> RegistrationFilterType; ReaderType::Pointer freader = ReaderType::New(); @@ -71,9 +79,22 @@ int otbFineRegistrationImageFilterTest( int argc, char * argv[] ) mreader->SetFileName(movingFileName); //mreader->Update(); + ExtractFiltertype::Pointer fextract = ExtractFiltertype::New(); + fextract->SetInput(freader->GetOutput()); + fextract->SetStartX(startX); + fextract->SetStartY(startY); + fextract->SetSizeX(sizeX); + fextract->SetSizeY(sizeY); + ExtractFiltertype::Pointer mextract = ExtractFiltertype::New(); + mextract->SetInput(mreader->GetOutput()); + mextract->SetStartX(startX); + mextract->SetStartY(startY); + mextract->SetSizeX(sizeX); + mextract->SetSizeY(sizeY); + RegistrationFilterType::Pointer registration = RegistrationFilterType::New(); - registration->SetFixedInput(freader->GetOutput()); - registration->SetMovingInput(mreader->GetOutput()); + registration->SetFixedInput(/*freader*/fextract->GetOutput()); + registration->SetMovingInput(/*mreader*/mextract->GetOutput()); registration->SetRadius(radius); registration->SetSearchRadius(sradius); registration->SetSubPixelAccuracy(precision); diff --git a/Testing/Code/IO/otbImageFileReaderRADComplexFloatExtract.cxx b/Testing/Code/IO/otbImageFileReaderRADComplexFloatExtract.cxx index c66c9928edbd12cb8b0ebd77e235e64840c4a86b..672b363c6bd180493d4b358d42090f4237725b33 100644 --- a/Testing/Code/IO/otbImageFileReaderRADComplexFloatExtract.cxx +++ b/Testing/Code/IO/otbImageFileReaderRADComplexFloatExtract.cxx @@ -27,10 +27,7 @@ #include "otbImageFileReader.h" #include "otbImageFileWriter.h" #include "otbExtractROI.h" -#include "itkComplexToRealImageFilter.h" -#include "itkComplexToImaginaryImageFilter.h" -#include "otbImageList.h" -#include "otbImageListToVectorImageFilter.h" +#include "otbComplexToVectorImageCastFilter.h" int otbImageFileReaderRADComplexFloatExtract(int argc, char* argv[]) @@ -46,20 +43,18 @@ int otbImageFileReaderRADComplexFloatExtract(int argc, char* argv[]) typedef otb::Image<InputPixelType, Dimension> InputImageType; typedef otb::Image<OutputPixelType, Dimension> OutputCplxImageType; - typedef otb::Image<int, Dimension> OutputScalarImageType; - typedef otb::VectorImage<int, Dimension> OutputImageType; - typedef otb::ImageList<OutputScalarImageType> ImageListType; + typedef otb::Image<float, Dimension> OutputScalarImageType; + typedef otb::VectorImage<float, Dimension> OutputImageType; typedef otb::ImageFileReader<InputImageType> ReaderType; typedef otb::ImageFileWriter<OutputImageType> WriterType; - typedef itk::ComplexToRealImageFilter<OutputCplxImageType, OutputScalarImageType> RealExtractorType; - typedef itk::ComplexToImaginaryImageFilter<OutputCplxImageType -, OutputScalarImageType> ImaginaryExtractorType; - typedef otb::ImageListToVectorImageFilter<ImageListType, OutputImageType> ListToVectorImageFilterType; + + typedef otb::ComplexToVectorImageCastFilter<OutputCplxImageType, OutputImageType> CasterType; ReaderType::Pointer reader = ReaderType::New(); WriterType::Pointer writer = WriterType::New(); + CasterType::Pointer caster = CasterType::New(); reader->SetFileName(inputFilename); writer->SetFileName(outputFilename); @@ -76,22 +71,9 @@ int otbImageFileReaderRADComplexFloatExtract(int argc, char* argv[]) extractROIFilter->SetSizeX(100); extractROIFilter->SetSizeY(100); - // The rest of the code is here to translate the image complexe into - // a VectorImage of int which each channel is the real and imagynary part - - RealExtractorType::Pointer realExt = RealExtractorType::New(); - ImaginaryExtractorType::Pointer imgExt = ImaginaryExtractorType::New(); - - realExt->SetInput(extractROIFilter->GetOutput()); - imgExt->SetInput(extractROIFilter->GetOutput()); - - ImageListType::Pointer imList = ImageListType::New(); - imList->PushBack(realExt->GetOutput()); - imList->PushBack(imgExt->GetOutput()); - ListToVectorImageFilterType::Pointer listCaster = ListToVectorImageFilterType::New(); - listCaster->SetInput(imList); + caster->SetInput(extractROIFilter->GetOutput()); - writer->SetInput(listCaster->GetOutput()); + writer->SetInput(caster->GetOutput()); writer->Update(); return EXIT_SUCCESS; diff --git a/Testing/Code/Projections/CMakeLists.txt b/Testing/Code/Projections/CMakeLists.txt index dd8ed1c1217d6fd9e5f13fd17ce6e436c069f147..4d58d4944dcaac00914999c16f4ea120ed1fa1a0 100644 --- a/Testing/Code/Projections/CMakeLists.txt +++ b/Testing/Code/Projections/CMakeLists.txt @@ -393,7 +393,7 @@ ADD_TEST(prTlOrthoRectificationSPOT5 ${PROJECTIONS_TESTS2} ) ADD_TEST(prTlOrthoRectificationMonoThreadSPOT5 ${PROJECTIONS_TESTS2} - --compare-image ${EPSILON_4} ${BASELINE}/prTvOrthoRectificationSPOT5_UTM.tif + --compare-image ${EPSILON_4} ${BASELINE}/prTvOrthoRectificationSPOT5_UTM_band1.tif ${TEMP}/prTvOrthoRectificationMonoThreadSPOT5_UTM.tif otbOrthoRectificationMonoThreadFilter ${LARGEINPUT}/SPOT5/TEHERAN/IMAGERY.TIF diff --git a/Testing/Code/Projections/otbOrthoRectificationMonoThreadFilter.cxx b/Testing/Code/Projections/otbOrthoRectificationMonoThreadFilter.cxx index 649b021cf3d032a6afa77d7ecbdfc1a0c5fa3824..7e3334f2d6d1e996eb7d966e536854ab1840a909 100644 --- a/Testing/Code/Projections/otbOrthoRectificationMonoThreadFilter.cxx +++ b/Testing/Code/Projections/otbOrthoRectificationMonoThreadFilter.cxx @@ -25,10 +25,12 @@ #include "otbMacro.h" #include "otbImage.h" +#include "otbVectorImage.h" #include "otbImageFileReader.h" #include "otbStreamingImageFileWriter.h" #include "otbInverseSensorModel.h" #include "otbStreamingResampleImageFilter.h" +#include "otbMultiToMonoChannelExtractROI.h" #include "otbOrthoRectificationFilter.h" #include "otbMapProjections.h" @@ -47,15 +49,21 @@ int otbOrthoRectificationMonoThreadFilter(int argc, char* argv[]) return EXIT_FAILURE; } - typedef otb::Image<double, 2> ImageType; - typedef otb::ImageFileReader<ImageType> ReaderType; - typedef otb::StreamingImageFileWriter<ImageType> WriterType; + typedef double PixelType; + typedef otb::Image<PixelType, 2> ImageType; + typedef otb::VectorImage<PixelType, 2> VectorImageType; + typedef otb::ImageFileReader<VectorImageType> ReaderType; + typedef otb::StreamingImageFileWriter<ImageType> WriterType; + + typedef otb::MultiToMonoChannelExtractROI<PixelType, PixelType> ExtractorType; typedef otb::UtmInverseProjection UtmMapProjectionType; typedef otb::OrthoRectificationFilter<ImageType, ImageType, UtmMapProjectionType> OrthoRectifFilterType; + //Allocate pointer ReaderType::Pointer reader = ReaderType::New(); WriterType::Pointer writer = WriterType::New(); + ExtractorType::Pointer extractor = ExtractorType::New(); OrthoRectifFilterType::Pointer orthoRectifFilter = OrthoRectifFilterType::New(); UtmMapProjectionType::Pointer utmMapProjection = UtmMapProjectionType::New(); @@ -65,9 +73,12 @@ int otbOrthoRectificationMonoThreadFilter(int argc, char* argv[]) writer->SetFileName(argv[2]); reader->GenerateOutputInformation(); - std::cout << reader->GetOutput() << std::endl; - orthoRectifFilter->SetInput(reader->GetOutput()); + // Extract the first channel of the image + extractor->SetInput(reader->GetOutput()); + extractor->SetChannel(1); + + orthoRectifFilter->SetInput(extractor->GetOutput()); ImageType::IndexType start; start[0] = 0; diff --git a/Testing/Code/Radiometry/otbTerraSarCalibrationImageComplexFilterTest.cxx b/Testing/Code/Radiometry/otbTerraSarCalibrationImageComplexFilterTest.cxx index 706a5cae7a8f5a87865ae465b40bd47ac395ea91..6df4bffe9ab864fc4b1f532d833cf15c0e1aae48 100644 --- a/Testing/Code/Radiometry/otbTerraSarCalibrationImageComplexFilterTest.cxx +++ b/Testing/Code/Radiometry/otbTerraSarCalibrationImageComplexFilterTest.cxx @@ -20,9 +20,12 @@ #include "otbTerraSarCalibrationImageFilter.h" #include "otbImage.h" #include "otbVectorImage.h" +#include "otbVectorImage.h" #include "itkExtractImageFilter.h" #include "otbImageFileReader.h" #include "otbImageFileWriter.h" +#include "otbComplexToVectorImageCastFilter.h" + int otbTerraSarCalibrationImageComplexFilterTest(int argc, char * argv[]) { @@ -31,17 +34,22 @@ int otbTerraSarCalibrationImageComplexFilterTest(int argc, char * argv[]) const bool useFastCalibration = atoi(argv[3]); const bool resultsInDbs = atoi(argv[4]); - typedef std::complex<double> ComplexType; - typedef otb::Image<ComplexType, 2> ImageType; - typedef otb::ImageFileReader<ImageType> ReaderType; - typedef otb::ImageFileWriter<ImageType> WriterType; - typedef otb::TerraSarCalibrationImageFilter<ImageType, ImageType> FilterType; - typedef itk::ExtractImageFilter<ImageType, ImageType> ExtractorType; + typedef std::complex<double> ComplexType; + typedef otb::Image<ComplexType, 2> ImageCplxType; + typedef otb::Image<double, 2> ImageScalarType; + typedef otb::VectorImage<double, 2> OutputImageType; + + typedef otb::ImageFileReader<ImageCplxType> ReaderType; + typedef otb::ImageFileWriter<OutputImageType> WriterType; + typedef otb::TerraSarCalibrationImageFilter<ImageCplxType, ImageCplxType> FilterType; + typedef itk::ExtractImageFilter<ImageCplxType, ImageCplxType> ExtractorType; + typedef otb::ComplexToVectorImageCastFilter<ImageCplxType, OutputImageType> CasterType; ReaderType::Pointer reader = ReaderType::New(); WriterType::Pointer writer = WriterType::New(); FilterType::Pointer filter = FilterType::New(); ExtractorType::Pointer extractor = ExtractorType::New(); + CasterType::Pointer caster = CasterType::New(); reader->SetFileName(inputFileName); writer->SetFileName(outputFileName); @@ -52,26 +60,30 @@ int otbTerraSarCalibrationImageComplexFilterTest(int argc, char * argv[]) filter->SetUseFastCalibration(useFastCalibration); filter->SetResultsInDecibels(resultsInDbs); + if (argc == 9) { - ImageType::RegionType region; - ImageType::IndexType id; + ImageCplxType::RegionType region; + ImageCplxType::IndexType id; id[0] = atoi(argv[5]); id[1] = atoi(argv[6]); - ImageType::SizeType size; + ImageCplxType::SizeType size; size[0] = atoi(argv[7]); size[1] = atoi(argv[8]); region.SetIndex(id); region.SetSize(size); extractor->SetExtractionRegion(region); extractor->SetInput(filter->GetOutput()); - writer->SetInput(extractor->GetOutput()); + + caster->SetInput(extractor->GetOutput()); } else { - writer->SetInput(filter->GetOutput()); + caster->SetInput(filter->GetOutput()); } - + + + writer->SetInput(caster->GetOutput()); writer->Update(); return EXIT_SUCCESS; diff --git a/Testing/Fa/CMakeLists.txt b/Testing/Fa/CMakeLists.txt index 75071466b8b2ef90d2b4fbabff2b5980570fb6fb..48016e093fadd277fbb73c7e5c1ea429753dfe44 100644 --- a/Testing/Fa/CMakeLists.txt +++ b/Testing/Fa/CMakeLists.txt @@ -172,7 +172,7 @@ ENDIF (OTB_USE_DEPRECATED) # --- FA 00060 : Pb Map activation --- ADD_TEST(FA-00060-le_Map_Activation ${CXX_TEST_PATH}/MapActivation - ${INPUTDATA}/list.mhd + ${INPUTDATA}/list.tif 4 4 20 diff --git a/Testing/Utilities/CMakeLists.txt b/Testing/Utilities/CMakeLists.txt index 94a4d72111e90803687c9057d3ac5ea552307b12..10048f45221fe6d52edaedbd8a8a72a02112bb3b 100644 --- a/Testing/Utilities/CMakeLists.txt +++ b/Testing/Utilities/CMakeLists.txt @@ -462,13 +462,13 @@ ADD_TEST( utTvKmlprintgeometry ${UTILITIES_TESTS} # with 2 features. ADD_TEST( utTvClassifyKNN2 ${UTILITIES_TESTS} --compare-image ${NOTOL} - ${BASELINE}/output2D_2ch.mhd - ${TEMP}/output2D_2ch.mhd + ${BASELINE}/output2D_2ch.tif + ${TEMP}/output2D_2ch.tif classifyKNN2 ${INPUTDATA}/mapfile.t1t2_139_2 - ${INPUTDATA}/mst1139.mhd - ${INPUTDATA}/mst2139.mhd - ${TEMP}/output2D_2ch.mhd + ${INPUTDATA}/mst1139.tif + ${INPUTDATA}/mst2139.tif + ${TEMP}/output2D_2ch.tif 4 ) diff --git a/Utilities/otbliblas/CMakeLists.txt b/Utilities/otbliblas/CMakeLists.txt index 554ca0428292992405cf33322d73a1629cdde7d7..f16bfe8883329756795c43919bee174999ac9395 100755 --- a/Utilities/otbliblas/CMakeLists.txt +++ b/Utilities/otbliblas/CMakeLists.txt @@ -4,8 +4,6 @@ SET(liblas_VERSION_MAJOR "1") SET(liblas_VERSION_MINOR "6") SET(liblas_VERSION_PATCH "0") -ADD_DEFINITIONS(-DLAS_DISABLE_DLL) - INCLUDE_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR}/include) SET(liblas_SOURCES_DIR ${CMAKE_CURRENT_SOURCE_DIR}/src) diff --git a/Utilities/otbossim/src/ossim/imaging/ossimNitfTileSource.cpp b/Utilities/otbossim/src/ossim/imaging/ossimNitfTileSource.cpp index e4f546fbe59be0fe2512a856a63a0a4b049c50ca..4612ff356174e15fddbba74a37e9e908afca5d04 100644 --- a/Utilities/otbossim/src/ossim/imaging/ossimNitfTileSource.cpp +++ b/Utilities/otbossim/src/ossim/imaging/ossimNitfTileSource.cpp @@ -43,6 +43,11 @@ #include <ossim/support_data/ossimNitfStdidcTag.h> #include <ossim/support_data/ossimNitfVqCompressionHeader.h> + +#if defined(JPEG_DUAL_MODE_8_12) +#undef JPEG_DUAL_MODE_8_12 +#endif + #if defined(JPEG_DUAL_MODE_8_12) #include <ossim/imaging/ossimNitfTileSource_12.h> #endif diff --git a/Utilities/otbossim/src/ossim/imaging/ossimNitfTileSource_12.cpp b/Utilities/otbossim/src/ossim/imaging/ossimNitfTileSource_12.cpp index 55be3030c6bbb450d7035e91fc4a1a7acdf8db6f..b6b882deac91249505e66ed5c610598b708e6371 100644 --- a/Utilities/otbossim/src/ossim/imaging/ossimNitfTileSource_12.cpp +++ b/Utilities/otbossim/src/ossim/imaging/ossimNitfTileSource_12.cpp @@ -16,6 +16,10 @@ //#if defined(JPEG_DUAL_MODE_8_12) #include <fstream> +#if defined(JPEG_DUAL_MODE_8_12) +#undef JPEG_DUAL_MODE_8_12 +#endif + #if defined(JPEG_DUAL_MODE_8_12) #include <jpeg12/jpeglib.h>