From 94d5e24b48de6d0289a3856dd56fffc3dfd1ea45 Mon Sep 17 00:00:00 2001
From: Cresson Remi <remi.cresson@irstea.fr>
Date: Tue, 10 Oct 2023 09:55:03 +0200
Subject: [PATCH 1/9] DOC: add otbtf/keras tutorial link

---
 doc/index.md | 1 +
 1 file changed, 1 insertion(+)

diff --git a/doc/index.md b/doc/index.md
index 3be4ae46..87c42d45 100644
--- a/doc/index.md
+++ b/doc/index.md
@@ -99,6 +99,7 @@ Every one can **contribute** to OTBTF. Just open a PR :)
 
 ## Additional resources
 
+- The [otbtf/keras tutorial](https://github.com/remicres/otbtf_keras_tutorial) shows how to create a dataset, build, train, evaluate, and apply a model to perform semantic segmentation of a remote sensing image,
 - The [*test* folder](https://github.com/remicres/otbtf/tree/master/test/) 
 of this repository contains various use-cases with commands, python codes, and 
 input/baseline data,
-- 
GitLab


From 6a702257dbe7555c6e9925bf9269ac21cb496f4e Mon Sep 17 00:00:00 2001
From: Cresson Remi <remi.cresson@irstea.fr>
Date: Thu, 19 Oct 2023 11:56:45 +0200
Subject: [PATCH 2/9] COMP: update OTB version

---
 .gitlab-ci.yml                   |  2 +-
 Dockerfile                       |  2 +-
 doc/docker_use.md                | 18 ++++++++++++------
 setup.py                         |  2 +-
 tools/docker/build-deps-gui.txt  |  2 +-
 tools/docker/build-flags-otb.txt |  9 ---------
 6 files changed, 16 insertions(+), 19 deletions(-)

diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index 20f63775..dc606485 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -1,5 +1,5 @@
 variables:
-  OTBTF_VERSION: 4.2.1
+  OTBTF_VERSION: 4.2.2
   OTB_BUILD: /src/otb/build/OTB/build  # Local OTB build directory
   OTBTF_SRC: /src/otbtf  # Local OTBTF source directory
   OTB_TEST_DIR: $OTB_BUILD/Testing/Temporary  # OTB testing directory
diff --git a/Dockerfile b/Dockerfile
index b4280b2d..8d1ee2ab 100644
--- a/Dockerfile
+++ b/Dockerfile
@@ -98,7 +98,7 @@ RUN cd tensorflow \
 ### OTB
 
 ARG GUI=false
-ARG OTB=8.1.2
+ARG OTB=d74ab47d4308591db4ed5a5ea3b820cef73a39fe
 ARG OTBTESTS=false
 
 RUN mkdir /src/otb
diff --git a/doc/docker_use.md b/doc/docker_use.md
index 1194b35e..b5032057 100644
--- a/doc/docker_use.md
+++ b/doc/docker_use.md
@@ -25,12 +25,12 @@ Since OTBTF >= 3.2.1 you can find the latest docker images on
 
 | Name                                                                               | Os            | TF    | OTB   | Description            | Dev files | Compute capability |
 |------------------------------------------------------------------------------------| ------------- |-------|-------| ---------------------- | --------- | ------------------ |
-| **mdl4eo/otbtf:4.2.1-cpu**                                                         | Ubuntu Jammy  | r2.12 | 8.1.2 | CPU, no optimization   | no        | 5.2,6.1,7.0,7.5,8.6|
-| **mdl4eo/otbtf:4.2.1-cpu-dev**                                                     | Ubuntu Jammy  | r2.12 | 8.1.2 | CPU, no optimization (dev) |  yes  | 5.2,6.1,7.0,7.5,8.6|
-| **mdl4eo/otbtf:4.2.1-gpu**                                                         | Ubuntu Jammy  | r2.12 | 8.1.2 | GPU, no optimization   | no        | 5.2,6.1,7.0,7.5,8.6|
-| **mdl4eo/otbtf:4.2.1-gpu-dev**                                                     | Ubuntu Jammy  | r2.12 | 8.1.2 | GPU, no optimization (dev) | yes   | 5.2,6.1,7.0,7.5,8.6|
-| **gitlab.irstea.fr/remi.cresson/otbtf/container_registry/otbtf:4.2.1-gpu-opt**     | Ubuntu Jammy  | r2.12 | 8.1.2 | GPU with opt.          | no        | 5.2,6.1,7.0,7.5,8.6|
-| **gitlab.irstea.fr/remi.cresson/otbtf/container_registry/otbtf:4.2.1-gpu-opt-dev** | Ubuntu Jammy  | r2.12 | 8.1.2 | GPU with opt. (dev)    | yes       | 5.2,6.1,7.0,7.5,8.6|
+| **mdl4eo/otbtf:4.2.2-cpu**                                                         | Ubuntu Jammy  | r2.12 | d74ab | CPU, no optimization   | no        | 5.2,6.1,7.0,7.5,8.6|
+| **mdl4eo/otbtf:4.2.2-cpu-dev**                                                     | Ubuntu Jammy  | r2.12 | d74ab | CPU, no optimization (dev) |  yes  | 5.2,6.1,7.0,7.5,8.6|
+| **mdl4eo/otbtf:4.2.2-gpu**                                                         | Ubuntu Jammy  | r2.12 | d74ab | GPU, no optimization   | no        | 5.2,6.1,7.0,7.5,8.6|
+| **mdl4eo/otbtf:4.2.2-gpu-dev**                                                     | Ubuntu Jammy  | r2.12 | d74ab | GPU, no optimization (dev) | yes   | 5.2,6.1,7.0,7.5,8.6|
+| **gitlab.irstea.fr/remi.cresson/otbtf/container_registry/otbtf:4.2.2-gpu-opt**     | Ubuntu Jammy  | r2.12 | d74ab | GPU with opt.          | no        | 5.2,6.1,7.0,7.5,8.6|
+| **gitlab.irstea.fr/remi.cresson/otbtf/container_registry/otbtf:4.2.2-gpu-opt-dev** | Ubuntu Jammy  | r2.12 | d74ab | GPU with opt. (dev)    | yes       | 5.2,6.1,7.0,7.5,8.6|
 
 The list of older releases is available [here](#older-images).
 
@@ -178,4 +178,10 @@ Here you can find the list of older releases of OTBTF:
 | **mdl4eo/otbtf:4.2.0-gpu-dev**                                                     | Ubuntu Jammy  | r2.12 | 8.1.0 | GPU, no optimization (dev) | yes   | 5.2,6.1,7.0,7.5,8.6|
 | **gitlab.irstea.fr/remi.cresson/otbtf/container_registry/otbtf:4.2.0-gpu-opt**     | Ubuntu Jammy  | r2.12 | 8.1.0 | GPU with opt.          | no        | 5.2,6.1,7.0,7.5,8.6|
 | **gitlab.irstea.fr/remi.cresson/otbtf/container_registry/otbtf:4.2.0-gpu-opt-dev** | Ubuntu Jammy  | r2.12 | 8.1.0 | GPU with opt. (dev)    | yes       | 5.2,6.1,7.0,7.5,8.6|
+| **mdl4eo/otbtf:4.2.1-cpu**                                                         | Ubuntu Jammy  | r2.12 | 8.1.2 | CPU, no optimization   | no        | 5.2,6.1,7.0,7.5,8.6|
+| **mdl4eo/otbtf:4.2.1-cpu-dev**                                                     | Ubuntu Jammy  | r2.12 | 8.1.2 | CPU, no optimization (dev) |  yes  | 5.2,6.1,7.0,7.5,8.6|
+| **mdl4eo/otbtf:4.2.1-gpu**                                                         | Ubuntu Jammy  | r2.12 | 8.1.2 | GPU, no optimization   | no        | 5.2,6.1,7.0,7.5,8.6|
+| **mdl4eo/otbtf:4.2.1-gpu-dev**                                                     | Ubuntu Jammy  | r2.12 | 8.1.2 | GPU, no optimization (dev) | yes   | 5.2,6.1,7.0,7.5,8.6|
+| **gitlab.irstea.fr/remi.cresson/otbtf/container_registry/otbtf:4.2.1-gpu-opt**     | Ubuntu Jammy  | r2.12 | 8.1.2 | GPU with opt.          | no        | 5.2,6.1,7.0,7.5,8.6|
+| **gitlab.irstea.fr/remi.cresson/otbtf/container_registry/otbtf:4.2.1-gpu-opt-dev** | Ubuntu Jammy  | r2.12 | 8.1.2 | GPU with opt. (dev)    | yes       | 5.2,6.1,7.0,7.5,8.6|
 
diff --git a/setup.py b/setup.py
index e2ac3e5c..6c985eb0 100644
--- a/setup.py
+++ b/setup.py
@@ -6,7 +6,7 @@ with open("README.md", "r", encoding="utf-8") as fh:
 
 setuptools.setup(
     name="otbtf",
-    version="4.2.1",
+    version="4.2.2",
     author="Remi Cresson",
     author_email="remi.cresson@inrae.fr",
     description="OTBTF: Orfeo ToolBox meets TensorFlow",
diff --git a/tools/docker/build-deps-gui.txt b/tools/docker/build-deps-gui.txt
index af6f6b8f..1f1f6cf9 100644
--- a/tools/docker/build-deps-gui.txt
+++ b/tools/docker/build-deps-gui.txt
@@ -10,4 +10,4 @@ libxi-dev
 qtbase5-dev
 qttools5-dev
 qttools5-dev-tools
-xvfb
\ No newline at end of file
+xvfb
diff --git a/tools/docker/build-flags-otb.txt b/tools/docker/build-flags-otb.txt
index f72d7c7b..95b8462c 100644
--- a/tools/docker/build-flags-otb.txt
+++ b/tools/docker/build-flags-otb.txt
@@ -17,12 +17,3 @@
 -DUSE_SYSTEM_TINYXML=ON
 -DUSE_SYSTEM_ZLIB=ON
 -DUSE_SYSTEM_SWIG=ON
-
--DOTB_USE_QT=OFF
--DOTB_USE_OPENGL=OFF
--DOTB_USE_GLUT=OFF
--DOTB_USE_GLEW=OFF
--DOTB_USE_GLFW=OFF
-
--DGDAL_SB_EXTRA_OPTIONS=--with-geos
-
-- 
GitLab


From dd55c93daceb61b9ca0e029b6c6ec4271a9ddaf7 Mon Sep 17 00:00:00 2001
From: Cresson Remi <remi.cresson@irstea.fr>
Date: Thu, 19 Oct 2023 15:27:13 +0200
Subject: [PATCH 3/9] Update RELEASE_NOTES.txt

---
 RELEASE_NOTES.txt | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/RELEASE_NOTES.txt b/RELEASE_NOTES.txt
index 219aa15b..2b711768 100644
--- a/RELEASE_NOTES.txt
+++ b/RELEASE_NOTES.txt
@@ -1,3 +1,7 @@
+Version 4.2.2 (19 oct 2023)
+----------------------------------------------------------------
+* Move to OTB version d74ab47d4308591db4ed5a5ea3b820cef73a39fe since 8.2.1 looks not up-to-date
+
 Version 4.2.1 (5 oct 2023)
 ----------------------------------------------------------------
 * Fix a bug occuring when input images origins were not sharing the same pixel grid
-- 
GitLab


From 6ed5468681e1c5047cfbe9e2604b1f46c785e71e Mon Sep 17 00:00:00 2001
From: Cresson Remi <remi.cresson@irstea.fr>
Date: Thu, 19 Oct 2023 15:40:17 +0200
Subject: [PATCH 4/9] ADD: planetary computer test

---
 test/pctest.py | 32 ++++++++++++++++++++++++++++++++
 1 file changed, 32 insertions(+)
 create mode 100644 test/pctest.py

diff --git a/test/pctest.py b/test/pctest.py
new file mode 100644
index 00000000..34544d02
--- /dev/null
+++ b/test/pctest.py
@@ -0,0 +1,32 @@
+#!/usr/bin/env python3
+# -*- coding: utf-8 -*-
+import pytest
+import unittest
+import planetary_computer
+import pystac_client
+import otbApplication
+
+class PCTest(unittest.TestCase):
+
+    def test_pc(self):
+        api = pystac_client.Client.open(
+            'https://planetarycomputer.microsoft.com/api/stac/v1',
+            modifier=planetary_computer.sign_inplace,
+        )
+
+        res = api.search(
+            bbox=[4, 42.99, 4.5, 43.05], 
+            datetime=["2022-01-01", "2022-01-09"],
+            collections=["sentinel-2-l2a"]
+        )
+
+        r = next(res.items())
+        url = r.assets["B04"].href
+        info = otbApplication.Registry.CreateApplication("ReadImageInfo")
+        info.SetParameterString("in", "/vsicurl/" + url)
+        info.Execute()
+        assert len(info.GetParameterString("projectionref")) > 1
+
+
+if __name__ == '__main__':
+    unittest.main()
-- 
GitLab


From 837544ed0640f46d7019c1c7b9da1d8cefda1572 Mon Sep 17 00:00:00 2001
From: Cresson Remi <remi.cresson@irstea.fr>
Date: Thu, 19 Oct 2023 15:40:48 +0200
Subject: [PATCH 5/9] ADD: rename planetary computer test

---
 test/{pctest.py => pc_test.py} | 0
 1 file changed, 0 insertions(+), 0 deletions(-)
 rename test/{pctest.py => pc_test.py} (100%)

diff --git a/test/pctest.py b/test/pc_test.py
similarity index 100%
rename from test/pctest.py
rename to test/pc_test.py
-- 
GitLab


From c31f0030e567b77694737130cb06f995b906e35d Mon Sep 17 00:00:00 2001
From: Cresson Remi <remi.cresson@irstea.fr>
Date: Thu, 19 Oct 2023 15:42:06 +0200
Subject: [PATCH 6/9] CI: add planetary computer test

---
 .gitlab-ci.yml | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index dc606485..bd75a581 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -211,6 +211,11 @@ geos_enabled:
   script:
     - python -m pytest --junitxml=$ARTIFACT_TEST_DIR/report_geos_enabled.xml $OTBTF_SRC/test/geos_test.py
 
+planetary_computer:
+  extends: .applications_test_base
+  script:
+    - python -m pytest --junitxml=$ARTIFACT_TEST_DIR/report_pc_enabled.xml $OTBTF_SRC/test/pc_test.py
+
 imports:
   extends: .applications_test_base
   script:
-- 
GitLab


From 39022f9732ab243010970046fe7a399950fdec24 Mon Sep 17 00:00:00 2001
From: Cresson Remi <remi.cresson@irstea.fr>
Date: Thu, 19 Oct 2023 16:12:10 +0200
Subject: [PATCH 7/9] CI: fix planetary computer test

---
 .gitlab-ci.yml | 1 +
 1 file changed, 1 insertion(+)

diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index bd75a581..57a1aef5 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -214,6 +214,7 @@ geos_enabled:
 planetary_computer:
   extends: .applications_test_base
   script:
+    - pip install pystac_client planeatry_computer
     - python -m pytest --junitxml=$ARTIFACT_TEST_DIR/report_pc_enabled.xml $OTBTF_SRC/test/pc_test.py
 
 imports:
-- 
GitLab


From f446811fe0047094d427f230c69fc4e531b5d60a Mon Sep 17 00:00:00 2001
From: Cresson Remi <remi.cresson@irstea.fr>
Date: Thu, 19 Oct 2023 16:37:08 +0200
Subject: [PATCH 8/9] DOC: update release notes

---
 RELEASE_NOTES.txt | 1 +
 1 file changed, 1 insertion(+)

diff --git a/RELEASE_NOTES.txt b/RELEASE_NOTES.txt
index 2b711768..8a63b56f 100644
--- a/RELEASE_NOTES.txt
+++ b/RELEASE_NOTES.txt
@@ -1,5 +1,6 @@
 Version 4.2.2 (19 oct 2023)
 ----------------------------------------------------------------
+* Add a test to ensure that planetary computer works in the OTBTF docker image
 * Move to OTB version d74ab47d4308591db4ed5a5ea3b820cef73a39fe since 8.2.1 looks not up-to-date
 
 Version 4.2.1 (5 oct 2023)
-- 
GitLab


From dd43e46728bfaa004f634492cc0a12bfbe68c498 Mon Sep 17 00:00:00 2001
From: Cresson Remi <remi.cresson@irstea.fr>
Date: Thu, 19 Oct 2023 16:37:34 +0200
Subject: [PATCH 9/9] CI: test planetary computer support

---
 .gitlab-ci.yml | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index 57a1aef5..3295b83f 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -214,7 +214,7 @@ geos_enabled:
 planetary_computer:
   extends: .applications_test_base
   script:
-    - pip install pystac_client planeatry_computer
+    - pip install pystac_client planetary_computer
     - python -m pytest --junitxml=$ARTIFACT_TEST_DIR/report_pc_enabled.xml $OTBTF_SRC/test/pc_test.py
 
 imports:
-- 
GitLab