Commit 09728a32 authored by Guillaume Pasero's avatar Guillaume Pasero

MRG: Synchronize with branch develop

parents 96688c77 988ab22c
Pipeline #216 passed with stage
in 31 minutes and 13 seconds
variables:
DOCKER_DRIVER: overlay2
stages:
- build
.general:
only: [merge_requests]
retry:
max: 2
when:
- runner_system_failure
- stuck_or_timeout_failure
# variables:
# CI_DEBUG_TRACE: "true"
native-build:
extends: .general
stage: build
image: registry.orfeo-toolbox.org/orfeotoolbox/otb:ubuntu-18.04-gcc
script:
- ctest -VV -S CI/main_ci.cmake -DIMAGE_NAME:string=ubuntu-18.04-gcc
shark-build:
extends: .general
stage: build
image: registry.orfeo-toolbox.org/orfeotoolbox/otb:ubuntu-18.04-gcc-shark-3.1.4
script:
- ctest -VV -S CI/main_ci.cmake -DIMAGE_NAME:string=ubuntu-18.04-gcc-shark-3.1.4
\ No newline at end of file
FROM ubuntu:18.04
MAINTAINER Sebastien Dinot <sebastien.dinot@c-s.fr>
ENV DEBIAN_FRONTEND noninteractive
RUN echo "Europe/Paris" > /etc/timezone
# ----------------------------------------------------------------------------
# First stage : install tools (they rarely evolve)
# ----------------------------------------------------------------------------
RUN apt-get update -y \
&& apt-get upgrade -y \
&& apt-get install -y --no-install-recommends \
ca-certificates \
curl \
make \
cmake \
ninja-build \
g++ \
gcc \
clang \
clang-tidy \
clang-format \
ccache \
git \
libtool \
swig \
xvfb \
&& rm -rf /var/lib/apt/lists/*
# ----------------------------------------------------------------------------
# Second stage : dependencies (they evolve more often)
# ----------------------------------------------------------------------------
RUN apt-get update -y \
&& apt-get upgrade -y \
&& apt-get install -y --no-install-recommends \
freeglut3-dev \
libboost-date-time-dev \
libboost-filesystem-dev \
libboost-graph-dev \
libboost-program-options-dev \
libboost-system-dev \
libboost-thread-dev \
libcurl4-gnutls-dev \
libexpat1-dev \
libfftw3-dev \
libgdal-dev \
libgeotiff-dev \
libglew-dev \
libglfw3-dev \
libgsl-dev \
libinsighttoolkit4-dev \
libkml-dev \
libmuparser-dev \
libmuparserx-dev \
libopencv-core-dev \
libopencv-ml-dev \
libopenmpi-dev \
libopenthreads-dev \
libossim-dev \
libpng-dev \
libqt5opengl5-dev \
libqwt-qt5-dev \
libsvm-dev \
libtinyxml-dev \
qtbase5-dev \
qttools5-dev \
default-jdk \
python-dev \
python-numpy \
python-gdal \
python3-dev \
python3-numpy \
python3-gdal \
&& rm -rf /var/lib/apt/lists/*
ENV PATH /usr/lib/ccache:$PATH
ENV OTB_USE_SHARK OFF
FROM ubuntu:18.04 as shark-provider
MAINTAINER OrfeoToolbox Core Team
ENV DEBIAN_FRONTEND noninteractive
# ----------------------------------------------------------------------------
# First stage : install tools
# (based on https://github.com/Shark-ML/Shark/blob/master/.travis.yml)
# ----------------------------------------------------------------------------
RUN apt-get update -y \
&& apt-get upgrade -y \
&& apt-get install -y --no-install-recommends \
ca-certificates \
g++ \
make \
cmake \
libboost-date-time-dev \
libboost-filesystem-dev \
libboost-graph-dev \
libboost-program-options-dev \
libboost-system-dev \
libboost-thread-dev \
libcurl4-gnutls-dev \
curl \
&& rm -rf /var/lib/apt/lists/*
RUN cd \tmp \
&& curl -o shark.tar.gz https://codeload.github.com/Shark-ML/Shark/tar.gz/v3.1.4 \
&& tar xzf shark.tar.gz \
&& cd Shark-3.1.4\
&& mkdir build \
&& cd build \
&& cmake -DBUILD_EXAMPLES:BOOL=OFF \
-DBUILD_TESTING:BOOL=OFF \
-DENABLE_HDF5:BOOL=OFF \
-DBUILD_SHARED_LIBS=ON \
-DENABLE_CBLAS:BOOL=OFF \
-DENABLE_OPENMP:BOOL=OFF \
../. \
&& make install
FROM ubuntu:18.04
MAINTAINER Sebastien Dinot <sebastien.dinot@c-s.fr>
ENV DEBIAN_FRONTEND noninteractive
RUN echo "Europe/Paris" > /etc/timezone
# ----------------------------------------------------------------------------
# First stage : install tools (they rarely evolve)
# ----------------------------------------------------------------------------
RUN apt-get update -y \
&& apt-get upgrade -y \
&& apt-get install -y --no-install-recommends \
ca-certificates \
curl \
make \
cmake \
ninja-build \
g++ \
gcc \
clang \
clang-tidy \
clang-format \
ccache \
git \
libtool \
swig \
xvfb \
&& rm -rf /var/lib/apt/lists/*
# ----------------------------------------------------------------------------
# Second stage : dependencies (they evolve more often)
# ----------------------------------------------------------------------------
RUN apt-get update -y \
&& apt-get upgrade -y \
&& apt-get install -y --no-install-recommends \
freeglut3-dev \
libboost-date-time-dev \
libboost-filesystem-dev \
libboost-graph-dev \
libboost-program-options-dev \
libboost-system-dev \
libboost-thread-dev \
libcurl4-gnutls-dev \
libexpat1-dev \
libfftw3-dev \
libgdal-dev \
libgeotiff-dev \
libglew-dev \
libglfw3-dev \
libgsl-dev \
libinsighttoolkit4-dev \
libkml-dev \
libmuparser-dev \
libmuparserx-dev \
libopencv-core-dev \
libopencv-ml-dev \
libopenmpi-dev \
libopenthreads-dev \
libossim-dev \
libpng-dev \
libqt5opengl5-dev \
libqwt-qt5-dev \
libsvm-dev \
libtinyxml-dev \
qtbase5-dev \
qttools5-dev \
default-jdk \
python-dev \
python-numpy \
python-gdal \
python3-dev \
python3-numpy \
python3-gdal \
&& rm -rf /var/lib/apt/lists/*
COPY --from=shark-provider /usr/local/include/shark/* /usr/include/shark/
COPY --from=shark-provider /usr/local/lib/libshark* /usr/lib/
COPY --from=shark-provider /usr/local/bin/SharkVersion /usr/bin/
COPY --from=shark-provider /usr/local/lib/cmake/ /usr/lib/cmake/
ENV PATH /usr/lib/ccache:$PATH
ENV OTB_USE_SHARK ON
# CI
This folder contains files for the continuous integration.
## Docker files
The docker files are:
* Dockerfile.nat: native environment to test OTB. Shark is not on this one as the version OTB is using is not packaged (since 6.7)
* Dockerfile.shark.1.3.4: native environment and Shark version 3.1.4.
## CMake files
The docker files are:
* main_ci.cmake: main script that will launch configure, build and soon test. It aims at configuring Ctest before running the different jobs (site name, build command...)
* configure_option.cmake: script that gathers all options needed by OTB.
## Yaml file
The last file needed for the CI is the *.gitlab-ci.yml* it aims at interfacing with GitLab. Here is the basic structure:
```
Job-name:
stage: job-type
image: docker_image_that_will_be_used
script:
- script that will be launch inside the docker
```
# CDash interaction
Results of build can be seen in CDash on the track "Experimental". The site is the image docker that run the build, and the build name should be the branch name that is tested.
\ No newline at end of file
#
# 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.
#
# This script is a prototype for the future CI, it may evolve rapidly in a near future
#This file set the following variable :
# * otb_build_project_option
# * otb_use_option
# * otb_wrap_option
# * CONFIGURE_OPTIONS
set (otb_build_project_option
"BUILD_COOKBOOK:BOOL=OFF
BUILD_EXAMPLES:BOOL=ON
BUILD_SHARED_LIBS:BOOL=ON
BUILD_TESTING:BOOL=ON")
set (otb_use_option
"OTB_USE_6S:BOOL=ON
OTB_USE_CURL:BOOL=ON
OTB_USE_GLEW:BOOL=ON
OTB_USE_GLFW:BOOL=ON
OTB_USE_GLUT:BOOL=ON
OTB_USE_GSL:BOOL=ON
OTB_USE_LIBKML:BOOL=ON
OTB_USE_LIBSVM:BOOL=ON
OTB_USE_MPI:BOOL=ON
OTB_USE_MUPARSER:BOOL=ON
OTB_USE_MUPARSERX:BOOL=ON
OTB_USE_OPENCV:BOOL=ON
OTB_USE_OPENGL:BOOL=ON
OTB_USE_OPENMP:BOOL=ON
OTB_USE_QT:BOOL=ON
OTB_USE_QWT:BOOL=ON
OTB_USE_SHARK:BOOL=$ENV{OTB_USESHARK}
OTB_USE_SIFTFAST:BOOL=ON
OTB_USE_SPTW:BOOL=ON
OTB_USE_SSE_FLAGS:BOOL=ON")
set (otb_wrap_option
"OTB_WRAP_JAVA:BOOL=ON
OTB_WRAP_PYTHON:BOOL=ON
OTB_WRAP_PYTHON3:BOOL=ON")
set (otb_data_option
"OTB_DATA_ROOT:PATH=${OTB_DATA_ROOT}
OTB_DATA_USE_LARGEINPUT:BOOL=OFF
OTB_DATA_LARGEINPUT_ROOT:PATH=${OTB_LARGEINPUT_ROOT}")
set (cmake_configure_option
"CMAKE_BUILD_TYPE=${CTEST_BUILD_CONFIGURATION}
CMAKE_INSTALL_PREFIX:PATH=${CTEST_INSTALL_DIRECTORY}
CMAKE_C_FLAGS:STRING=-fPIC -Wall -Wextra
CMAKE_CXX_FLAGS:STRING=-fPIC -Wall -Wextra -Wno-cpp")
#Transform the previous string in list
string (REPLACE "\n" ";" otb_build_project_option ${otb_build_project_option})
string (REPLACE "\n" ";" otb_use_option ${otb_use_option})
string (REPLACE "\n" ";" otb_wrap_option ${otb_wrap_option})
string (REPLACE "\n" ";" otb_data_option ${otb_data_option})
set (otb_options "")
list (APPEND otb_options ${otb_build_project_option})
list (APPEND otb_options ${otb_use_option})
list (APPEND otb_options ${otb_wrap_option})
list (APPEND otb_options ${otb_data_option})
foreach(option ${otb_options})
set( CONFIGURE_OPTIONS "${CONFIGURE_OPTIONS}-D${option};")
endforeach(option)
# This should be removed as soon as possible
set( CONFIGURE_OPTIONS "${CONFIGURE_OPTIONS}-Dopencv_INCLUDE_DIR:PATH=/usr/include;")
#
# 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.
#
# This script is a prototype for the future CI, it may evolve rapidly in a near future
get_filename_component(OTB_SOURCE_DIR ${CMAKE_CURRENT_LIST_DIR} DIRECTORY)
set (ENV{LANG} "C") # Only ascii output
# Build Configuration : Release, Debug..
set (CTEST_BUILD_CONFIGURATION "Release")
set (CTEST_CMAKE_GENERATOR "Unix Makefiles")
set (CTEST_BUILD_NAME "$ENV{CI_MERGE_REQUEST_SOURCE_BRANCH_NAME}_to_$ENV{CI_MERGE_REQUEST_TARGET_BRANCH_NAME}")
set (CTEST_SITE "${IMAGE_NAME}")
# Directory variable
set (CTEST_SOURCE_DIRECTORY "${OTB_SOURCE_DIR}")
set (CTEST_BINARY_DIRECTORY "${OTB_SOURCE_DIR}/build/")
set (CTEST_INSTALL_DIRECTORY "${OTB_SOURCE_DIR}/install/")
set (PROJECT_SOURCE_DIR "${OTB_SOURCE_DIR}")
# Ctest command value
set (CMAKE_COMMAND "cmake")
set (CTEST_BUILD_FLAGS "-j8") # number of thread used for compilation
set (CTEST_BUILD_COMMAND "make ${CTEST_BUILD_FLAGS}")
# Data directory setting
set (OTB_DATA_ROOT "${OTB_SOURCE_DIR}/otb-data/") # todo
set (OTB_LARGEINPUT_ROOT "") # todo
#The following file set the CONFIGURE_OPTIONS variable
set (CONFIGURE_OPTIONS "")
include ( "${CMAKE_CURRENT_LIST_DIR}/configure_option.cmake" )
# End of configuration
ctest_start (Experimental TRACK Experimental)
ctest_configure(BUILD "${CTEST_BINARY_DIRECTORY}"
SOURCE "${OTB_SOURCE_DIR}"
OPTIONS "${CONFIGURE_OPTIONS}"
RETURN_VALUE _configure_rv
CAPTURE_CMAKE_ERROR _configure_error)
if ( _configure_rv EQUAL -1 )
message("An error occurs during ctest_configure:
${_configure_error}")
endif()
ctest_build(BUILD "${CTEST_BINARY_DIRECTORY}"
RETURN_VALUE _build_rv]
CAPTURE_CMAKE_ERROR _build_error]
)
if ( _configure_rv EQUAL -1 )
message("An error occurs during ctest_build:
${_build_error}")
endif()
# ctest_test(PARALLEL_LEVEL 8])
ctest_submit()
\ No newline at end of file
......@@ -46,7 +46,7 @@ if(NOT OTB_USE_OPENCV)
SET(BANNED_HEADERS "${BANNED_HEADERS} otbDecisionTreeMachineLearningModelFactory.h otbDecisionTreeMachineLearningModel.h otbKNearestNeighborsMachineLearningModelFactory.h otbKNearestNeighborsMachineLearningModel.h otbRandomForestsMachineLearningModelFactory.h otbRandomForestsMachineLearningModel.h otbSVMMachineLearningModelFactory.h otbSVMMachineLearningModel.h otbGradientBoostedTreeMachineLearningModelFactory.h otbGradientBoostedTreeMachineLearningModel.h otbBoostMachineLearningModelFactory.h otbBoostMachineLearningModel.h otbNeuralNetworkMachineLearningModelFactory.h otbNeuralNetworkMachineLearningModel.h otbNormalBayesMachineLearningModelFactory.h otbNormalBayesMachineLearningModel.h otbRequiresOpenCVCheck.h otbOpenCVUtils.h otbCvRTreesWrapper.h")
endif()
if(NOT OTB_USE_SHARK)
SET(BANNED_HEADERS "${BANNED_HEADERS} otbSharkRandomForestsMachineLearningModel.h otbSharkRandomForestsMachineLearningModel.hxx otbSharkUtils.h otbRequiresSharkCheck.h otbSharkRandomForestsMachineLearningModelFactory.h otbSharkKMeansMachineLearningModel.h otbSharkKMeansMachineLearningModel.hxx otbSharkKMeansMachineLearningModelFactory.h otbSharkKMeansMachineLearningModelFactory.hxx")
SET(BANNED_HEADERS "${BANNED_HEADERS} otbSharkRandomForestsMachineLearningModel.h otbSharkRandomForestsMachineLearningModel.hxx otbSharkUtils.h otbRequiresSharkCheck.h otbSharkRandomForestsMachineLearningModelFactory.h otbSharkKMeansMachineLearningModel.h otbSharkKMeansMachineLearningModel.hxx otbSharkKMeansMachineLearningModelFactory.h otbSharkKMeansMachineLearningModelFactory.hxx otbPCAModel.h otbPCAModel.hxx otbPCAModelFactory.h otbPCAModelFactory.hxx otbAutoencoderModel.h otbAutoencoderModel.hxx otbAutoencoderModelFactory.h otbAutoencoderModelFactory.hxx")
endif()
if(NOT OTB_USE_LIBSVM)
SET(BANNED_HEADERS "${BANNED_HEADERS} otbLibSVMMachineLearningModel.h otbLibSVMMachineLearningModelFactory.h")
......
......@@ -26,7 +26,6 @@
#include "otbImageFileReader.h"
#include "otbImageFileWriter.h"
#include "otbCommandProgressUpdate.h"
#include "otbCommandLineArgumentParser.h"
#include "otbKullbackLeiblerSupervizedDistanceImageFilter.h"
......@@ -34,36 +33,13 @@ int main(int argc, char * argv[])
{
try
{
typedef otb::CommandLineArgumentParser ParserType;
ParserType::Pointer parser = ParserType::New();
parser->AddOption("--InputImage1", "Give Before image", "-1", 1, true);
parser->AddOption("--InputImage2", "Give After image", "-2", 1, true);
parser->AddOption("--Roi", "Give ROI image", "-r", 1, true);
parser->AddOption("--winSize",
"Sliding window size (def. 35)",
"-w",
1,
false);
parser->AddOutputImage();
typedef otb::CommandLineArgumentParseResult ParserResultType;
ParserResultType::Pointer parseResult = ParserResultType::New();
try
{
parser->ParseCommandLine(argc, argv, parseResult);
}
catch (itk::ExceptionObject& err)
if( argc < 5 )
{
std::string descriptionException = err.GetDescription();
if (descriptionException.find("ParseCommandLine(): Help Parser")
!= std::string::npos) return EXIT_SUCCESS;
if (descriptionException.find("ParseCommandLine(): Version Parser")
!= std::string::npos) return EXIT_SUCCESS;
std::cerr << "Usage: " << argv[0];
std::cerr << "inputNameImage1 inputNameImage2 ROIImageName outputName ";
std::cerr << "[winSize=35]";
return EXIT_FAILURE;
}
/*
* Types declaration
*/
......@@ -83,18 +59,14 @@ int main(int argc, char * argv[])
* Extract command line parameters
*/
std::string inputImageFileName1 = parseResult->GetParameterString(
"--InputImage1");
std::string inputImageFileName2 = parseResult->GetParameterString(
"--InputImage2");
std::string inputTrainingImageFileName = parseResult->GetParameterString(
"--Roi");
std::string outputImageFileName = parseResult->GetOutputImage();
std::string inputImageFileName1 = argv[1];
std::string inputImageFileName2 = argv[2];
std::string inputTrainingImageFileName = argv[3];
std::string outputImageFileName = argv[4];
int winSize = 35;
if (parseResult->IsOptionPresent("--winSize"))
winSize =
parseResult->GetParameterInt("--winSize");
if ( argc == 6 )
winSize = std::stoi(argv[5]);
/*
* JustDoIt
......
......@@ -37,7 +37,6 @@
#include "otbImageFileWriter.h"
#include "otbImageFileReader.h"
#include "otbCommandLineArgumentParser.h"
// Software Guide : BeginCodeSnippet
#include "otbNCCRegistrationFilter.h"
......@@ -111,14 +110,14 @@ int main(int argc, char** argv)
FixedBlurType::Pointer fBlur = FixedBlurType::New();
fBlur->SetInput(fReader->GetOutput());
fBlur->SetSigma(atof(argv[7]));
fBlur->SetSigma(std::stof(argv[7]));
typedef itk::RecursiveGaussianImageFilter<MovingImageType,
MovingImageType> MovingBlurType;
MovingBlurType::Pointer mBlur = MovingBlurType::New();
mBlur->SetInput(mReader->GetOutput());
mBlur->SetSigma(atof(argv[7]));
mBlur->SetSigma(std::stof(argv[7]));
// Software Guide : EndCodeSnippet
// Software Guide : BeginLatex
......@@ -153,8 +152,8 @@ int main(int argc, char** argv)
RadiusType radius;
radius[0] = atoi(argv[6]);
radius[1] = atoi(argv[6]);
radius[0] = std::stoi(argv[6]);
radius[1] = std::stoi(argv[6]);
registrator->SetNCCRadius(radius);
// Software Guide : EndCodeSnippet
......@@ -168,7 +167,7 @@ int main(int argc, char** argv)
// Software Guide : EndLatex
// Software Guide : BeginCodeSnippet
registrator->SetNumberOfIterations(atoi(argv[8]));
registrator->SetNumberOfIterations(std::stoi(argv[8]));
// Software Guide : EndCodeSnippet
// registrator->GetDisplacementField();
......
......@@ -40,7 +40,6 @@
#include "otbMultiChannelRAndNIRIndexImageFilter.h"
// Software Guide : EndCodeSnippet
#include "otbCommandLineArgumentParser.h"
#include "otbImage.h"
#include "otbImageFileWriter.h"
......
......@@ -59,7 +59,7 @@
// Software Guide : BeginCodeSnippet
#include "itkMacro.h"
#include "otbCommandLineArgumentParser.h"
// Software Guide : EndCodeSnippet
// Software Guide : BeginLatex
......@@ -95,96 +95,59 @@ int main(int argc, char * argv[])
// Software Guide : BeginCodeSnippet
try
{
// Software Guide : EndCodeSnippet
// Software Guide : EndCodeSnippet
// Software Guide : BeginLatex
//
// Now, we can declare the \doxygen{otb}{CommandLineArgumentParser} which is
// going to parse the command line, select the proper variables, handle the
// missing compulsory arguments and print an error message if necessary.
//
// Let's declare the parser:
//
// First we document the usage of the program, and get the different
// variables $\sigma_D$ (d=), $\sigma_I$ (i=) and $\alpha$ (a=) in
// c++ variables :
//
// Software Guide : EndLatex
// Software Guide : BeginCodeSnippet
typedef otb::CommandLineArgumentParser ParserType;
ParserType::Pointer parser = ParserType::New();
// Software Guide : EndCodeSnippet
// Software Guide : BeginLatex
//
// It's now time to tell the parser what are the options we want. Special
//options are available for input and output images with the
// \code{AddInputImage()} and \code{AddOutputImage()} methods.
//
// For the other options, we need to use the \code{AddOption()} method.
// This method allows us to specify
// \begin{itemize}
// \item the name of the option
// \item a message to explain the meaning of this option
// \item a shortcut for this option
// \item the number of expected parameters for this option
// \item whether or not this option is compulsory
// \end{itemize}
//
// Software Guide : EndLatex
// Software Guide : BeginCodeSnippet
parser->SetProgramDescription(
"This program applies a Harris detector on the input image");
parser->AddInputImage();
parser->AddOutputImage();
parser->AddOption("--SigmaD",
"Set the sigmaD parameter. Default is 1.0.",
"-d",
1,
false);
parser->AddOption("--SigmaI",
"Set the sigmaI parameter. Default is 1.0.",
"-i",
1,
false);
parser->AddOption("--Alpha",
"Set the alpha parameter. Default is 1.0.",
"-a",
1,
false);
// Software Guide : EndCodeSnippet
// Software Guide : BeginLatex
//
// Now that the parser has all this information, it can actually look at
// the command line to parse it. We have to do this within a \code{try} -
// \code{catch} loop to handle exceptions nicely.
//
// Software Guide : EndLatex
// Software Guide : BeginCodeSnippet
typedef otb::CommandLineArgumentParseResult ParserResultType;
ParserResultType::Pointer parseResult = ParserResultType::New();
try
// Software Guide : BeginCodeSnippet
if ( argc < 3 )
{
parser->ParseCommandLine(argc, argv, parseResult);
std::cerr << "This program applies the Harris detector on the input "
<< "image\n";
std::cerr << "Usage : " << argv[0] ;
std::cerr << " input_filename output_filename [d=1.0] [i=1.0] [a=1.0]\n";
std::cerr << "\"d=\" is for the sigmaD parameter, default value is 1.0\n";
std::cerr << "\"i=\" is for the sigmaI parameter, default value is 1.0\n";
std::cerr << "\"a=\" is for the alpha parameter, default value is 1.0\n";
return EXIT_FAILURE;
}
catch (itk::ExceptionObject& err)
std::string input_filename = argv[1];
std::string output_filename = argv[2];
bool is_there_sigma_d(false), is_there_sigma_i(false),
is_there_alpha(false);
double sigma_d(1.0), sigma_i(1.0), alpha(1.0);
for (auto i = 3 ; i < argc ; i++ )
{
std::string descriptionException = err.GetDescription();
if (descriptionException.find("ParseCommandLine(): Help Parser")
!= std::string::npos)
std::string temp_arg = argv[i];
auto pos_sigma_d = temp_arg.find("d=");
auto pos_sigma_i = temp_arg.find("i=");
auto pos_alpha = temp_arg.find("a=");
if ( pos_sigma_d != std::string::npos )
{
return EXIT_SUCCESS;
is_there_sigma_d = true;
sigma_d = std::stod( temp_arg.substr( pos_sigma_d + 2 ) );
continue;
}
if (descriptionException.find("ParseCommandLine(): Version Parser")
!= std::string::npos)
if ( pos_sigma_i != std::string::npos )
{
return EXIT_SUCCESS;
is_there_sigma_i = true;
sigma_i = std::stod( temp_arg.substr( pos_sigma_i + 2 ) );
continue;
}
if ( pos_alpha != std::string::npos )
{
is_there_alpha = true;
alpha = std::stod( temp_arg.substr( pos_alpha + 2 ) );
continue;
}
return EXIT_FAILURE;
}
// Software Guide : EndCodeSnippet