Skip to content
Commits on Source (11)
......@@ -62,8 +62,9 @@ set(CTEST_CUSTOM_COVERAGE_EXCLUDE
".*/Utilities/.*"
# Exclude SWIG wrappers files
".*/Modules/Wrappers/SWIG/src/otbApplicationPYTHON_wrap.*"
".*/Modules/Wrappers/SWIG/src/otbApplicationJAVA_wrap.*"
".*/Modules/Wrappers/SWIG/src/python/otbApplicationPYTHON_wrap.*"
".*/Modules/Wrappers/SWIG/src/python3/otbApplicationPYTHON_wrap.*"
".*/Modules/Wrappers/SWIG/src/java/otbApplicationJAVA_wrap.*"
# Exclude Qt moc file
".*moc_.*"
......
......@@ -35,14 +35,10 @@ find_path( OSSIM_INCLUDE_DIR
NAMES ossim/init/ossimInit.h )
# Version checking
set(OSSIM_VERSION)
if(EXISTS "${OSSIM_INCLUDE_DIR}/ossim/ossimVersion.h")
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 "([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")
message(WARNING "The OSSIM include directory detected by OTB is: '${OSSIM_INCLUDE_DIR}'."
"This version (${OSSIM_VERSION}) is not fully compatible with OTB."
......@@ -67,6 +63,28 @@ else()
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
NAMES ossim)
......
......@@ -122,10 +122,6 @@ macro(SWIG_ADD_SOURCE_TO_MODULE name outfiles infile)
set(swig_generated_file_fullname
"${CMAKE_CURRENT_BINARY_DIR}")
if(swig_source_file_relative_path)
set(swig_generated_file_fullname
"${swig_generated_file_fullname}/${swig_source_file_relative_path}")
endif()
# If CMAKE_SWIG_OUTDIR was specified then pass it to -outdir
if(CMAKE_SWIG_OUTDIR)
set(swig_outdir ${CMAKE_SWIG_OUTDIR})
......
......@@ -47,6 +47,19 @@ set(CMAKE_CXX_STANDARD 14)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_CXX_EXTENSIONS OFF)
# Check compiler versions
set(OTB_MIN_GNU_VER 5)
set(OTB_MIN_MSVC_VER 19)
set(OTB_MIN_Clang_VER 3.4)
if(DEFINED OTB_MIN_${CMAKE_CXX_COMPILER_ID}_VER)
if(CMAKE_CXX_COMPILER_VERSION AND CMAKE_CXX_COMPILER_VERSION VERSION_LESS ${OTB_MIN_${CMAKE_CXX_COMPILER_ID}_VER})
message(STATUS "WARNING: the version of your ${CMAKE_CXX_COMPILER_ID} "
"compiler is not supported by Orfeo ToolBox (C++14 support might be "
"incomplete). Please consider updating your compiler to version "
"${OTB_MIN_${CMAKE_CXX_COMPILER_ID}_VER} or later.")
endif()
endif()
include(CMakeDependentOption)
#
# use ExternalProject
......@@ -110,7 +123,7 @@ set(main_project_name ${_OTBModuleMacros_DEFAULT_LABEL})
#-----------------------------------------------------------------------------
# OTB version number.
set(OTB_VERSION_MAJOR "6")
set(OTB_VERSION_MINOR "2")
set(OTB_VERSION_MINOR "4")
set(OTB_VERSION_PATCH "0")
set(OTB_VERSION_STRING "${OTB_VERSION_MAJOR}.${OTB_VERSION_MINOR}.${OTB_VERSION_PATCH}")
......@@ -145,6 +158,9 @@ endif()
if(NOT OTB_INSTALL_PYTHON_DIR)
set(OTB_INSTALL_PYTHON_DIR "lib/otb/python")
endif()
if(NOT OTB_INSTALL_PYTHON3_DIR)
set(OTB_INSTALL_PYTHON3_DIR "lib/otb/python3")
endif()
if(NOT OTB_INSTALL_JAVA_DIR)
set(OTB_INSTALL_JAVA_DIR "lib/otb/java")
endif()
......
......@@ -81,11 +81,8 @@ public:
// Software Guide : EndLatex
// Software Guide : BeginCodeSnippet
itkNewMacro(Self)
;
itkTypeMacro(ExampleApplication, otb::Application)
;
itkNewMacro(Self);
itkTypeMacro(ExampleApplication, otb::Application);
// Software Guide : EndCodeSnippet
......@@ -136,7 +133,7 @@ private:
// Software Guide : BeginLatex
// \code{AddDocTag()} method categorize the application using relevant tags.
// \code{Code/ApplicationEngine/otbWrapperTags.h} contains some predefined tags defined in \code{Tags} namespace.
// The header file \code{otbWrapperTags.h} in OTB sources contains some predefined tags defined in \code{Tags} namespace.
// Software Guide : EndLatex
// Software Guide : BeginCodeSnippet
......@@ -146,52 +143,63 @@ private:
// Software Guide : BeginLatex
// Application parameters declaration is done using \code{AddParameter()} method.
// \code{AddParameter()} requires Parameter type, its name and description.
// \code{AddParameter()} requires the input parameter type
// (ParameterType_InputImage, ParameterType_Int, ParameterType_Float), its name and description.
// \subdoxygen{otb}{Wrapper}{Application} class contains methods to set parameters characteristics.
// Software Guide : EndLatex
// Software Guide : BeginCodeSnippet
AddParameter(ParameterType_InputImage, "in", "Input Image");
AddParameter(ParameterType_OutputImage, "out", "Output Image");
AddParameter(ParameterType_Empty, "boolean", "Boolean");
MandatoryOff("boolean");
AddParameter(ParameterType_Int, "int", "Integer");
MandatoryOff("int");
SetDefaultParameterInt("int", 1);
SetMinimumParameterIntValue("int", 0);
SetMaximumParameterIntValue("int", 10);
AddParameter(ParameterType_Float, "float", "Float");
MandatoryOff("float");
SetDefaultParameterFloat("float", 0.2);
SetMinimumParameterFloatValue("float", -1.0);
SetMaximumParameterFloatValue("float", 15.0);
AddParameter(ParameterType_String, "string", "String");
MandatoryOff("string");
AddParameter(ParameterType_InputFilename, "filename", "File name");
MandatoryOff("filename");
AddParameter(ParameterType_Directory, "directory", "Directory name");
MandatoryOff("directory");
AddParameter(ParameterType_Choice, "choice", "Choice");
AddChoice("choice.choice1", "Choice 1");
AddChoice("choice.choice2", "Choice 2");
AddChoice("choice.choice3", "Choice 3");
AddParameter(ParameterType_Float, "choice.choice1.floatchoice1"
, "Float of choice1");
SetDefaultParameterFloat("choice.choice1.floatchoice1", 0.125);
AddParameter(ParameterType_Float, "choice.choice3.floatchoice3"
, "Float of choice3");
SetDefaultParameterFloat("choice.choice3.floatchoice3", 5.0);
AddParameter(ParameterType_Group, "ingroup", "Input Group");
AddParameter(ParameterType_Empty, "param1", "Example of boolean parameter");
MandatoryOff("param1");
AddParameter(ParameterType_Int, "param2", "Example of integer parameter");
MandatoryOff("param2");
SetDefaultParameterInt("param2", 1);
SetMinimumParameterIntValue("param2", 0);
SetMaximumParameterIntValue("param2", 10);
AddParameter(ParameterType_Float, "param3", "Example of float parameter");
MandatoryOff("param3");
SetDefaultParameterFloat("param3", 0.2);
SetMinimumParameterFloatValue("param3", -1.0);
SetMaximumParameterFloatValue("param3", 15.0);
AddParameter(ParameterType_String, "param4", "Example of string parameter");
MandatoryOff("param4");
AddParameter(ParameterType_InputFilename, "param5", "Example of filename");
MandatoryOff("param5");
AddParameter(ParameterType_Directory, "param6", "Example of directory name");
MandatoryOff("param6");
AddParameter(ParameterType_Choice, "inchoice", "Example of choice parameter");
AddChoice("inchoice.choice1", "Choice 1");
AddChoice("inchoice.choice2", "Choice 2");
AddChoice("inchoice.choice3", "Choice 3");
AddParameter(ParameterType_Float, "inchoice.choice1.floatchoice1"
, "Example of float parameter for choice1");
SetDefaultParameterFloat("inchoice.choice1.floatchoice1", 0.125);
AddParameter(ParameterType_Float, "inchoice.choice3.floatchoice3"
, "Example of float parameter for choice3");
SetDefaultParameterFloat("inchoice.choice3.floatchoice3", 5.0);
AddParameter(ParameterType_Group, "ingroup", "Input group");
MandatoryOff("ingroup");
AddParameter(ParameterType_Int, "ingroup.integer", "Integer of Group");
MandatoryOff("ingroup.integer");
AddParameter(ParameterType_Group, "ingroup.images", "Input Images Group");
AddParameter(ParameterType_Int, "ingroup.valint", "Example of integer parameter for group");
MandatoryOff("ingroup.valint");
AddParameter(ParameterType_Group, "ingroup.images", "Input Images group");
AddParameter(ParameterType_InputImage, "ingroup.images.inputimage"
, "Input Image");
MandatoryOff("ingroup.images.inputimage");
AddParameter(ParameterType_Group, "outgroup", "Output Group");
AddParameter(ParameterType_Group, "outgroup", "Output group");
MandatoryOff("outgroup");
AddParameter(ParameterType_OutputImage, "outgroup.outputimage"
, "Output Image");
......@@ -199,7 +207,7 @@ private:
AddParameter(ParameterType_InputImageList, "il", "Input image list");
MandatoryOff("il");
AddParameter(ParameterType_ListView, "cl", "Output Image channels");
AddParameter(ParameterType_ListView, "cl", "Output image channels");
AddChoice("cl.choice1", "cl.choice1");
AddChoice("cl.choice2", "cl.choice2");
MandatoryOff("cl");
......@@ -208,14 +216,14 @@ private:
SetDefaultParameterInt("ram", 256);
MandatoryOff("ram");
AddParameter(ParameterType_ComplexInputImage, "cin", "Input Complex Image");
AddParameter(ParameterType_ComplexOutputImage, "cout", "Output Complex Image");
AddParameter(ParameterType_ComplexInputImage, "cin", "Input complex image");
AddParameter(ParameterType_ComplexOutputImage, "cout", "Output complex image");
MandatoryOff("cin");
MandatoryOff("cout");
// Software Guide : EndCodeSnippet
// Software Guide : BeginLatex
// An example commandline is automatically generated. Method \code{SetDocExampleParameterValue()} is
// An example of command-line is automatically generated. Method \code{SetDocExampleParameterValue()} is
// used to set parameters. Dataset should be located in \code{OTB-Data/Examples} directory.
// Software Guide : EndLatex
......@@ -231,7 +239,7 @@ private:
// gives a complete description of this method.
// Software Guide : EndLatex
// Software Guide :BeginCodeSnippet
void DoUpdateParameters() ITK_OVERRIDE
void DoUpdateParameters() override
{
}
// Software Guide : EndCodeSnippet
......@@ -241,13 +249,13 @@ private:
// gives a complete description of this method.
// Software Guide : EndLatex
// Software Guide :BeginCodeSnippet
void DoExecute() ITK_OVERRIDE
void DoExecute() override
{
FloatVectorImageType::Pointer inImage = GetParameterImage("in");
int paramInt = GetParameterInt("int");
int paramInt = GetParameterInt("param2");
otbAppLogDEBUG( << paramInt << std::endl );
int paramFloat = GetParameterFloat("float");
int paramFloat = GetParameterFloat("param3");
otbAppLogINFO( << paramFloat );
SetParameterOutputImage("out", inImage);
......@@ -260,7 +268,7 @@ private:
}
// Software Guide : BeginLatex
// Finally \code{OTB\_APPLICATION\_EXPORT} is called.
// Finally \code{OTB\_APPLICATION\_EXPORT} is called:
// Software Guide : EndLatex
// Software Guide :BeginCodeSnippet
OTB_APPLICATION_EXPORT(otb::Wrapper::ApplicationExample)
......
......@@ -21,6 +21,6 @@
otb_test_application(NAME apTeGenerateAnApplicationExample
APP ApplicationExample
OPTIONS -in ${OTB_DATA_ROOT}/Examples/QB_Suburb.png
-out ${TEMP}/apTeGenerateAnApplicationExampleOutput.png)
-out ${TEMP}/apTeGenerateAnApplicationExampleOutput.png uint8)
set_tests_properties(apTeGenerateAnApplicationExample PROPERTIES DEPENDS otbapp_ApplicationExample)
......@@ -46,8 +46,6 @@
#include <otbImageFileReader.h>
#include "otbImageFileWriter.h"
#include "itkTimeProbe.h"
int main(int itkNotUsed(argc), char * argv[])
{
......
......@@ -114,20 +114,20 @@ int main(int, char *[])
// Software Guide : BeginLatex
//
// The array can be assigned to the image using
// the \code{SetSpacing()} method.
// the \code{SetSignedSpacing()} method.
//
// \index{otb::Image!SetSpacing()}
// \index{otb::Image!SetSignedSpacing()}
//
// Software Guide : EndLatex
// Software Guide : BeginCodeSnippet
image->SetSpacing(spacing);
image->SetSignedSpacing(spacing);
// Software Guide : EndCodeSnippet
// Software Guide : BeginLatex
//
// The spacing information can be retrieved from an image by using the
// \code{GetSpacing()} method. This method returns a reference to a
// \code{GetSignedSpacing()} method. This method returns a reference to a
// \code{FixedArray}. The returned object can then be used to read the
// contents of the array. Note the use of the \code{const} keyword to indicate
// that the array will not be modified.
......@@ -135,7 +135,7 @@ int main(int, char *[])
// Software Guide : EndLatex
// Software Guide : BeginCodeSnippet
const ImageType::SpacingType& sp = image->GetSpacing();
const ImageType::SpacingType& sp = image->GetSignedSpacing();
std::cout << "Spacing = ";
std::cout << sp[0] << ", " << sp[1] << std::endl;
......
......@@ -99,7 +99,7 @@ int main(int argc, char * argv[])
ImagePointType origin = image->GetOrigin();
ImageType::SpacingType spacing = image->GetSpacing();
ImageType::SpacingType spacing = image->GetSignedSpacing();
ImageType::SizeType size = image->GetBufferedRegion().GetSize();
ImagePointType point;
......
......@@ -374,7 +374,7 @@ int main(int argc, char* argv[])
// Software Guide : BeginCodeSnippet
generator->SetOutputOrigin(fixedReader->GetOutput()->GetOrigin());
generator->SetOutputSpacing(fixedReader->GetOutput()->GetSpacing());
generator->SetOutputSpacing(fixedReader->GetOutput()->GetSignedSpacing());
generator->SetOutputSize(fixedReader->GetOutput()
->GetLargestPossibleRegion().GetSize());
// Software Guide : EndCodeSnippet
......@@ -439,7 +439,7 @@ int main(int argc, char* argv[])
warper->SetInput(movingReader->GetOutput());
warper->SetDisplacementField(generator->GetOutput());
warper->SetOutputOrigin(fixedReader->GetOutput()->GetOrigin());
warper->SetOutputSpacing(fixedReader->GetOutput()->GetSpacing());
warper->SetOutputSpacing(fixedReader->GetOutput()->GetSignedSpacing());
// Software Guide : EndCodeSnippet
// Software Guide : BeginLatex
......
......@@ -179,7 +179,7 @@ int main(int argc, char * argv[])
vectorDataRenderer->SetSize(reader->GetOutput()->GetLargestPossibleRegion().GetSize());
vectorDataRenderer->SetOrigin(reader->GetOutput()->GetOrigin());
vectorDataRenderer->SetSpacing(reader->GetOutput()->GetSpacing());
vectorDataRenderer->SetSpacing(reader->GetOutput()->GetSignedSpacing());
vectorDataRenderer->SetRenderingStyleType(VectorDataRendererType::Binary);
blendingFilter->SetInput1(reader->GetOutput());
......
......@@ -237,7 +237,7 @@ int main(int argc, char * argv[])
// Software Guide : EndLatex
// Software Guide : BeginCodeSnippet
ImageType::SpacingType spacing = reader->GetOutput()->GetSpacing();
ImageType::SpacingType spacing = reader->GetOutput()->GetSignedSpacing();
ImageType::PointType origin = reader->GetOutput()->GetOrigin();
//OutputImageType::SizeType size = outputImage->GetLargestPossibleRegion().GetSize();
......
......@@ -116,7 +116,7 @@ int main(int itkNotUsed(argc), char* argv[])
// SoftwareGuide: EndLatex
// SoftwareGuide : BeginCodeSnippet
file << "Spacing " << image->GetSpacing() << std::endl;
file << "Spacing " << image->GetSignedSpacing() << std::endl;
file << "Origin " << image->GetOrigin() << std::endl;
file << "Projection REF " << image->GetProjectionRef() << std::endl;
......
......@@ -104,7 +104,7 @@ int main(int argc, char *argv[])
Index4DType index4D = region4D.GetIndex();
Size4DType size4D = region4D.GetSize();
Spacing4DType spacing4D = image4D->GetSpacing();
Spacing4DType spacing4D = image4D->GetSignedSpacing();
Origin4DType origin4D = image4D->GetOrigin();
for (unsigned int i = 0; i < 3; ++i)
......@@ -115,7 +115,7 @@ int main(int argc, char *argv[])
origin3D[i] = origin4D[i];
}
image3D->SetSpacing(spacing3D);
image3D->SetSignedSpacing(spacing3D);
image3D->SetOrigin(origin3D);
Region3DType region3D;
......
......@@ -170,7 +170,7 @@ int main(int argc, char *argv[])
// Software Guide : BeginCodeSnippet
ImageType::Pointer outputImage = ImageType::New();
outputImage->SetRegions(outputRegion);
const ImageType::SpacingType& spacing = reader->GetOutput()->GetSpacing();
const ImageType::SpacingType& spacing = reader->GetOutput()->GetSignedSpacing();
const ImageType::PointType& inputOrigin = reader->GetOutput()->GetOrigin();
double outputOrigin[Dimension];
......@@ -179,7 +179,7 @@ int main(int argc, char *argv[])
outputOrigin[i] = inputOrigin[i] + spacing[i] * inputStart[i];
}
outputImage->SetSpacing(spacing);
outputImage->SetSignedSpacing(spacing);
outputImage->SetOrigin(outputOrigin);
outputImage->Allocate();
// Software Guide : EndCodeSnippet
......
......@@ -321,7 +321,7 @@ int main(int argc, char* argv[])
resampler->SetTransform(estimator->GetAffineTransform());
resampler->SetSize(fixedImage->GetLargestPossibleRegion().GetSize());
resampler->SetOutputOrigin(fixedImage->GetOrigin());
resampler->SetOutputSpacing(fixedImage->GetSpacing());
resampler->SetOutputSpacing(fixedImage->GetSignedSpacing());
resampler->SetDefaultPixelValue(100);
// Software Guide : EndCodeSnippet
......
......@@ -304,7 +304,7 @@ int main(int argc, char* argv[])
// Software Guide : BeginCodeSnippet
ImageType::ConstPointer fixedImage = fixedReader->GetOutput();
deformer->SetOutputSpacing(fixedImage->GetSpacing());
deformer->SetOutputSpacing(fixedImage->GetSignedSpacing());
deformer->SetOutputOrigin(fixedImage->GetOrigin());
deformer->SetOutputRegion(fixedImage->GetLargestPossibleRegion());
// Software Guide : EndCodeSnippet
......
......@@ -234,7 +234,7 @@ int main(int argc, char * argv[])
}
PointsIteratorType pIt = filter->GetOutput()->GetPoints()->Begin();
ImageType::SpacingType spacing = reader->GetOutput()->GetSpacing();
ImageType::SpacingType spacing = reader->GetOutput()->GetSignedSpacing();
ImageType::PointType origin = reader->GetOutput()->GetOrigin();
OutputImageType::SizeType size =
outputImage->GetLargestPossibleRegion().GetSize();
......
......@@ -239,7 +239,7 @@ int main(int argc, char * argv[])
// Software Guide : EndLatex
// Software Guide : BeginCodeSnippet
ImageType::SpacingType spacing = reader->GetOutput()->GetSpacing();
ImageType::SpacingType spacing = reader->GetOutput()->GetSignedSpacing();
ImageType::PointType origin = reader->GetOutput()->GetOrigin();
// Software Guide : EndCodeSnippet
......
......@@ -129,7 +129,7 @@ int main(int argc, char* argv[])
// necessary for sensors
filter->SetOutputOrigin(imageReader->GetOutput()->GetOrigin());
// necessary for sensors
filter->SetOutputSpacing(imageReader->GetOutput()->GetSpacing());
filter->SetOutputSpacing(imageReader->GetOutput()->GetSignedSpacing());
// ~ wkt
filter->SetOutputProjectionRef( imageReader->GetOutput()->GetProjectionRef());
// Software Guide : EndCodeSnippet
......