Commit 142deb6d authored by Antoine Regimbeau's avatar Antoine Regimbeau

Merge branch 'develop' into minimal_compiler

parents 3108b9a8 2e4c87da
Pipeline #2192 failed with stages
in 88 minutes and 9 seconds
......@@ -62,6 +62,7 @@ stages:
- build/compile_commands.json
- build/ctest_report.xml
- build/cppcheck_report.xml
- build/coverage_report.xml
.common-prepare:
extends: .general
......@@ -101,6 +102,7 @@ debian-build:
image: $BUILD_IMAGE_REGISTRY/otb-debian-native:unstable
script:
- xvfb-run -a -n 1 -s "-screen 0 1024x768x24 -dpi 96" ctest -V -S CI/main_ci.cmake -DIMAGE_NAME:string=debian-unstable-gcc
dependencies: []
## Ubuntu superbuild
ubuntu-xdk-prepare:
......@@ -218,21 +220,35 @@ windows-8-build:
#------------------------- QA related jobs -------------------------------------
ubuntu-xdk-qa-code-coverage:
extends: .common-build
only:
refs:
- merge_requests
- develop
- /^release-[0-9]+\.[0-9]+$/
variables:
- $SONAR_OTB_TOKEN
image: $BUILD_IMAGE_REGISTRY/otb-ubuntu-superbuild-qa:18.04
script:
- xvfb-run -a -n 1 -s "-screen 0 1024x768x24 -dpi 96"
ctest -V -S CI/main_qa.cmake
-DIMAGE_NAME:string=ubuntu-18.04-llvm-xdk
-DIMAGE_NAME:string=ubuntu-18.04-llvm-qa
-DQA:BOOL=ON
- ./CI/otb_coverage.sh
- saxon-xslt -o build/ctest_report.xml
build/Testing/`head -n 1 build/Testing/TAG`/Test.xml
CI/ctest2junit.xsl
after_script: []
dependencies:
- ubuntu-xdk-prepare
ubuntu-xdk-qa-static-analysis:
extends: .common-build
only:
refs:
- merge_requests
- develop
- /^release-[0-9]+\.[0-9]+$/
variables:
- $SONAR_OTB_TOKEN
image: $BUILD_IMAGE_REGISTRY/otb-ubuntu-superbuild-qa:18.04
script:
- find Modules -type f -regextype posix-extended -regex '.*\.(h|hxx)$' -exec dirname '{}' \; |
......@@ -254,9 +270,12 @@ ubuntu-xdk-report:
image: $BUILD_IMAGE_REGISTRY/otb-ubuntu-superbuild-qa:18.04
stage: report
only:
- merge_requests
- develop
- /^release-[0-9]+\.[0-9]+$/
refs:
- merge_requests
- develop
- /^release-[0-9]+\.[0-9]+$/
variables:
- $SONAR_OTB_TOKEN
script:
- sonar-scanner -Dproject.settings=sonar-project.properties
-Dsonar.host.url=https://sonar.orfeo-toolbox.org
......
......@@ -18,27 +18,11 @@
# limitations under the License.
#
include( "${CMAKE_CURRENT_LIST_DIR}/macros.cmake" )
set( ENV{LANG} "C" ) # Only ascii output
get_filename_component( OTB_SOURCE_DIR "${CMAKE_CURRENT_LIST_DIR}" DIRECTORY )
set( DEBUG "1" )
set( CMAKE_COMMAND "cmake" )
set( CMAKE_EXPORT_COMPILE_COMMANDS ON )
set( ci_build_type "Debug" )
set( CTEST_TEST_TIMEOUT 1500)
# retrieve XDK
get_xdk()
set( INSTALL_DIR "${XDK_PATH}" )
# FIX ME this part might platform dependent
set( GDAL_DATA "${XDK_PATH}/share/gdal" )
set( GEOTIFF_CSV "${XDK_PATH}/share/epsg_csv" )
set( PROJ_LIB "${XDK_PATH}/share" )
set( CTEST_ENVIRONMENT "PATH=${XDK_PATH}/lib:${XDK_PATH}/bin:$ENV{PATH}" )
set( ci_do_cookbook -1 )
set( ci_do_doxygen -1 )
include( "${CMAKE_CURRENT_LIST_DIR}/main_ci.cmake" )
include( "${CMAKE_CURRENT_LIST_DIR}/main_superbuild.cmake" )
#!/bin/bash
# usage : call CI/otb_coverage.sh from source dir
OTB_DIR="$(dirname $0)/.."
OTB_DIR="$(readlink -f $OTB_DIR)"
if [ -z "$BUILD_DIR" ]; then
BUILD_DIR=${OTB_DIR}/build
fi
echo Generating gcov reports in $BUILD_DIR ...
cd $BUILD_DIR
find $BUILD_DIR -name "*.gcda" -exec llvm-cov gcov -p '{}' > /dev/null \;
ls *.gcov | grep -E -v '#Modules#[a-zA-Z0-9]+#[a-zA-Z0-9]+#(include|src|app)#' | xargs -L 1 rm
echo Filtered $(ls $BUILD_DIR/*.gcov | wc -l) gcov reports
gcovr -r $OTB_DIR -x -g --object-directory=$BUILD_DIR > $BUILD_DIR/coverage_report.xml
echo Generated $BUILD_DIR/coverage_report.xml with $(grep -c '<class ' $BUILD_DIR/coverage_report.xml) classes
#
# Copyright (C) 2005-2019 Centre National d'Etudes Spatiales (CNES)
#
# This file is part of Orfeo Toolbox
#
# https://www.orfeo-toolbox.org/
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
# Configuration options for ubuntu-18.04-llvm-qa
set(site_option
"CMAKE_C_COMPILER:STRING=clang
CMAKE_CXX_COMPILER:STRING=clang++
CMAKE_C_FLAGS:STRING=--coverage
CMAKE_CXX_FLAGS:STRING=--coverage
CMAKE_EXE_LINKER_FLAGS:STRING=-fuse-ld=lld
CMAKE_MODULE_LINKER_FLAGS:STRING=-fuse-ld=lld
CMAKE_SHARED_LINKER_FLAGS:STRING=-fuse-ld=lld
")
Data/Input/pointSet.png

128 Bytes | W: | H:

Data/Input/pointSet.png

128 Bytes | W: | H:

Data/Input/pointSet.png
Data/Input/pointSet.png
Data/Input/pointSet.png
Data/Input/pointSet.png
  • 2-up
  • Swipe
  • Onion skin
......@@ -218,6 +218,68 @@ implementation does not break it, for instance by using an internal
writer to write intermediate data. In this case, execution should
still be correct, but some intermediate data will be read or written.
Mixed in-memory / on-disk connection
------------------------------------
As an extension to the connection of OTB Applications (described in previous
section), a mixed mode is also available to easily switch between:
- **in-memory**: if you want to avoid unecessary I/O between applications
- **on-disk**: if you want intermediate outputs on disk
This mixed mode is based on the ``Application::ConnectImage()`` function. This
is how you use it:
.. code-block:: python
# for in-memory mode
app1 = otb.Registry.CreateApplication("Smoothing")
app2 = otb.Registry.CreateApplication("Smoothing")
app1.IN = input_image
app2.ConnectImage("in", app1, "out")
app2.OUT = output_image
app2.ExecuteAndWriteOutput()
Comparing with the standard in-memory connection, you can notice that:
- the syntax to do the connection is simpler
- you don't need to call ``Execute()`` on upstream applications anymore,
this is done recursively by calling ``ExecuteAndWriteOutput()`` on the latest
application
The on-disk version of this code is very similar:
.. code-block:: python
# for on-disk mode
app1 = otb.Registry.CreateApplication("Smoothing")
app2 = otb.Registry.CreateApplication("Smoothing")
app1.IN = input_image
app1.OUT = temp_image
app2.ConnectImage("in", app1, "out")
app2.OUT = output_image
app2.PropagateConnectMode(False)
app2.ExecuteAndWriteOutput()
The function ``PropagateConnectMode()`` is applied recursively in the upstream
applications. It allows to change between the 2 modes:
- ``True`` : means in-memory mode (this is the default)
- ``False`` : means on-disk mode
When you want to use the on-disk mode, you have to specify the path to
the intermediate image in the **output** image parameter of the upstream
application (``app1.OUT`` in the previous example). If this path is empty, the
in-memory mode is used as fallback.
This feature also works for ``InputImageList``. Calling the function
``ConnectImage("il", app1, "out")``, with ``il`` being an input image list, will
append a new image to the list, and connect it to output parameter ``out``.
Load and save parameters to XML
-------------------------------
......
......@@ -83,5 +83,5 @@ otb_add_test(NAME cdTeKullbackLeiblerProfileChDetTest COMMAND ${OTB_TEST_DRIVER}
${INPUTDATA}/GomaAvant.png
${INPUTDATA}/GomaApres.png
${TEMP}/KullbackLeiblerProfileChDetTest.png
5 51 1 12 24
5 30 1 6 12
)
......@@ -451,7 +451,6 @@ T otb::ogr::Field::GetValue() const
typedef typename boost::mpl::at<internal::FieldType_Map, T>::type Kind;
//const int VALUE = Kind::value;
BOOST_STATIC_ASSERT(!(boost::is_same<Kind, boost::mpl::void_>::value));
assert(m_Definition.GetType() == Kind::value && "OGR field type mismatches the type of requested field value");
typedef typename boost::mpl::at<internal::FieldGetters_Map, Kind>::type GetterType;
// If you experience a static assertion failure in the line below, it means
// the field cannot be extracted into the type requested.
......
......@@ -119,7 +119,7 @@ otb_add_test(NAME cdTvKullbackLeiblerProfileImageFilter COMMAND otbChangeDetecti
${INPUTDATA}/GomaAvant.png
${INPUTDATA}/GomaApres.png
${TEMP}/cdTVKullbackLeiblerProfileImageFilterOutput.tif
5 51)
5 31)
otb_add_test(NAME cdTvKullbackLeiblerDistanceImageFilter COMMAND otbChangeDetectionTestDriver
--compare-image ${EPSILON_10}
......
......@@ -63,10 +63,10 @@ otb_add_test(NAME bfTvCompareOverlapSaveAndClassicalConvolutionWithGaborFilter C
${TEMP}/bfTvCompareConvolutionOutput.tif
${TEMP}/bfTvCompareOSConvolutionoutput.tif
otbCompareOverlapSaveAndClassicalConvolutionWithGaborFilter
${INPUTDATA}/ROI_IKO_PAN_LesHalles_sub.tif
${INPUTDATA}/QB_PAN_ROI_1000_100.tif
${TEMP}/bfTvCompareConvolutionOutput.tif
${TEMP}/bfTvCompareOSConvolutionoutput.tif
64 64 #Radius
32 32 #Radius
0.02 0.025 # a b
-45 # theta
0.0125 0.0125 #u0 v0
......
......@@ -74,13 +74,13 @@ otb_add_test(NAME bfTvMeanShiftSmoothingImageFilterNonOptim COMMAND otbSmoothing
2 10 0.1 10 0
)
otb_add_test(NAME bfTuMeanShiftSmoothingImageFilterROIQBMul4 COMMAND otbSmoothingTestDriver
otb_add_test(NAME bfTuMeanShiftSmoothingImageFilterROIQB COMMAND otbSmoothingTestDriver
otbMeanShiftSmoothingImageFilter
${INPUTDATA}/ROI_QB_MUL_4.tif
${TEMP}/bfMeanShiftSmoothingImageFilterSpatialOutput_ROIQBMul4.tif
${TEMP}/bfMeanShiftSmoothingImageFilterSpectralOutput_ROIQBMul4.tif
${TEMP}/bfMeanShiftSmoothingImageFilterIterationOutput_ROIQBMul4.tif
${TEMP}/bfMeanShiftSmoothingImageFilterLabelOutput_ROIQBMul4.tif
${INPUTDATA}/QB_MUL_ROI_1000_100.tif
${TEMP}/bfMeanShiftSmoothingImageFilterSpatialOutput_ROIQB.tif
${TEMP}/bfMeanShiftSmoothingImageFilterSpectralOutput_ROIQB.tif
${TEMP}/bfMeanShiftSmoothingImageFilterIterationOutput_ROIQB.tif
${TEMP}/bfMeanShiftSmoothingImageFilterLabelOutput_ROIQB.tif
4 50 0.1 100
)
......@@ -133,19 +133,19 @@ otb_add_test(NAME bfTuMeanShiftSmoothingImageFilterQBRoad COMMAND otbSmoothingTe
otb_add_test(NAME bfTuMeanShiftSmoothingImageFilterSpatialStability COMMAND otbSmoothingTestDriver
otbMeanShiftSmoothingImageFilterSpatialStability
${INPUTDATA}/ROI_QB_MUL_4.tif
4 50 0.1 40
100 100 512 512
${INPUTDATA}/QB_MUL_ROI_1000_100.tif
2 50 0.1 10
10 10 80 80
)
otb_add_test(NAME bfTvMeanShiftSmoothingImageFilterThreadingNonOpt COMMAND otbSmoothingTestDriver
--compare-image ${EPSILON_7}
${TEMP}/bfMeanShiftSmoothingImageFilter2SingleThreading_SPOT5.tif
${TEMP}/bfMeanShiftSmoothingImageFilter2MultiThreading_SPOT5.tif
${TEMP}/bfMeanShiftSmoothingImageFilterSingleThread.tif
${TEMP}/bfMeanShiftSmoothingImageFilterMultiThread.tif
otbMeanShiftSmoothingImageFilterThreading
${INPUTDATA}/SPOT5_EXTRACTS/Arcachon/Arcachon_extrait_3852_3319_546_542.tif
${TEMP}/bfMeanShiftSmoothingImageFilter2SingleThreading_SPOT5.tif
${TEMP}/bfMeanShiftSmoothingImageFilter2MultiThreading_SPOT5.tif
4 10 0
${INPUTDATA}/QB_MUL_ROI_1000_100.tif
${TEMP}/bfMeanShiftSmoothingImageFilterSingleThread.tif
${TEMP}/bfMeanShiftSmoothingImageFilterMultiThread.tif
4 50 0
)
......@@ -39,7 +39,7 @@ OSMDataToVectorDataGenerator::OSMDataToVectorDataGenerator():m_North(43.62811),
this->SetNumberOfRequiredOutputs(1);
// Initialize the url
m_Url = "http://www.openstreetmap.org/api/0.6/map?";
m_Url = "https://www.openstreetmap.org/api/0.6/map?";
m_Curl = CurlHelper::New();
......
......@@ -41,7 +41,7 @@ otb_module_target_label(otbDisparityMapTestDriver)
# Tests Declaration
otb_add_test(NAME dmTvDisparityMapEstimationMethod COMMAND otbDisparityMapTestDriver
--compare-ascii ${NOTOL}
--compare-ascii ${EPSILON_3}
${BASELINE_FILES}/dmDisparityMapEstimationOutput1.txt
${TEMP}/dmDisparityMapEstimationOutput1.txt
otbDisparityMapEstimationMethod
......@@ -49,7 +49,7 @@ otb_add_test(NAME dmTvDisparityMapEstimationMethod COMMAND otbDisparityMapTestDr
${INPUTDATA}/moving.png
${INPUTDATA}/pointSet.png
${TEMP}/dmDisparityMapEstimationOutput1.txt
20 20
10 10
)
#otb_add_test(NAME dmTvDisparityMapToDEMFilter COMMAND otbDisparityMapTestDriver
......
......@@ -69,8 +69,7 @@ int otbDisparityMapEstimationMethod(int itkNotUsed(argc), char* argv[])
typedef itk::MinimumMaximumImageCalculator<ImageType> MinMaxType;
MinMaxType::Pointer mm = MinMaxType::New();
mm->SetImage(pointSetReader->GetOutput());
mm->ComputeMinimum();
mm->ComputeMaximum();
mm->Compute();
std::cout << "min: " << (int) mm->GetMinimum() << " max: " << (int) mm->GetMaximum() << std::endl;
PointSetSourceType::Pointer pointSetSource = PointSetSourceType::New();
......@@ -96,7 +95,7 @@ int otbDisparityMapEstimationMethod(int itkNotUsed(argc), char* argv[])
// For gradient descent
optimizer->SetLearningRate(5.0);
optimizer->SetNumberOfIterations(600);
optimizer->SetNumberOfIterations(100);
DMEstimationType::ParametersType initialParameters(transform->GetNumberOfParameters());
initialParameters[0] = 0.0; // Initial offset in mm along X
initialParameters[1] = 0.0; // Initial offset in mm along Y
......
......@@ -70,12 +70,12 @@ otb_add_test(NAME bfTvConnectedComponentMuParserFunctorTestMask COMMAND otbCCOBI
otb_add_test(NAME obTuMeanShiftStreamingConnectedComponentSegmentationOBIAToVectorDataFilter COMMAND otbCCOBIATestDriver
otbMeanShiftStreamingConnectedComponentSegmentationOBIAToVectorDataFilter
${INPUTDATA}/ROI_QB_MUL_4.tif
${INPUTDATA}/QB_MUL_ROI_1000_100.tif
${TEMP}/obTuMeanShiftStreamingConnectedComponentSegmentationOBIAToVectorDataFilter.shp
9
10
0.001
"distance<10"
6
50
0.1
"distance<20"
20
"SHAPE_Elongation>10"
5)
......
......@@ -34,13 +34,13 @@ otb_module_target_label(otbMeanShiftTestDriver)
otb_add_test(NAME obTuMeanShiftConnectedComponentSegmentationFilter COMMAND otbMeanShiftTestDriver
otbMeanShiftConnectedComponentSegmentationFilter
${INPUTDATA}/ROI_QB_MUL_4.tif
${TEMP}/obTuMeanShiftConnectedComponentSegmentationImage.png
9
9
0.01
"distance<0.2"
50)
${INPUTDATA}/QB_MUL_ROI_1000_100.tif
${TEMP}/obTuMeanShiftConnectedComponentSegmentationImage.tif
6
50
0.1
"distance<20"
5)
otb_add_test(NAME obTuMeanShiftSegmentationFilterPruning COMMAND otbMeanShiftTestDriver
otbMeanShiftSegmentationFilter
......
......@@ -64,7 +64,7 @@ public:
: private equality_comparable<ProductType>
, private less_than_comparable<ProductType>
{
enum Type { SLC, GRD, MGD, GEC, EEC, SCS_B, MAX__, UNDEFINED__, FIRST__=0 };
enum Type { SLC, GRD, MGD, GEC, EEC, SCS_B, SCS_U, MAX__, UNDEFINED__, FIRST__=0 };
explicit ProductType(unsigned char value)
: m_value(Type(value))
......
......@@ -268,7 +268,7 @@ namespace ossimplugins
}
}
int nbRasterCount = dataset->GetRasterCount();
int nbRasterCout = dataset->GetRasterCount();
// Metadata for each Band
for (int iBand = 0; iBand < dataset->GetRasterCount(); iBand++)
......@@ -310,13 +310,14 @@ namespace ossimplugins
return false;
}
if( (metadataDataSet["Product_Type"] != "SCS_B"))
if( (metadataDataSet["Product_Type"] != "SCS_B") && metadataDataSet["Product_Type"] != "SCS_U")
{
ossimNotify(ossimNotifyLevel_WARN)
<< "Not an expected product type (only SCS_B expected)" << "'\n" ;
<< "Not an expected product type (only SCS_B and SCS_U expected)" << "'\n" ;
return false;
}
////////////////// Add General Parameters ////////////////
add(theProductKwl, "sensor", "CSK");
add(theProductKwl, "sample_type", "COMPLEX");
......@@ -352,8 +353,10 @@ namespace ossimplugins
add(theProductKwl, SUPPORT_DATA_PREFIX, "azimuth_spacing",
std::stod(metadataBands[0]["S01_SBI_Line_Spacing"]));
add(theProductKwl, SUPPORT_DATA_PREFIX, "range_sampling_rate",
std::stod(metadataDataSet["S01_Sampling_Rate"]));
double samplingRate = 1./std::stod(metadataBands[0]["S01_SBI_Column_Time_Interval"]);
add(theProductKwl, SUPPORT_DATA_PREFIX, "range_sampling_rate", samplingRate);
add(theProductKwl, SUPPORT_DATA_PREFIX, "radar_frequency", std::stod(metadataDataSet["Radar_Frequency"]));
add(theProductKwl, SUPPORT_DATA_PREFIX, "slant_range_to_first_pixel",
std::stod(metadataBands[0]["S01_SBI_Zero_Doppler_Range_First_Time"]));
......@@ -483,7 +486,6 @@ namespace ossimplugins
//////////////// Add GCPs one for the moment ////////////////
// Get the borders
std::string geoCoor_TL = metadataBands[0]["S01_SBI_Top_Left_Geodetic_Coordinates"];
std::vector<std::string> vGeoCoor_TL;
......@@ -500,6 +502,7 @@ namespace ossimplugins
std::string geoCoor_BR = metadataBands[0]["S01_SBI_Bottom_Right_Geodetic_Coordinates"];
std::vector<std::string> vGeoCoor_BR;
otb::Utils::ConvertStringToVector(geoCoor_BR, vGeoCoor_BR, "S01_SBI_Bottom_Right_Geodetic_Coordinates", " ");
// Mean
std::vector<double> vGeoCoor_Mean;
......@@ -523,6 +526,7 @@ namespace ossimplugins
// Inverse model for the middle point
loadState(theProductKwl); // Load the kwl to make the inverse projection
ossimEcefPoint sensorPos;
ossimEcefVector sensorVel;
const bool s1 = this->worldToAzimuthRangeTime(gptPt,estimatedAzimuthTime,estimatedRangeTime,sensorPos,
......
......@@ -98,7 +98,7 @@ namespace {// Anonymous namespace
ossimTrace traceDebug ("ossimSarSensorModel:debug");
typedef char const* const* strings_iterator;
static char const* const PRODUCTTYPE_STRINGS[] = { "SLC", "GRD", "MGD", "GEC", "EEC", "SCS_B" };
static char const* const PRODUCTTYPE_STRINGS[] = { "SLC", "GRD", "MGD", "GEC", "EEC", "SCS_B", "SCS_U" };
}// Anonymous namespace
namespace ossimplugins
......
......@@ -121,6 +121,12 @@ public:
*/
int Execute();
/** write all of the output to disk
* if they have an associated filename.
* This is a helper function for wrappers without pipeline support.
*/
void WriteOutput();
/** Run the application, then write all of the output to disk
* if they have an associated filename.
* This is a helper function for wrappers without pipeline support.
......@@ -129,6 +135,12 @@ public:
*/
int ExecuteAndWriteOutput();
/** Connect input image to an output image in app */
bool ConnectImage(std::string in, Application* app, std::string out);
/** Propagate the connection mode : */
void PropagateConnectMode(bool isMem);
/** Request the application to stop its processing */
void Stop();
......@@ -772,6 +784,8 @@ public:
*/
void FreeRessources();
bool IsExecuteDone();
protected:
/** Constructor */
Application();
......@@ -894,6 +908,9 @@ private:
/** Flag is true when executing DoInit, DoUpdateParameters or DoExecute */
bool m_IsInPrivateDo;
/** Flag to check if Execute has already been called */
bool m_ExecuteDone;
/**
* Declare the class
* - Wrapper::MapProjectionParametersHandler
......
......@@ -55,10 +55,31 @@ public:
/** RTTI support */
itkTypeMacro(InputImageParameter, Parameter);
typedef struct
{
itk::Object::Pointer app;
std::string key;
bool isMem;
} Connector;
/** Set value from filename */
bool SetFromFileName( const std::string & filename );
itkGetConstReferenceMacro( FileName, std::string );
void SetConnection(Connector c)
{
m_Connection = c;
}
const Connector & GetConnection() const
{
return m_Connection;
}
void SetConnectionMode(bool isMem)
{
m_Connection.isMem = isMem;
}
/** Get input-image as ImageBaseType. */
ImageBaseType const* GetImage() const;
......@@ -152,6 +173,8 @@ private:
/** flag : are we using a filename or an image pointer as an input */
bool m_UseFilename;
Connector m_Connection;
}; // End class InputImage Parameter
} // End namespace Wrapper
......
......@@ -86,6 +86,8 @@ public:
/** */
void Insert( const std::string &, std::size_t = -1 ) override;
void InsertElement(typename T::Pointer, std::size_t = -1);
/** Set one specific stored filename. */
void SetNthFileName( std::size_t, const std::string & ) override;
......@@ -117,6 +119,8 @@ public:
/** */
void Swap( std::size_t, std::size_t ) override;
typename T::Pointer GetNthElement(std::size_t);
std::vector<std::string> ToStringList() const override;
void FromStringList(const std::vector<std::string>& value) override;
std::string ToString() const override;
......
......@@ -159,8 +159,17 @@ ParameterList< T >
p->FromString(filename);
m_Parameters.insert( m_Parameters.begin() + index, p );
InsertElement(p, index);
}
/*****************************************************************************/
template< typename T >
void
ParameterList< T >
::InsertElement(typename T::Pointer p, std::size_t index)
{
m_Parameters.insert( m_Parameters.begin() + index, p );
assert( !m_Parameters.back().IsNull() );
SetActive( true );
......@@ -443,9 +452,9 @@ ParameterList< T >
{
assert( data!=nullptr );
typename T::Pointer p;
typename T::Pointer p( T::New() );
return From( p, data, set, description );
return FromData( p, data, set, description );
}
/*****************************************************************************/
......@@ -460,8 +469,6 @@ ParameterList< T >
{
assert( data!=nullptr );
parameter = T::New();
set( parameter, data );
parameter->SetDescription( description );
......@@ -497,6 +504,14 @@ std::string ParameterList<T>::ToString() const
return oss.str();
}
template< typename T >
typename T::Pointer
ParameterList< T >
::GetNthElement(std::size_t i)
{
return m_Parameters[i];
}
} // End namespace Wrapper
......
......@@ -47,7 +47,7 @@ InputImageListParameter
{
assert( image!=nullptr );
InputImageParameter::Pointer p;
InputImageParameter::Pointer p( InputImageParameter::New() );
return FromImage( p, image );
}
......
......@@ -244,7 +244,10 @@ public:
void Init();
void UpdateParameters();
int Execute();
void WriteOutput();
int ExecuteAndWriteOutput();
bool ConnectImage(std::string in, Application* app, std::string out);
void PropagateConnectMode(bool isMem);
void LoadParametersFromXML(const std::string& filename);
void SaveParametersToXML(const std::string& filename);
......
......@@ -22,27 +22,39 @@
# -*- coding: utf-8 -*-
#
# Example on the use of the Rescale
# Example on the use of application connections
#
def test(otb, argv):
app1 = otb.Registry.CreateApplication("Smoothing")
app2 = otb.Registry.CreateApplication("Smoothing")
app3 = otb.Registry.CreateApplication("Smoothing")
app4 = otb.Registry.CreateApplication("ConcatenateImages")
#---------------------------------------------------------------------------
# First run with in-memory connections by default
app1 = otb.Registry.CreateApplication("Smoothing")
app2 = otb.Registry.CreateApplication("Smoothing")
app3 = otb.Registry.CreateApplication("Smoothing")
app4 = otb.Registry.CreateApplication("ConcatenateImages")
app1.IN = argv[1]
app1.Execute()
app1.IN = argv[1]
app1.TYPE = "mean"
app2.SetParameterInputImage("in",app1.GetParameterOutputImage("out"))
app2.Execute()
app2.ConnectImage("in",app1, "out")
app2.TYPE = "anidif"
app3.IN = argv[1]
app3.Execute()
app3.ConnectImage("in",app1, "out")
app3.TYPE = "gaussian"
app4.AddImageToParameterInputImageList("il",app2.GetParameterOutputImage("out"));