Commit 5d475c21 authored by Cédric Traizet's avatar Cédric Traizet

Merge branch 'develop' into compatibility_opencv4

parents 0e89804e f4b9516d
Pipeline #2601 failed with stages
in 142 minutes and 51 seconds
#
# 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.
#
# WARNING!
# OTB uses Git-LFS to store the (large) tests data.
# Git-LFS is mostly transparent for the user and recent versions
......
#
# 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.
#
language: cpp
sudo: false
......
#!/bin/bash
#
# 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.
#
# Configure git for tar.xz
git config tar.tar.xz.command "xz -c"
......
::
:: 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.
@echo off
:: check input arguments
if %1.==. (
......
......@@ -158,7 +158,7 @@ r'''/\*
| \* Copyright \(C\) 20\d\d(-20\d\d)? Centre National d'Etudes Spatiales \(CNES\)
| \* Copyright \(C\) 20\d\d(-20\d\d)? CS Systemes d'Information \(CS SI\)
| \* Copyright \(C\) 2007-2012 Institut Mines Telecom / Telecom Bretagne
| \* Copyright \(C\) 2005-2016 IRSTEA
| \* Copyright \(C\) 20\d\d(-20\d\d)? IRSTEA
| \* Copyright \(C\) 2008 Jan Wegner
| \* Copyright \(C\) 2007 Julien Radoux
)+ \*
......
#!/bin/bash
#
# 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.
#
# usage : call CI/otb_coverage.sh from source dir
OTB_DIR="$(dirname $0)/.."
......
#!/usr/bin/env python3
#
# 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.
#
import unittest
import os.path
import sys
......@@ -70,4 +91,4 @@ class TestHandler(unittest.TestCase):
if __name__ == '__main__':
unittest.main()
\ No newline at end of file
unittest.main()
::
:: 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.
@echo off
::
:: Autogenerated by OTB installation process
......
#!/bin/sh
#
# 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.
#
#
# Autogenerated by OTB installation process
......
::
:: 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.
@echo off
::
:: Autogenerated by OTB installation process
......
#!/bin/sh
#
# 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.
#
#
# Autogenerated by OTB installation process
......
#!/bin/sh
#
# 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.
#
#cmake builds with rpath in the binary dir, so we don't need to set LD_LIBRARY_PATH here
#export LD_LIBRARY_PATH=@CMAKE_BINARY_DIR@/lib:$LD_LIBRARY_PATH
......
#!/usr/bin/env python3
#
# 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.
#
import argparse
import re
import os
......
#!/usr/bin/env python3
#
# 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.
#
import sys
import re
......
#!/usr/bin/env python3
#
# 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.
#
# Regex used to find examples usage
examples_usage_regex = r"\/\* Example usage:\n(\.\/\w+ (.*?))\*\/"
......
/*
* 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 piece of javascript is used to display the versions widget at the lower
// left corner of the html CookBook for OTB
......
/*
* 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.
*/
* 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.
*/
#include "otbLearningApplicationBase.h"
#include "otbWrapperApplicationFactory.h"
......
/*
* Copyright (C) 2017 National Research Institute of Science and
* Technology for Environment and Agriculture (IRSTEA)
* Copyright (C) 2017 IRSTEA
*
* This file is part of Orfeo Toolbox
*
......
#
# 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.
#
project(OTBAppSARUtils)
otb_module_impl()
#
# 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.
#
set(DOCUMENTATION "SAR Utils application.")
otb_module(OTBAppSARUtils
......
......@@ -232,21 +232,29 @@ StreamingWarpImageFilter<TInputImage, TOutputImage, TDisplacementField>
}
else
{
// In this case we need to generate an empty region compatible
// with cropping by input largest possible region.
inputFinalSize.Fill(0);
inputRequestedRegion.SetSize(inputFinalSize);
inputFinalIndex.Fill(0);
inputRequestedRegion.SetIndex(inputFinalIndex);
// store what we tried to request (prior to trying to crop)
inputPtr->SetRequestedRegion(inputRequestedRegion);
for(auto dim = 0U; dim < InputImageType::ImageDimension; ++dim)
{
auto largestInputRegion = inputPtr->GetLargestPossibleRegion();
if(largestInputRegion.GetSize()[dim]>1)
{
inputFinalIndex[dim] = largestInputRegion.GetIndex()[dim]+1;
inputFinalSize[dim] = 0;
}
else
{
inputFinalIndex[dim] = largestInputRegion.GetIndex()[dim];
inputFinalSize[dim] = largestInputRegion.GetSize()[dim];
}
}
// // build an exception
// itk::InvalidRequestedRegionError e(__FILE__, __LINE__);
// e.SetLocation(ITK_LOCATION);
// e.SetDescription("Requested region is (at least partially) outside the largest possible region.");
// e.SetDataObject(inputPtr);
// throw e;
inputRequestedRegion.SetSize(inputFinalSize);
inputRequestedRegion.SetIndex(inputFinalIndex);
inputPtr->SetRequestedRegion(inputRequestedRegion);
}
}
......
......@@ -126,6 +126,8 @@ otb_add_test(NAME dmTvStreamingWarpImageFilter COMMAND otbTransformTestDriver
5
)
otb_add_test(NAME dmTvStreamingWarpImageFilterEmtpyRegion COMMAND otbTransformTestDriver
otbStreamingWarpImageFilterEmptyRegion)
# Forward / Backward projection consistency checking
set(FWDBWDChecking_INPUTS
......
......@@ -25,6 +25,17 @@
#include "otbImageFileWriter.h"
#include "otbStreamingWarpImageFilter.h"
// Images definition
const unsigned int Dimension = 2;
typedef double PixelType;
typedef otb::Image<PixelType, Dimension> ImageType;
typedef itk::Vector<PixelType, 2> DisplacementValueType;
typedef otb::Image<DisplacementValueType, Dimension> DisplacementFieldType;
// Warper
typedef otb::StreamingWarpImageFilter<ImageType, ImageType, DisplacementFieldType> ImageWarperType;
int otbStreamingWarpImageFilter(int argc, char* argv[])
{
if (argc != 5)
......@@ -39,20 +50,11 @@ int otbStreamingWarpImageFilter(int argc, char* argv[])
const char * outfname = argv[3];
const double maxdef = atoi(argv[4]);
// Images definition
const unsigned int Dimension = 2;
typedef double PixelType;
typedef otb::Image<PixelType, Dimension> ImageType;
typedef itk::Vector<PixelType, 2> DisplacementValueType;
typedef otb::Image<DisplacementValueType, Dimension> DisplacementFieldType;
// Change default output origin
ImageType::PointType origin;
origin.Fill(0.5);
// Warper
typedef otb::StreamingWarpImageFilter<ImageType, ImageType, DisplacementFieldType> ImageWarperType;
// Reader/Writer
typedef otb::ImageFileReader<ImageType> ReaderType;
typedef otb::ImageFileReader<DisplacementFieldType> DisplacementReaderType;
......@@ -83,3 +85,72 @@ int otbStreamingWarpImageFilter(int argc, char* argv[])
return EXIT_SUCCESS;
}
int otbStreamingWarpImageFilterEmptyRegion(int itkNotUsed(argc), char * itkNotUsed(argv) [])
{
ImageType:: Pointer inputPtr = ImageType::New();
ImageType::RegionType largestRegion;
ImageType::SizeType largestSize = {{10,10}};
ImageType::IndexType largestIndex = {{1,1}};
largestRegion.SetIndex(largestIndex);
largestRegion.SetSize(largestSize);
inputPtr->SetRegions(largestRegion);
ImageType::RegionType emptyRegion;
ImageType::SizeType emptySize = {{0,0}};
ImageType::IndexType emptyIndex = {{0,0}};
emptyRegion.SetSize(emptySize);
emptyRegion.SetIndex(emptyIndex);
inputPtr->SetRequestedRegion(emptyRegion);
inputPtr->SetBufferedRegion(emptyRegion);
DisplacementFieldType::Pointer dispPtr = DisplacementFieldType::New();
dispPtr->SetRegions(largestRegion);
dispPtr->Allocate();
DisplacementValueType v;
v[0]=-100;
v[1]=-100;
dispPtr->FillBuffer(v);
ImageWarperType::Pointer warper = ImageWarperType::New();
warper->SetDisplacementField(dispPtr);
warper->SetInput(inputPtr);
ImageType::PointType outputOrigin;
outputOrigin.Fill(0);
warper->SetOutputOrigin(outputOrigin);
// requested region for full output is completely outside largest
// possible region of input
warper->GetOutput()->UpdateOutputInformation();
// Before bugfix this would lead to famous ITK exception outside of
// largest possible region
warper->GetOutput()->PropagateRequestedRegion();
// After requested region has been propagated, we need to be sure
// that requested region can be cropped by largest region
auto requestedRegion = inputPtr->GetRequestedRegion();
if (! requestedRegion.Crop(inputPtr->GetLargestPossibleRegion()) )
{
std::cerr<<"Requested region can not be cropped by largest region"<<std::endl;
return EXIT_FAILURE;
}
// And we also need to check that requested region is not largest
// region
if( inputPtr->GetRequestedRegion().GetNumberOfPixels() != 0)
{
std::cerr<<"Requested region should have {{0, 0}} size"<<std::endl;
return EXIT_FAILURE;
}
return EXIT_SUCCESS;
}
......@@ -31,6 +31,7 @@ void RegisterTests()
REGISTER_TEST(otbCreateProjectionWithOTB);
REGISTER_TEST(otbGenericMapProjection);
REGISTER_TEST(otbStreamingWarpImageFilter);
REGISTER_TEST(otbStreamingWarpImageFilterEmptyRegion);
REGISTER_TEST(otbInverseLogPolarTransform);
REGISTER_TEST(otbInverseLogPolarTransformResample);
REGISTER_TEST(otbStreamingResampleImageFilterWithAffineTransform);
......
/*=========================================================================
Program: ORFEO Toolbox
Language: C++
Date: $Date$
Version: $Revision$
Copyright (c) Centre National d'Etudes Spatiales. All rights reserved.
See OTBCopyright.txt for details.
This software is distributed WITHOUT ANY WARRANTY; without even
the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
PURPOSE. See the above copyright notices for more information.
/*
* 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.
*/
=========================================================================*/
#ifndef otbBinaryFunctorImageFilter_h
#define otbBinaryFunctorImageFilter_h
......
/*=========================================================================
Program: ORFEO Toolbox
Language: C++
Date: $Date$
Version: $Revision$
Copyright (c) Centre National d'Etudes Spatiales. All rights reserved.
See OTBCopyright.txt for details.
This software is distributed WITHOUT ANY WARRANTY; without even
the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
PURPOSE. See the above copyright notices for more information.
/*
* 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
*