Skip to content
Snippets Groups Projects
Commit cd9a4969 authored by Manuel Grizonnet's avatar Manuel Grizonnet
Browse files

Merge branch 'develop' into gsl_superbuild

parents 3c9becf9 5a9fb433
Branches
Tags
No related merge requests found
...@@ -35,14 +35,10 @@ find_path( OSSIM_INCLUDE_DIR ...@@ -35,14 +35,10 @@ find_path( OSSIM_INCLUDE_DIR
NAMES ossim/init/ossimInit.h ) NAMES ossim/init/ossimInit.h )
# Version checking # Version checking
set(OSSIM_VERSION)
if(EXISTS "${OSSIM_INCLUDE_DIR}/ossim/ossimVersion.h") if(EXISTS "${OSSIM_INCLUDE_DIR}/ossim/ossimVersion.h")
file(READ "${OSSIM_INCLUDE_DIR}/ossim/ossimVersion.h" _ossim_version_h_CONTENTS) file(READ "${OSSIM_INCLUDE_DIR}/ossim/ossimVersion.h" _ossim_version_h_CONTENTS)
string(REGEX REPLACE ".*# *define OSSIM_VERSION *\"([0-9.]+)\".*" "\\1" OSSIM_VERSION "${_ossim_version_h_CONTENTS}") string(REGEX REPLACE ".*# *define OSSIM_VERSION *\"([0-9.]+)\".*" "\\1" OSSIM_VERSION "${_ossim_version_h_CONTENTS}")
string(REGEX REPLACE "([0-9]+)\\.([0-9]+)\\.([0-9]+)" "\\1" OSSIM_MAJOR_VERSION_NUMBER "${OSSIM_VERSION}")
string(REGEX REPLACE "([0-9]+)\\.([0-9]+)\\.([0-9]+)" "\\2" OSSIM_MINOR_VERSION_NUMBER "${OSSIM_VERSION}")
string(REGEX REPLACE "([0-9]+)\\.([0-9]+)\\.([0-9]+)" "\\3" OSSIM_PATCH_VERSION_NUMBER "${OSSIM_VERSION}")
math(EXPR OSSIM_VERSION_NUMBER
"((${OSSIM_MAJOR_VERSION_NUMBER})*100+${OSSIM_MINOR_VERSION_NUMBER})*100+${OSSIM_PATCH_VERSION_NUMBER}")
if("${OSSIM_VERSION}" VERSION_LESS "1.8.20") if("${OSSIM_VERSION}" VERSION_LESS "1.8.20")
message(WARNING "The OSSIM include directory detected by OTB is: '${OSSIM_INCLUDE_DIR}'." message(WARNING "The OSSIM include directory detected by OTB is: '${OSSIM_INCLUDE_DIR}'."
"This version (${OSSIM_VERSION}) is not fully compatible with OTB." "This version (${OSSIM_VERSION}) is not fully compatible with OTB."
...@@ -67,6 +63,28 @@ else() ...@@ -67,6 +63,28 @@ else()
endif() endif()
endif() endif()
# Hack to detect version 2.2.0, without ossimVersion.h
if(EXISTS "${OSSIM_INCLUDE_DIR}/ossim/projection/ossimRpcSolver.h")
file(STRINGS "${OSSIM_INCLUDE_DIR}/ossim/projection/ossimRpcSolver.h" _ossim_rpc_solv_content)
if(_ossim_rpc_solv_content MATCHES "const +ossimRefPtr<ossimRpcModel> +getRpcModel\\(\\)")
if((NOT OSSIM_VERSION) OR (OSSIM_VERSION VERSION_LESS "2.2.0"))
set(OSSIM_VERSION "2.2.0")
endif()
endif()
endif()
if(OSSIM_VERSION)
string(REGEX REPLACE "([0-9]+)\\.([0-9]+)\\.([0-9]+)" "\\1" OSSIM_MAJOR_VERSION_NUMBER "${OSSIM_VERSION}")
string(REGEX REPLACE "([0-9]+)\\.([0-9]+)\\.([0-9]+)" "\\2" OSSIM_MINOR_VERSION_NUMBER "${OSSIM_VERSION}")
string(REGEX REPLACE "([0-9]+)\\.([0-9]+)\\.([0-9]+)" "\\3" OSSIM_PATCH_VERSION_NUMBER "${OSSIM_VERSION}")
math(EXPR OSSIM_VERSION_NUMBER
"((${OSSIM_MAJOR_VERSION_NUMBER})*100+${OSSIM_MINOR_VERSION_NUMBER})*100+${OSSIM_PATCH_VERSION_NUMBER}")
else()
# Unknown version : default to 0
set(OSSIM_VERSION_NUMBER 0)
endif()
# Look for the library
find_library(OSSIM_LIBRARY find_library(OSSIM_LIBRARY
NAMES ossim) NAMES ossim)
......
...@@ -41,7 +41,16 @@ target_link_libraries(OTBOSSIMAdapters ...@@ -41,7 +41,16 @@ target_link_libraries(OTBOSSIMAdapters
${OTBOssim_LIBRARIES} ${OTBOssim_LIBRARIES}
${OTBOssimPlugins_LIBRARIES} ${OTBOssimPlugins_LIBRARIES}
${OTBOpenThreads_LIBRARIES} ${OTBOpenThreads_LIBRARIES}
) )
otb_module_target(OTBOSSIMAdapters) otb_module_target(OTBOSSIMAdapters)
# add the OTB_OSSIM_VERSION definition
get_target_property(_OTBOSSIMAdapters_COMP_DEF OTBOSSIMAdapters COMPILE_DEFINITIONS)
if(_OTBOSSIMAdapters_COMP_DEF)
set_target_properties(OTBOSSIMAdapters
PROPERTIES COMPILE_DEFINITIONS "${_OTBOSSIMAdapters_COMP_DEF};OTB_OSSIM_VERSION=${OTB_OSSIM_VERSION}")
else()
set_target_properties(OTBOSSIMAdapters
PROPERTIES COMPILE_DEFINITIONS "OTB_OSSIM_VERSION=${OTB_OSSIM_VERSION}")
endif()
...@@ -112,7 +112,11 @@ RPCSolverAdapter::Solve(const GCPsContainerType& gcpContainer, ...@@ -112,7 +112,11 @@ RPCSolverAdapter::Solve(const GCPsContainerType& gcpContainer,
rmsError = rpcSolver->getRmsError(); rmsError = rpcSolver->getRmsError();
// Retrieve the output RPC projection // Retrieve the output RPC projection
#if OTB_OSSIM_VERSION < 20200
ossimRefPtr<ossimRpcProjection> rpcProjection = dynamic_cast<ossimRpcProjection*>(rpcSolver->createRpcProjection()->getProjection()); ossimRefPtr<ossimRpcProjection> rpcProjection = dynamic_cast<ossimRpcProjection*>(rpcSolver->createRpcProjection()->getProjection());
#else
ossimRefPtr<ossimRpcModel> rpcProjection = rpcSolver->getRpcModel();
#endif
// Export the sensor model in an ossimKeywordlist // Export the sensor model in an ossimKeywordlist
ossimKeywordlist geom_kwl; ossimKeywordlist geom_kwl;
......
...@@ -52,18 +52,17 @@ TwoNRIBandsImageToNComplexBandsImage<TInputImage, TOutputImage> ...@@ -52,18 +52,17 @@ TwoNRIBandsImageToNComplexBandsImage<TInputImage, TOutputImage>
::GenerateOutputInformation(void) ::GenerateOutputInformation(void)
{ {
Superclass::GenerateOutputInformation(); Superclass::GenerateOutputInformation();
unsigned int nbCompo = this->GetInput()->GetNumberOfComponentsPerPixel(); unsigned int nbCompo = this->GetInput()->GetNumberOfComponentsPerPixel();
if ( (nbCompo % 2) != 0 ) if ( (nbCompo % 2) != 0 )
{ {
itkExceptionMacro("Number of bands of the input images must be an even number"); itkExceptionMacro("Number of bands of the input images must be an even number");
} }
else else
this->GetOutput()->SetNumberOfComponentsPerPixel(nbCompo/2); {
this->GetOutput()->SetNumberOfComponentsPerPixel(nbCompo/2);
std::cout << "GenerateOutputInformation : " << this->GetOutput()->GetNumberOfComponentsPerPixel() << std::endl; }
} }
/** /**
...@@ -75,10 +74,10 @@ TwoNRIBandsImageToNComplexBandsImage<TInputImage, TOutputImage> ...@@ -75,10 +74,10 @@ TwoNRIBandsImageToNComplexBandsImage<TInputImage, TOutputImage>
::BeforeThreadedGenerateData(void) ::BeforeThreadedGenerateData(void)
{ {
unsigned int nbCompo = this->GetInput()->GetNumberOfComponentsPerPixel(); unsigned int nbCompo = this->GetInput()->GetNumberOfComponentsPerPixel();
if ( (nbCompo % 2) != 0 ) if ( (nbCompo % 2) != 0 )
itkExceptionMacro("Number of bands of the input images must be an even number"); itkExceptionMacro("Number of bands of the input images must be an even number");
} }
/** /**
......
...@@ -740,7 +740,11 @@ PersistentSamplingFilterBase<TInputImage,TMaskImage> ...@@ -740,7 +740,11 @@ PersistentSamplingFilterBase<TInputImage,TMaskImage>
dstFeature.SetFID(featIt->GetFID()); dstFeature.SetFID(featIt->GetFID());
tmpLayers[counter].CreateFeature( dstFeature ); tmpLayers[counter].CreateFeature( dstFeature );
cptFeat++; cptFeat++;
if (cptFeat > nbFeatThread) counter++; cptFeat=0; if (cptFeat > nbFeatThread && (counter + 1) < numberOfThreads)
{
counter++;
cptFeat=0;
}
} }
inLayer.SetSpatialFilter(ITK_NULLPTR); inLayer.SetSpatialFilter(ITK_NULLPTR);
......
...@@ -19,3 +19,5 @@ ...@@ -19,3 +19,5 @@
# #
find_package ( Ossim REQUIRED ) find_package ( Ossim REQUIRED )
set(OTB_OSSIM_VERSION ${OSSIM_VERSION_NUMBER} CACHE INTERNAL "Ossim version detected by OTB" FORCE)
...@@ -23,24 +23,9 @@ ...@@ -23,24 +23,9 @@
# So if you run again from a terminal. you need to run the script again # So if you run again from a terminal. you need to run the script again
# see how this is sourced in monteverdi.sh and mapla.sh # see how this is sourced in monteverdi.sh and mapla.sh
# unset any existing LD_LIBRARY_PATH
unset LD_LIBRARY_PATH
CMAKE_PREFIX_PATH=OUT_DIR CMAKE_PREFIX_PATH=OUT_DIR
export CMAKE_PREFIX_PATH export CMAKE_PREFIX_PATH
# if OTB_USE_LOCAL_GTK is set to one,
# we must include ./lib/gtk because gtklibs are installed there.
# OTB_USE_LOCAL_GTK is not set by default (use GTK system)
#This code only affect linux system. for osx OUT_DIR/lib/gtk does not exists
if [ "$OTB_USE_LOCAL_GTK" = "1" ]; then
if [ -d "OUT_DIR/lib/gtk" ]; then
LD_LIBRARY_PATH=OUT_DIR/lib/gtk
export LD_LIBRARY_PATH
fi
fi
# check and set OTB_APPLICATION_PATH # check and set OTB_APPLICATION_PATH
if [ -z "$OTB_APPLICATION_PATH" ] || [ "$OTB_APPLICATION_PATH" = "" ]; then if [ -z "$OTB_APPLICATION_PATH" ] || [ "$OTB_APPLICATION_PATH" = "" ]; then
OTB_APPLICATION_PATH=OUT_DIR/lib/otb/applications OTB_APPLICATION_PATH=OUT_DIR/lib/otb/applications
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment