diff --git a/CMake/CTestCustom.cmake.in b/CMake/CTestCustom.cmake.in index 1d3f118028b108d8669887eb8f51bba4297dd016..a17c59569e57688eae6bcf71bb68daaa4df42856 100644 --- a/CMake/CTestCustom.cmake.in +++ b/CMake/CTestCustom.cmake.in @@ -18,7 +18,7 @@ #---------------------------------------------------------------------- set(CTEST_CUSTOM_MAXIMUM_PASSED_TEST_OUTPUT_SIZE 1000000) -set(CTEST_CUSTOM_MAXIMUM_NUMBER_OF_WARNINGS 300) +set(CTEST_CUSTOM_MAXIMUM_NUMBER_OF_WARNINGS 2000) set(CTEST_CUSTOM_MAXIMUM_NUMBER_OF_ERRORS 50) @@ -45,7 +45,6 @@ set(CTEST_CUSTOM_COVERAGE_EXCLUDE set(CTEST_CUSTOM_WARNING_EXCEPTION ${CTEST_CUSTOM_WARNING_EXCEPTION} - "vcl_deprecated_header" "backward_warning" "warning LNK4221" "ranlib:.*file:.*has no symbols" @@ -64,6 +63,20 @@ set(CTEST_CUSTOM_WARNING_EXCEPTION # other warning expression: "[0-9,]+ warnings? generated." ".*include.opencv2.*warning.*" - ".*warning:.*deprecated.*" - ".*vcl_deprecated_header.*" + ".*include.kml.*warning.*" + ".*include.ogr_feature.*warning.*" + ".*itksys.SharedForward.h.*warning.*" + ".*vcl_deprecated_header.h.*" + ".*otbCurlHelper.cxx:356.*warning.*maxConnect.*" + ".*include.ITK-4.*[Ww]arning.*" + ".*include.curl.curl.h.*[Ww]arning.*" + ".*include.ossim.*[Ww]arning.*" + ".*include.ogr_core.h.*[Ww]arning.*" + ".*include.ogr_srs_api.h.*[Ww]arning.*" + ".*include.ogrsf_frmts.h.*[Ww]arning.*" + ".*include.ogr_geometry.h.*[Ww]arning.*" + ".*include.ogr_spatialref.h.*[Ww]arning.*" + ".*include.cpl_error.h.*[Ww]arning.*" + ".*vnl.vnl_numeric_traits.h.*[Ww]arning.*" + ".*vcl_config_compiler.h.*[Ww]arning.*" ) diff --git a/CMakeLists.txt b/CMakeLists.txt index c31d605bd28213d887e01e20bb954b5bdd8c0342..3a60016330edf4830410d1d93f1959c697102777 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -7,6 +7,7 @@ endif() foreach(p CMP0025 # CMake 3.0 CMP0042 # CMake 3.0 + CMP0058 ) if(POLICY ${p}) cmake_policy(SET ${p} NEW) @@ -65,7 +66,7 @@ set(main_project_name ${_OTBModuleMacros_DEFAULT_LABEL}) #----------------------------------------------------------------------------- # OTB version number. set(OTB_VERSION_MAJOR "5") -set(OTB_VERSION_MINOR "0") +set(OTB_VERSION_MINOR "2") set(OTB_VERSION_PATCH "0") set(OTB_VERSION_STRING "${OTB_VERSION_MAJOR}.${OTB_VERSION_MINOR}.${OTB_VERSION_PATCH}") diff --git a/Examples/Filtering/GeometriesChangeSpatialReference.cxx b/Examples/Filtering/GeometriesChangeSpatialReference.cxx index 3567ef88ff5eee80bef7f24872d7ef78984a6db3..46d869c51026508269dab32bd59ac16371010fa8 100644 --- a/Examples/Filtering/GeometriesChangeSpatialReference.cxx +++ b/Examples/Filtering/GeometriesChangeSpatialReference.cxx @@ -206,10 +206,10 @@ int main (int argc, char **argv) = options.workingInplace ? input : options.outputIsStdout ? 0 : otb::ogr::DataSource::New( options.outputFile, otb::ogr::DataSource::Modes::Update_LayerCreateOnly); - std::cout << "input: " << input -> ogr().GetName() << " should be: " << options.inputFile << "\n"; + std::cout << "input: " << otb::ogr::version_proxy::GetFileListAsStringVector(&input->ogr())[0] << " should be: " << options.inputFile << "\n"; if (output) { - std::cout << "output: " << output -> ogr().GetName() << " should be: " << options.outputFile << "\n"; + std::cout << "output: " << otb::ogr::version_proxy::GetFileListAsStringVector(&output->ogr())[0] << " should be: " << options.outputFile << "\n"; } // std::cout << "\n"; diff --git a/Examples/Filtering/GeometriesFilter.cxx b/Examples/Filtering/GeometriesFilter.cxx index 93d1b355ad394a182c2ce396cbda4b47958e596e..8150eceb979ff948ef7ea480913c0a887f387d94 100644 --- a/Examples/Filtering/GeometriesFilter.cxx +++ b/Examples/Filtering/GeometriesFilter.cxx @@ -73,10 +73,10 @@ int main (int argc, char **argv) = workingInplace ? input : outputIsStdout ? 0 : otb::ogr::DataSource::New( outputFile, otb::ogr::DataSource::Modes::Update_LayerCreateOnly); - std::cout << "input: " << input -> ogr().GetName() << " should be: " << inputFile << "\n"; + std::cout << "input: " << otb::ogr::version_proxy::GetFileListAsStringVector(&input->ogr())[0] << " should be: " << inputFile << "\n"; if (output) { - std::cout << "output: " << output -> ogr().GetName() << " should be: " << outputFile << "\n"; + std::cout << "output: " << otb::ogr::version_proxy::GetFileListAsStringVector(&output->ogr())[0] << " should be: " << outputFile << "\n"; } // std::cout << "\n"; diff --git a/Examples/Patented/SIFTDensityExample.cxx b/Examples/Patented/SIFTDensityExample.cxx index d5859f8793fcc72155bc973ccd8add0625e7c733..5c2044b46c7ba285ce26af012e23783075a6d76d 100644 --- a/Examples/Patented/SIFTDensityExample.cxx +++ b/Examples/Patented/SIFTDensityExample.cxx @@ -21,6 +21,7 @@ #include "otbImage.h" #include "otbImageFileReader.h" #include "otbImageFileWriter.h" +#include "itkUnaryFunctorImageFilter.h" #include "itkRescaleIntensityImageFilter.h" // Software Guide : BeginCommandLineArgs diff --git a/Modules/Adapters/GdalAdapters/include/otbOGRFieldWrapper.txx b/Modules/Adapters/GdalAdapters/include/otbOGRFieldWrapper.txx index 673ae0f9b29230a506a9ef0d9fac647da07807d8..d8e013a45e4a18f3b677a58ed6ae6fcfcd5abf90 100644 --- a/Modules/Adapters/GdalAdapters/include/otbOGRFieldWrapper.txx +++ b/Modules/Adapters/GdalAdapters/include/otbOGRFieldWrapper.txx @@ -23,6 +23,7 @@ /*===============================[ Includes ]================================*/ /*===========================================================================*/ #include "otbOGRFieldWrapper.h" +#include "otbConfigure.h" #include <cassert> #include <vector> #include <boost/mpl/map.hpp> @@ -84,6 +85,10 @@ typedef boost::mpl::map , pair<char* , int_<OFTString> > , pair<char const* , int_<OFTString> > , pair<std::vector<std::string>, int_<OFTStringList> > + #ifdef OTB_USE_GDAL_20 + , pair<GIntBig, int_<OFTInteger64> > + , pair<std::vector<GIntBig>, int_<OFTInteger64List> > + #endif // OFTBinary // OFTDate // OFTTime @@ -312,6 +317,10 @@ typedef map , pair<int_<OFTRealList>, MemberContainerGetterPtr<double, &OGRFeature::GetFieldAsDoubleList> > , pair<int_<OFTString>, MemberGetterPtr<char const*, &OGRFeature::GetFieldAsString, std::string> > , pair<int_<OFTStringList>, StringListMemberGetterPtr<std::vector<std::string> > > + #ifdef OTB_USE_GDAL_20 + , pair<int_<OFTInteger64>, MemberGetterPtr<GIntBig, &OGRFeature::GetFieldAsInteger64> > + , pair<int_<OFTInteger64List>, MemberContainerGetterPtr<GIntBig, &OGRFeature::GetFieldAsInteger64List> > + #endif > FieldGetters_Map; /**\ingroup GeometryInternals @@ -327,6 +336,10 @@ typedef map , pair<int_<OFTRealList>, MemberContainerSetterPtr<double, &OGRFeature::SetField> > , pair<int_<OFTString>, MemberSetterPtr<char const*, &OGRFeature::SetField/*, std::string*/> > , pair<int_<OFTStringList>, StringListMemberSetterPtr<std::vector<std::string> > > + #ifdef OTB_USE_GDAL_20 + , pair<int_<OFTInteger64>, MemberSetterPtr<GIntBig, &OGRFeature::SetField> > + , pair<int_<OFTInteger64List>, MemberContainerSetterPtr<const GIntBig, &OGRFeature::SetField> > + #endif > FieldSetters_Map; /**\ingroup GeometryInternals diff --git a/Modules/Adapters/GdalAdapters/include/otbOGRVersionProxy.h b/Modules/Adapters/GdalAdapters/include/otbOGRVersionProxy.h index 1c4ac63e4b685b3fddcfdb2fedba65f07e55523f..6db10d56d416078d3ce0b626ef51213a3f23d11f 100644 --- a/Modules/Adapters/GdalAdapters/include/otbOGRVersionProxy.h +++ b/Modules/Adapters/GdalAdapters/include/otbOGRVersionProxy.h @@ -126,6 +126,9 @@ namespace version_proxy */ GDALDriverType * GetDriverByName(const char * name); + + std::string GetDriverNameFromDataSource(const GDALDatasetType * ds); + /** * Sync dataset to disk. * diff --git a/Modules/Adapters/GdalAdapters/src/otbOGRVersionProxy1x.cxx b/Modules/Adapters/GdalAdapters/src/otbOGRVersionProxy1x.cxx index f92ee6e1dfd4a1e1784421369a867b56c76441c3..1645bfe1525101482ea2d35aaec0e33944e3cfec 100644 --- a/Modules/Adapters/GdalAdapters/src/otbOGRVersionProxy1x.cxx +++ b/Modules/Adapters/GdalAdapters/src/otbOGRVersionProxy1x.cxx @@ -119,6 +119,11 @@ std::vector<std::string> GetAvailableDriversAsStringVector() return ret; } +std::string GetDriverNameFromDataSource(const GDALDatasetType * ds) +{ + return std::string(const_cast<GDALDatasetType *>(ds)->GetDriver()->GetName()); +} + } } } // end namespace diff --git a/Modules/Adapters/GdalAdapters/src/otbOGRVersionProxy2x.cxx b/Modules/Adapters/GdalAdapters/src/otbOGRVersionProxy2x.cxx index 725486f4b74758e60b880cf8d38906dff85a9ead..ebd3ecb8bd7f4eb831ce2c3224c0400aae5b013c 100644 --- a/Modules/Adapters/GdalAdapters/src/otbOGRVersionProxy2x.cxx +++ b/Modules/Adapters/GdalAdapters/src/otbOGRVersionProxy2x.cxx @@ -152,6 +152,11 @@ std::vector<std::string> GetAvailableDriversAsStringVector() return ret; } +std::string GetDriverNameFromDataSource(const GDALDatasetType * ds) +{ + return std::string(const_cast<GDALDatasetType *>(ds)->GetDriverName()); +} + } } } // end namespace diff --git a/Modules/Applications/AppClassification/app/otbClassificationMapRegularization.cxx b/Modules/Applications/AppClassification/app/otbClassificationMapRegularization.cxx index 1ecd2c9dc33a3f2b2c31c445884462ccc2e192ef..4e000cd1846aead2530f52dd9107aefe09f37c75 100644 --- a/Modules/Applications/AppClassification/app/otbClassificationMapRegularization.cxx +++ b/Modules/Applications/AppClassification/app/otbClassificationMapRegularization.cxx @@ -78,7 +78,7 @@ private: AddParameter(ParameterType_OutputImage, "io.out", "Output regularized image"); SetParameterDescription( "io.out", "The output regularized labeled image."); - SetParameterOutputImagePixelType( "io.out", ImagePixelType_uint8); + SetDefaultOutputPixelType( "io.out", ImagePixelType_uint8); AddParameter(ParameterType_Group,"ip","Regularization parameters"); diff --git a/Modules/Applications/AppClassification/app/otbFusionOfClassifications.cxx b/Modules/Applications/AppClassification/app/otbFusionOfClassifications.cxx index 848d41b4717055c22ca02edaaf290d9376378c95..f518994ab7d9ab3f99771e14911cd2264c411e7e 100644 --- a/Modules/Applications/AppClassification/app/otbFusionOfClassifications.cxx +++ b/Modules/Applications/AppClassification/app/otbFusionOfClassifications.cxx @@ -156,6 +156,7 @@ private: AddParameter(ParameterType_OutputImage,"out","The output classification image"); SetParameterDescription("out","The output classification image resulting from the fusion of the input classification images."); + SetDefaultOutputPixelType("out",ImagePixelType_uint8); // Doc example parameter settings SetDocExampleParameterValue("il", "classification1.tif classification2.tif classification3.tif"); diff --git a/Modules/Applications/AppClassification/app/otbImageClassifier.cxx b/Modules/Applications/AppClassification/app/otbImageClassifier.cxx index 8cd4c5b030159f38a69b20e571dae27e149a5e2c..a47a006c2acd93642036f558be763c70ba57f119 100644 --- a/Modules/Applications/AppClassification/app/otbImageClassifier.cxx +++ b/Modules/Applications/AppClassification/app/otbImageClassifier.cxx @@ -93,7 +93,7 @@ private: AddParameter(ParameterType_OutputImage, "out", "Output Image"); SetParameterDescription( "out", "Output image containing class labels"); - SetParameterOutputImagePixelType( "out", ImagePixelType_uint8); + SetDefaultOutputPixelType( "out", ImagePixelType_uint8); AddParameter(ParameterType_OutputImage, "confmap", "Confidence map"); SetParameterDescription( "confmap", "Confidence map of the produced classification. The confidence index depends on the model : \n" @@ -107,7 +107,7 @@ private: " * NormalBayes : (not supported)\n" " * RandomForest : proportion of decision trees that classified the sample to the second class (only works for 2-class models)\n" " * SVM : distance to margin (only works for 2-class models)\n"); - SetParameterOutputImagePixelType( "confmap", ImagePixelType_double); + SetDefaultOutputPixelType( "confmap", ImagePixelType_double); MandatoryOff("confmap"); AddRAMParameter(); diff --git a/Modules/Applications/AppClassification/app/otbKMeansClassification.cxx b/Modules/Applications/AppClassification/app/otbKMeansClassification.cxx index 4844205f396898578117369175fc524e8ffc5720..c7ba58f19968d4d9748911396a276cb7465350c1 100644 --- a/Modules/Applications/AppClassification/app/otbKMeansClassification.cxx +++ b/Modules/Applications/AppClassification/app/otbKMeansClassification.cxx @@ -181,6 +181,7 @@ private: SetParameterDescription("in", "Input image to classify."); AddParameter(ParameterType_OutputImage, "out", "Output Image"); SetParameterDescription("out", "Output image containing the class indexes."); + SetDefaultOutputPixelType("out",ImagePixelType_uint8); AddRAMParameter(); diff --git a/Modules/Applications/AppClassification/app/otbSOMClassification.cxx b/Modules/Applications/AppClassification/app/otbSOMClassification.cxx index 9d9dd9445116d4fa057a9830bf77dfc3fec94b36..5e3daf1e62e1259f2c5fa5cf9ab32c17a0a3762c 100644 --- a/Modules/Applications/AppClassification/app/otbSOMClassification.cxx +++ b/Modules/Applications/AppClassification/app/otbSOMClassification.cxx @@ -87,6 +87,7 @@ private: AddParameter(ParameterType_OutputImage, "out", "OutputImage"); SetParameterDescription("out", "Output classified image (each pixel contains the index of its corresponding vector in the SOM)."); + SetDefaultOutputPixelType("out",ImagePixelType_uint8); AddParameter(ParameterType_InputImage, "vm", "ValidityMask"); SetParameterDescription("vm", "Validity mask (only pixels corresponding to a mask value greater than 0 will be used for learning)"); diff --git a/Modules/Applications/AppImageUtils/app/otbColorMapping.cxx b/Modules/Applications/AppImageUtils/app/otbColorMapping.cxx index c20d69aa6443084f1eb9bc0adeabdba6c9829bc4..432ba754b1f631c6db9dec31c70e135185fa816c 100644 --- a/Modules/Applications/AppImageUtils/app/otbColorMapping.cxx +++ b/Modules/Applications/AppImageUtils/app/otbColorMapping.cxx @@ -291,6 +291,7 @@ private: SetParameterDescription("in", "Input image filename"); AddParameter(ParameterType_OutputImage, "out", "Output Image"); SetParameterDescription("out","Output image filename"); + SetDefaultOutputPixelType("out",ImagePixelType_uint8); AddRAMParameter(); diff --git a/Modules/Applications/AppSegmentation/app/otbHooverCompareSegmentation.cxx b/Modules/Applications/AppSegmentation/app/otbHooverCompareSegmentation.cxx index 9b52f3b608a7e280bfa195f29a0272d4bc8de690..74423df47757fbc95af9beaa887723395dcd3eb1 100644 --- a/Modules/Applications/AppSegmentation/app/otbHooverCompareSegmentation.cxx +++ b/Modules/Applications/AppSegmentation/app/otbHooverCompareSegmentation.cxx @@ -165,10 +165,12 @@ private: AddParameter(ParameterType_OutputImage, "outgt", "Colored ground truth output"); SetParameterDescription( "outgt", "The colored ground truth output image." ); + SetDefaultOutputPixelType("outgt",ImagePixelType_uint8); MandatoryOff("outgt"); AddParameter(ParameterType_OutputImage, "outms", "Colored machine segmentation output"); SetParameterDescription( "outms", "The colored machine segmentation output image." ); + SetDefaultOutputPixelType("outms",ImagePixelType_uint8); MandatoryOff("outms"); // TODO : add color settings ? diff --git a/Modules/Applications/AppSegmentation/app/otbLSMSSegmentation.cxx b/Modules/Applications/AppSegmentation/app/otbLSMSSegmentation.cxx index 1af6e23b928e7d6956214d36840192588a802a80..bafff60e4c5ee3b25bf634df199899bd5717a5b2 100644 --- a/Modules/Applications/AppSegmentation/app/otbLSMSSegmentation.cxx +++ b/Modules/Applications/AppSegmentation/app/otbLSMSSegmentation.cxx @@ -225,6 +225,7 @@ private: AddParameter(ParameterType_OutputImage, "out", "Output Image"); SetParameterDescription( "out", "The output image. The output image is the segmentation of the filtered image. It is recommended to set the pixel type to uint32." ); + SetDefaultOutputPixelType("out",ImagePixelType_uint32); AddParameter(ParameterType_Float, "ranger", "Range radius"); SetParameterDescription("ranger", "Range radius defining the radius (expressed in radiometry unit) in the multi-spectral space."); diff --git a/Modules/Applications/AppSegmentation/app/otbLSMSSmallRegionsMerging.cxx b/Modules/Applications/AppSegmentation/app/otbLSMSSmallRegionsMerging.cxx index 9ea8f9013aaad2e06d2cc0cf3821f76117836fbf..c2122b50ba7f088baeaa6f5a33f5165113ec840b 100644 --- a/Modules/Applications/AppSegmentation/app/otbLSMSSmallRegionsMerging.cxx +++ b/Modules/Applications/AppSegmentation/app/otbLSMSSmallRegionsMerging.cxx @@ -90,6 +90,7 @@ private: AddParameter(ParameterType_OutputImage, "out", "Output Image"); SetParameterDescription( "out", "The output image. The output image is the input image where the minimal regions have been merged." ); + SetDefaultOutputPixelType("out",ImagePixelType_uint32); AddParameter(ParameterType_Int, "minsize", "Minimum Region Size"); SetParameterDescription("minsize", "Minimum Region Size. If, after the segmentation, a region is of size lower than this criterion, the region is merged with the \"nearest\" region (radiometrically)."); diff --git a/Modules/Applications/AppSegmentation/app/otbSegmentation.cxx b/Modules/Applications/AppSegmentation/app/otbSegmentation.cxx index 8015f13648a5a337870a91b3f22f6f47cdcfd6f4..00515af1a604742dd12b5a9d2c8cdb7ee0c23759 100644 --- a/Modules/Applications/AppSegmentation/app/otbSegmentation.cxx +++ b/Modules/Applications/AppSegmentation/app/otbSegmentation.cxx @@ -251,6 +251,7 @@ private: //Raster mode parameters AddParameter(ParameterType_OutputImage, "mode.raster.out", "Output labeled image"); SetParameterDescription( "mode.raster.out", "The output labeled image."); + SetDefaultOutputPixelType("mode.raster.out",ImagePixelType_uint32); //Streaming vectorization parameters AddParameter(ParameterType_OutputFilename, "mode.vector.out", "Output vector file"); @@ -676,7 +677,7 @@ private: //Note : the GetDriver() Method has not been encapsulated in otb::ogr::DataSource, //so we must access the OGR pointer by using .ogr() - std::string driverName(ogrDS->ogr().GetDriver()->GetName()); + std::string driverName(otb::ogr::version_proxy::GetDriverNameFromDataSource(&ogrDS->ogr())); if ( driverName.find("ESRI Shapefile") != std::string::npos) { otbAppLogINFO(<<"REPACK the Shapefile ..."<<std::endl); diff --git a/Modules/Applications/AppStereo/app/otbBlockMatching.cxx b/Modules/Applications/AppStereo/app/otbBlockMatching.cxx index 51fcada2b68dad2b797b2d02f10e4edae4980dfa..246fef0cb03dbfa17fad764caa079acabee87a80 100644 --- a/Modules/Applications/AppStereo/app/otbBlockMatching.cxx +++ b/Modules/Applications/AppStereo/app/otbBlockMatching.cxx @@ -155,6 +155,7 @@ private: AddParameter(ParameterType_OutputImage, "io.outmask", "The output mask corresponding to all criterions"); SetParameterDescription("io.outmask","A mask image corresponding to all citerions (see masking parameters). Only required if variance threshold or nodata criterions are set."); + SetDefaultOutputPixelType("io.outmask",ImagePixelType_uint8); DisableParameter("io.outmask"); MandatoryOff("io.outmask"); diff --git a/Modules/Core/Common/otb-module.cmake b/Modules/Core/Common/otb-module.cmake index cefb91fd23aa430d897c6a9f80d37a35ca697cd7..7501fbd86ed582fbd0a201181588071672d0d270 100644 --- a/Modules/Core/Common/otb-module.cmake +++ b/Modules/Core/Common/otb-module.cmake @@ -4,6 +4,8 @@ otb_module(OTBCommon DEPENDS OTBBoost OTBITK + #Add dependency to OTBGDAL as GDAL module need to set OTB_USE_GDAL_20 before configuring otbConfigure.h + OTBGDAL TEST_DEPENDS OTBImageBase diff --git a/Modules/Core/VectorDataBase/src/otbVectorDataKeywordlist.cxx b/Modules/Core/VectorDataBase/src/otbVectorDataKeywordlist.cxx index 9b5463d604ad411ba07a2c4dfc6804b91e07d2fc..90737a9d85b63de77b119a7d9a1e2685f6367e78 100644 --- a/Modules/Core/VectorDataBase/src/otbVectorDataKeywordlist.cxx +++ b/Modules/Core/VectorDataBase/src/otbVectorDataKeywordlist.cxx @@ -21,6 +21,7 @@ #include "otbVectorDataKeywordlist.h" #include "otbConfigure.h" +#include "itkNumericTraits.h" namespace otb { diff --git a/Modules/Filtering/Smoothing/include/otbMeanShiftSmoothingImageFilter.txx b/Modules/Filtering/Smoothing/include/otbMeanShiftSmoothingImageFilter.txx index 88c61d557ceb568d8b3c7f9f214570e0579ed7fd..55d75bbd649d416a34089b44b1c529d4866f8444 100644 --- a/Modules/Filtering/Smoothing/include/otbMeanShiftSmoothingImageFilter.txx +++ b/Modules/Filtering/Smoothing/include/otbMeanShiftSmoothingImageFilter.txx @@ -375,7 +375,7 @@ void MeanShiftSmoothingImageFilter<TInputImage, TOutputImage, TKernel, TOutputIt neighborhoodRegion.SetSize(regionSize); RealType weightSum = 0; - RealVector jointNeighbor(ImageDimension + m_NumberOfComponentsPerPixel), shifts(ImageDimension + m_NumberOfComponentsPerPixel); + RealVector shifts(jointDimension); // An iterator on the neighborhood of the current pixel (in joint // spatial-range domain) @@ -385,7 +385,7 @@ void MeanShiftSmoothingImageFilter<TInputImage, TOutputImage, TKernel, TOutputIt it.GoToBegin(); while (!it.IsAtEnd()) { - jointNeighbor = it.Get(); + const RealType *jointNeighbor = it.GetPixelPointer(); // Compute the squared norm of the difference // This is the L2 norm, TODO: replace by the templated norm @@ -393,7 +393,7 @@ void MeanShiftSmoothingImageFilter<TInputImage, TOutputImage, TKernel, TOutputIt for (unsigned int comp = 0; comp < jointDimension; comp++) { shifts[comp] = jointNeighbor[comp] - jointPixel[comp]; - double d = shifts[comp]/bandwidth[comp]; + double d = shifts[comp] / bandwidth[comp]; norm2 += d*d; } @@ -554,7 +554,7 @@ void MeanShiftSmoothingImageFilter<TInputImage, TOutputImage, TKernel, TOutputIt typename OutputImageType::PixelType rangePixel(m_NumberOfComponentsPerPixel); typename OutputSpatialImageType::PixelType spatialPixel(ImageDimension); - RealVector jointPixel; + RealVector jointPixel(jointDimension); RealVector bandwidth(jointDimension); for (unsigned int comp = 0; comp < ImageDimension; comp++) @@ -612,7 +612,9 @@ void MeanShiftSmoothingImageFilter<TInputImage, TOutputImage, TKernel, TOutputIt // get input pixel in the joint spatial-range domain (with components // normalized by bandwith) - jointPixel = jointIt.Get(); // Pixel in the joint spatial-range domain + const RealVector &jointPixelVal = jointIt.Get(); // Pixel in the joint spatial-range domain + for (unsigned int comp = 0; comp < jointDimension; comp++) + jointPixel[comp] = jointPixelVal[comp]; for (unsigned int comp = ImageDimension; comp < jointDimension; comp++) bandwidth[comp] = m_RangeBandwidthRamp*jointPixel[comp]+m_RangeBandwidth; diff --git a/Modules/IO/TestKernel/src/otbTestHelper.cxx b/Modules/IO/TestKernel/src/otbTestHelper.cxx index bf7996740b24b70b0bf6475636da3616b7f02dd3..15d922c0441fa7d6aa86977418341a62561b707c 100644 --- a/Modules/IO/TestKernel/src/otbTestHelper.cxx +++ b/Modules/IO/TestKernel/src/otbTestHelper.cxx @@ -1092,7 +1092,7 @@ int TestHelper::RegressionTestOgrFile(const char *testOgrFilename, const char *b test_poDS = otb::ogr::version_proxy::Open(ref_pszDataSource, bReadOnly); bReadOnly = TRUE; - + if (test_poDS != NULL && m_ReportErrors) { std::cout << "Had to open TEST data source read-only."<<std::endl; @@ -1103,13 +1103,13 @@ int TestHelper::RegressionTestOgrFile(const char *testOgrFilename, const char *b /* -------------------------------------------------------------------- */ if (ref_poDS == NULL) { - + if (m_ReportErrors) { std::cout << "FAILURE:\n" "Unable to open REF datasource `" << ref_pszDataSource << "' with the following drivers." << std::endl; std::vector<std::string> drivers = ogr::version_proxy::GetAvailableDriversAsStringVector(); - + for (std::vector<std::string>::const_iterator it = drivers.begin();it!=drivers.end();++it) { std::cout << " -> " << *it << std::endl; @@ -1127,7 +1127,7 @@ int TestHelper::RegressionTestOgrFile(const char *testOgrFilename, const char *b std::cout << "FAILURE:\n""Unable to open TEST datasource `" << test_pszDataSource << "' with the following drivers." << std::endl; std::vector<std::string> drivers = ogr::version_proxy::GetAvailableDriversAsStringVector(); - + for (std::vector<std::string>::const_iterator it = drivers.begin();it!=drivers.end();++it) { std::cout << " -> " << *it << std::endl; @@ -1165,7 +1165,7 @@ int TestHelper::RegressionTestOgrFile(const char *testOgrFilename, const char *b } ++fileId; } - + /* -------------------------------------------------------------------- */ /* Process each data source layer. */ /* -------------------------------------------------------------------- */ @@ -1269,7 +1269,7 @@ void TestHelper::DumpOGRFeature(FILE* fpOut, OGRFeature* feature, char** papszOp return; } - fprintf(fpOut, "OGRFeature:%lld\n", feature->GetFID()); + fprintf(fpOut, "OGRFeature:%ld\n", feature->GetFID()); const char* pszDisplayFields = CSLFetchNameValue(papszOptions, "DISPLAY_FIELDS"); diff --git a/Modules/Segmentation/OGRProcessing/include/otbOGRLayerStreamStitchingFilter.txx b/Modules/Segmentation/OGRProcessing/include/otbOGRLayerStreamStitchingFilter.txx index b9ff29546786bdb4ca4524372d9e9370e8be0421..2e3e56f9e399ab5a38ace84471207d347f7a9967 100644 --- a/Modules/Segmentation/OGRProcessing/include/otbOGRLayerStreamStitchingFilter.txx +++ b/Modules/Segmentation/OGRProcessing/include/otbOGRLayerStreamStitchingFilter.txx @@ -317,7 +317,11 @@ OGRLayerStreamStitchingFilter<TInputImage> ogr::Field field = upper.feat[0]; try { + #ifdef OTB_USE_GDAL_20 + fusionFeature[0].SetValue(field.GetValue<GIntBig>()); + #else fusionFeature[0].SetValue(field.GetValue<int>()); + #endif m_OGRLayer.CreateFeature(fusionFeature); m_OGRLayer.DeleteFeature(lower.feat.GetFID()); m_OGRLayer.DeleteFeature(upper.feat.GetFID()); diff --git a/Modules/ThirdParty/GDAL/CMakeLists.txt b/Modules/ThirdParty/GDAL/CMakeLists.txt index 940d1565a89cab414df2d208743f6d7e041b4f32..cd42ac614f9086a506dbf5da6de3d9b5ad7f685c 100644 --- a/Modules/ThirdParty/GDAL/CMakeLists.txt +++ b/Modules/ThirdParty/GDAL/CMakeLists.txt @@ -3,7 +3,4 @@ project(OTBGDAL) set(OTBGDAL_SYSTEM_INCLUDE_DIRS ${GDAL_INCLUDE_DIRS}) set(OTBGDAL_LIBRARIES "${GDAL_LIBRARIES}") -set(GDAL_CONFIG_CHECKING ON CACHE BOOL "Tests to check gdal config." FORCE) -mark_as_advanced(GDAL_CONFIG_CHECKING) - otb_module_impl() diff --git a/Modules/ThirdParty/GDAL/otb-module-init.cmake b/Modules/ThirdParty/GDAL/otb-module-init.cmake index 74e86291e8f3c1e468b4d740a83eb3a129a2d218..3d2ae5a52bf54197c3bf8c18490dcbc7c2fe6625 100644 --- a/Modules/ThirdParty/GDAL/otb-module-init.cmake +++ b/Modules/ThirdParty/GDAL/otb-module-init.cmake @@ -8,6 +8,10 @@ if(NOT GDAL_FOUND) message(FATAL_ERROR "Cannot find GDAL. Set GDAL_INCLUDE_DIR and GDAL_LIBRARY") endif() +#Allow to deactivate GDAL checking (done by default) +set(GDAL_CONFIG_CHECKING ON CACHE BOOL "Tests to check gdal config." FORCE) +mark_as_advanced(GDAL_CONFIG_CHECKING) + if(GDAL_CONFIG_CHECKING) set(MIN_MAJOR_VERSION 1) set(MIN_MINOR_VERSION 10) @@ -89,7 +93,7 @@ if(GDAL_CONFIG_CHECKING) file(READ "${TEMP}/gdalVersion.txt" DETECTED_VERSION) string(SUBSTRING ${DETECTED_VERSION} 0 2 VER2) if(${VER2} EQUAL "2.") - message("-- Gdal >= 2.0.0 detected") + message(STATUS "Gdal >= 2.0.0 detected") set(OTB_USE_GDAL_20 true CACHE INTERNAL "True if GDAL >= 2.0.0 has been detected" FORCE ) else(${VER2} EQUAL "2.") set(OTB_USE_GDAL_20 false CACHE INTERNAL "True if GDAL >= 2.0.0 has been detected" FORCE ) diff --git a/Modules/Wrappers/ApplicationEngine/include/otbWrapperApplication.h b/Modules/Wrappers/ApplicationEngine/include/otbWrapperApplication.h index 9c83a78636b2390122104cb841870a8b87492c66..955a76b4359918001c2a1a4fa58bd68147a37c71 100644 --- a/Modules/Wrappers/ApplicationEngine/include/otbWrapperApplication.h +++ b/Modules/Wrappers/ApplicationEngine/include/otbWrapperApplication.h @@ -247,6 +247,20 @@ public: */ void SetDefaultParameterFloat(std::string parameter, float value); + /** Set a default pixel type for an output image parameter + * + * \param[in] parameter Name of the output image parameter + * \param[in] type Default pixel type + */ + void SetDefaultOutputPixelType(std::string parameter, ImagePixelType type); + + /** Set a default complex pixel type for an output complex image parameter + * + * \param[in] parameter Name of the output complex image parameter + * \param[in] type Default complex pixel type + */ + void SetDefaultOutputComplexPixelType(std::string parameter, ComplexImagePixelType type); + /* Set a minimum int value, must used in the * DoInit when setting a value by default * for the parameter diff --git a/Modules/Wrappers/ApplicationEngine/include/otbWrapperComplexOutputImageParameter.h b/Modules/Wrappers/ApplicationEngine/include/otbWrapperComplexOutputImageParameter.h index 6500d54621d307f5f9a18db2d7e5e58d5617a413..5edf833fba0223b968eb6e8170199453c066996b 100644 --- a/Modules/Wrappers/ApplicationEngine/include/otbWrapperComplexOutputImageParameter.h +++ b/Modules/Wrappers/ApplicationEngine/include/otbWrapperComplexOutputImageParameter.h @@ -61,14 +61,27 @@ public: /** Return any value */ ImageBaseType* GetValue( void ); - /** Set/Get PixelType to be used when saving */ + /** Set/Get m_ComplexPixelType to be used when saving */ itkSetMacro(ComplexPixelType, ComplexImagePixelType); itkGetMacro(ComplexPixelType, ComplexImagePixelType); + /** Set/Get m_DefaultComplexPixelType*/ + itkSetMacro(DefaultComplexPixelType, ComplexImagePixelType); + itkGetMacro(DefaultComplexPixelType, ComplexImagePixelType); + /** Set/Get available RAM value */ itkSetMacro(RAMValue, unsigned int); itkGetMacro(RAMValue, unsigned int); + /** Implement the reset method (replace pixel type by default type) */ + virtual void Reset() + { + m_ComplexPixelType = m_DefaultComplexPixelType; + } + + /** Static method to convert pixel type into string */ + static std::string ConvertPixelTypeToString(ComplexImagePixelType type); + /** Return true if a filename is set */ bool HasValue() const; @@ -106,7 +119,7 @@ protected: ImageBaseType::Pointer m_Image; std::string m_FileName; ComplexImagePixelType m_ComplexPixelType; - + ComplexImagePixelType m_DefaultComplexPixelType; typedef otb::ImageFileWriter<ComplexFloatImageType> ComplexFloatWriterType; typedef otb::ImageFileWriter<ComplexDoubleImageType> ComplexDoubleWriterType; diff --git a/Modules/Wrappers/ApplicationEngine/include/otbWrapperOutputImageParameter.h b/Modules/Wrappers/ApplicationEngine/include/otbWrapperOutputImageParameter.h index a8dc212a7c314f05c640be02591a015b4b0eff45..3313e5a8d201cc230bc33d2b11fd533d9a0f8f32 100644 --- a/Modules/Wrappers/ApplicationEngine/include/otbWrapperOutputImageParameter.h +++ b/Modules/Wrappers/ApplicationEngine/include/otbWrapperOutputImageParameter.h @@ -66,10 +66,23 @@ public: itkSetMacro(PixelType, ImagePixelType); itkGetMacro(PixelType, ImagePixelType); + /** Set/Get DefaultPixelType */ + itkSetMacro(DefaultPixelType, ImagePixelType); + itkGetMacro(DefaultPixelType, ImagePixelType); + /** Set/Get available RAM value */ itkSetMacro(RAMValue, unsigned int); itkGetMacro(RAMValue, unsigned int); + /** Implement the reset method (replace pixel type by default type) */ + virtual void Reset() + { + m_PixelType = m_DefaultPixelType; + } + + /** Static method to convert pixel type into string */ + static std::string ConvertPixelTypeToString(ImagePixelType type); + /** Return true if a filename is set */ bool HasValue() const; @@ -113,6 +126,7 @@ protected: ImageBaseType::Pointer m_Image; std::string m_FileName; ImagePixelType m_PixelType; + ImagePixelType m_DefaultPixelType; typedef otb::ImageFileWriter<UInt8ImageType> UInt8WriterType; typedef otb::ImageFileWriter<Int16ImageType> Int16WriterType; diff --git a/Modules/Wrappers/ApplicationEngine/src/otbWrapperApplication.cxx b/Modules/Wrappers/ApplicationEngine/src/otbWrapperApplication.cxx index 8176e2f7ff99e11544d58e04538a2ecd1ff6a6f0..2612a7cb97f475038c835f2b678e4fcefe6508b0 100644 --- a/Modules/Wrappers/ApplicationEngine/src/otbWrapperApplication.cxx +++ b/Modules/Wrappers/ApplicationEngine/src/otbWrapperApplication.cxx @@ -657,6 +657,29 @@ void Application::SetDefaultParameterFloat(std::string parameter, float value) } } +void Application::SetDefaultOutputPixelType(std::string parameter, ImagePixelType type) +{ + Parameter* param = GetParameterByKey(parameter); + OutputImageParameter* paramDown = dynamic_cast<OutputImageParameter*>(param); + if (paramDown) + { + paramDown->SetDefaultPixelType(type); + paramDown->SetPixelType(type); + } +} + +void +Application::SetDefaultOutputComplexPixelType(std::string parameter, ComplexImagePixelType type) +{ + Parameter* param = GetParameterByKey(parameter); + ComplexOutputImageParameter* paramDown = dynamic_cast<ComplexOutputImageParameter*>(param); + if (paramDown) + { + paramDown->SetDefaultComplexPixelType(type); + paramDown->SetComplexPixelType(type); + } +} + void Application::SetMinimumParameterIntValue(std::string parameter, int value) { Parameter* param = GetParameterByKey(parameter); diff --git a/Modules/Wrappers/ApplicationEngine/src/otbWrapperComplexOutputImageParameter.cxx b/Modules/Wrappers/ApplicationEngine/src/otbWrapperComplexOutputImageParameter.cxx index e87df1353be23dbf39cf9aef5df092132b84f94c..d4f157e02eb55f5f230e8edfe2bd622ae5801937 100644 --- a/Modules/Wrappers/ApplicationEngine/src/otbWrapperComplexOutputImageParameter.cxx +++ b/Modules/Wrappers/ApplicationEngine/src/otbWrapperComplexOutputImageParameter.cxx @@ -26,7 +26,9 @@ namespace Wrapper { ComplexOutputImageParameter::ComplexOutputImageParameter() - : m_ComplexPixelType(ComplexImagePixelType_float), m_RAMValue(0) + : m_ComplexPixelType(ComplexImagePixelType_float), + m_DefaultComplexPixelType(ComplexImagePixelType_float), + m_RAMValue(0) { this->SetName("Complex Output Image"); this->SetKey("cout"); @@ -36,6 +38,26 @@ ComplexOutputImageParameter::~ComplexOutputImageParameter() { } +std::string +ComplexOutputImageParameter::ConvertPixelTypeToString(ComplexImagePixelType type) +{ + std::string ret; + switch(type) + { + case ComplexImagePixelType_float: + { + ret = "cfloat"; + break; + } + case ComplexImagePixelType_double: + { + ret = "cdouble"; + break; + } + } + return ret; +} + void ComplexOutputImageParameter::InitializeWriters() { m_ComplexFloatWriter = ComplexFloatWriterType::New(); diff --git a/Modules/Wrappers/ApplicationEngine/src/otbWrapperOutputImageParameter.cxx b/Modules/Wrappers/ApplicationEngine/src/otbWrapperOutputImageParameter.cxx index 47498fa83474a3d4095ba163854c517c5c3ae17e..ec02594f477975de87349a3276a0e9c162e40d72 100644 --- a/Modules/Wrappers/ApplicationEngine/src/otbWrapperOutputImageParameter.cxx +++ b/Modules/Wrappers/ApplicationEngine/src/otbWrapperOutputImageParameter.cxx @@ -25,7 +25,9 @@ namespace Wrapper { OutputImageParameter::OutputImageParameter() - : m_PixelType(ImagePixelType_float), m_RAMValue(0) + : m_PixelType(ImagePixelType_float), + m_DefaultPixelType(ImagePixelType_float), + m_RAMValue(0) { this->SetName("Output Image"); this->SetKey("out"); @@ -36,6 +38,50 @@ OutputImageParameter::~OutputImageParameter() { } +std::string OutputImageParameter::ConvertPixelTypeToString(ImagePixelType type) +{ + std::string ret; + switch(type) + { + case ImagePixelType_uint8: + { + ret = "uint8"; + break; + } + case ImagePixelType_int16: + { + ret = "int16"; + break; + } + case ImagePixelType_uint16: + { + ret = "uint16"; + break; + } + case ImagePixelType_int32: + { + ret = "int32"; + break; + } + case ImagePixelType_uint32: + { + ret = "uint32"; + break; + } + case ImagePixelType_float: + { + ret = "float"; + break; + } + case ImagePixelType_double: + { + ret = "double"; + break; + } + } + return ret; +} + void OutputImageParameter::InitializeWriters() { m_UInt8Writer = UInt8WriterType::New(); diff --git a/Modules/Wrappers/CommandLine/src/otbWrapperCommandLineLauncher.cxx b/Modules/Wrappers/CommandLine/src/otbWrapperCommandLineLauncher.cxx index c3cd479b1791c7fdd14906dcffd7166f6b6d91b1..84a9112dbf2d24b454b5da29ec1343bcd57ff56d 100644 --- a/Modules/Wrappers/CommandLine/src/otbWrapperCommandLineLauncher.cxx +++ b/Modules/Wrappers/CommandLine/src/otbWrapperCommandLineLauncher.cxx @@ -844,14 +844,26 @@ std::string CommandLineLauncher::DisplayParameterHelp(const Parameter::Pointer & if (type == ParameterType_OutputImage) { + OutputImageParameter* paramDown = dynamic_cast<OutputImageParameter*>(param.GetPointer()); + std::string defPixType("float"); + if (paramDown) + { + defPixType = OutputImageParameter::ConvertPixelTypeToString(paramDown->GetDefaultPixelType()); + } oss << " [pixel=uint8/uint16/int16/uint32/int32/float/double]"; - oss << " (default value is float)"; + oss << " (default value is " << defPixType <<")"; } if (type == ParameterType_ComplexOutputImage) { + ComplexOutputImageParameter* paramDown = dynamic_cast<ComplexOutputImageParameter*>(param.GetPointer()); + std::string defPixType("cfloat"); + if (paramDown) + { + defPixType = ComplexOutputImageParameter::ConvertPixelTypeToString(paramDown->GetDefaultComplexPixelType()); + } oss << " [pixel=cfloat/cdouble]"; - oss << " (default value is cfloat)"; + oss << " (default value is "<< defPixType <<")"; } diff --git a/RELEASE_NOTES.txt b/RELEASE_NOTES.txt index 6ff98a0d7f7086473cf843eaab75228736997241..4a3f8a88bb7bf34d45fd25764bfc9f27e5d6e8d3 100644 --- a/RELEASE_NOTES.txt +++ b/RELEASE_NOTES.txt @@ -1,3 +1,63 @@ +OTB-v.5.2.0 - Changes since version 5.0.0 (2015/11/02) +------------------------------------------ +* Library (the corresponding requests for changes are mentioned): + + * Core + * Read, write and manage no-data flags (RFC-1 & RFC-14) + * Improve otb::DEMHandler interface (RFC-2) + * Build examples based on available modules in OTB installation (RFC-3) + * Helper functions for string operations using boost (RFC-6) + * Gdal 2.0 support (RFC-11) + * Enhancement of python wrapping (RFC-12) + + * Machine Learning + * Provide quality index for classification + * Regression mode in OTB and OTBApp (RFC-7) + + * SAR + * Add basic support for Sentinel1 Product (RFC-4) + * Update SAR radiometric calibration application in OTB (RFC-9) + * New applications for SAR processing (RFC-10) + + * Applications + * Improve ApplicationRegistry for application loading (RFC-15) + * Provide a default output pixel type in applications (RFC-17) + + * SuperBuild + * Provide a script to build the all-in-one SuperBuild archive (RFC-5) + * New dependency : Freetype 2.6 + * ITK 4.7.1 -> 4.8 + * JPEG v9a -> turbo 1.4.1 + * OpenThreads 3.2 -> 3.4 + * Ossim r23092 -> r23537 + +* Bug fixed: + + * Monteverdi2 + * 0001072: I18nCoreApplication::ElevationSetup() exceptions not displayed + * 0001070: otb::DEMHandler not updated properly when resetting DEM-directory and/or Geoid-file. + + * OTB-Packaging + * 0001049: Last Monteverdi2 and Mapla release Win package crash when we try to import JP2 file + + * Orfeo Toolbox (OTB) + * 0001084: Deactivate all 3rd part components in OpenCV configuration + * 0001081: GDAL RPC tags export prevent correct export of wkt in ortho-rectified image + * 0001077: Superbuild: Broken open scene graph archive link + * 0001069: Unable to install gdal python bindings in custom install directory with OTB Superbuild + * 0001065: Buiild OTB Examples based on available modules in OTB installation + * 0001075: prTeEstimateRPCSensorModelExampleTest always failing in examples + * 0001074: Missing ITCopyright.txt in OTB sources + * 0001066: missing file(Capitole-Shadows) from OTB-Data + * 0001055: SuperBuild builds ogr2ogr without sqlite driver + + * OTB-lib + * 0001085: Add a ::GetInput() accessor to QtWidgetOutputImage/FilenameParameter + * 0001083: Extended filename parameters not updated when calling ImageFileReader<>::SetFileName() several times + * 0001078: Exception thrown (OTB-Ice) when opening image without projection info + * 0001071: Add otb::DEMHandler ::ClearDEMDirectory() and ::ClearGeoidFile() interface. + + OTB-v.5.0.0 - Changes since version 4.4.0 (2015/05/28) ------------------------------------------ diff --git a/SuperBuild/CMake/External_opencv.cmake b/SuperBuild/CMake/External_opencv.cmake index 84b7b8983bf6b23c3691e55eb601228f45ec4340..6fa01c6bcaec3d1fe60c741a58da74359bbd9876 100644 --- a/SuperBuild/CMake/External_opencv.cmake +++ b/SuperBuild/CMake/External_opencv.cmake @@ -77,6 +77,8 @@ else() -DBUILD_opencv_video:BOOL=OFF -DBUILD_opencv_videostab:BOOL=OFF -DBUILD_opencv_world:BOOL=OFF + -DWITH_CUDA:BOOL=OFF + -DWITH_OPENCL:BOOL=OFF ${OPENCV_SB_CONFIG} DEPENDS ${${proj}_DEPENDENCIES} )