From b52f318b77dcf23f53aa78c46d15b3c193531349 Mon Sep 17 00:00:00 2001
From: Yannick DAYER <yannick.dayer@idiap.ch>
Date: Thu, 15 Oct 2020 20:45:46 +0200
Subject: [PATCH] [py] Adaptation of the databases to bob pipelines.

---
 bob/bio/vein/configurations/fv3d.py       | 33 ++++++++++++----------
 bob/bio/vein/configurations/putvein.py    | 29 +++++++++++++------
 bob/bio/vein/configurations/utfvp.py      | 34 ++++++++++++++---------
 bob/bio/vein/configurations/verafinger.py | 20 ++++++-------
 4 files changed, 69 insertions(+), 47 deletions(-)

diff --git a/bob/bio/vein/configurations/fv3d.py b/bob/bio/vein/configurations/fv3d.py
index ea14eca..f103749 100644
--- a/bob/bio/vein/configurations/fv3d.py
+++ b/bob/bio/vein/configurations/fv3d.py
@@ -11,17 +11,28 @@ the link.
 """
 
 
+from bob.extension import rc
 from ..database.fv3d import Database
+from bob.bio.base.pipelines.vanilla_biometrics import DatabaseConnector
 
-_fv3d_directory = "[YOUR_FV3D_DIRECTORY]"
-"""Value of ``~/.bob_bio_databases.txt`` for this database"""
+_fv3d_directory = rc["bob.db.fv3d.directory"]
+"""Value in ``~/.bobrc`` for this dataset directory"""
 
-database = Database(
+legacy_database = Database(
     original_directory = _fv3d_directory,
     original_extension = '.png',
-    )
+)
 """The :py:class:`bob.bio.base.database.BioDatabase` derivative with fv3d
 database settings
+"""
+
+database = DatabaseConnector(
+    legacy_database,
+    annotation_type=None,
+    fixed_positions=None
+)
+"""
+The database interface wrapped for vanilla-biometrics
 
 .. warning::
 
@@ -29,16 +40,10 @@ database settings
    manner, respecting usage protocols. It does **not** contain the raw
    datafiles. You should procure those yourself.
 
-Notice that ``original_directory`` is set to ``[YOUR_FV3D_DIRECTORY]``. You
-must make sure to create ``${HOME}/.bob_bio_databases.txt`` setting this value
-to the place where you actually installed the `3D Fingervein`_ Database, as
+Notice that ``original_directory`` is set to ``rc[bob.db.fv3d.directory]``. You
+must make sure to set this value with ``bob config set bob.db.fv3d.directory``
+to the place where you actually installed the `3D Fingervein`_ dataset, as
 explained in the section :ref:`bob.bio.vein.baselines`.
 """
 
-protocol = 'central'
-"""The default protocol to use for tests
-
-You may modify this at runtime by specifying the option ``--protocol`` on the
-command-line of ``verify.py`` or using the keyword ``protocol`` on a
-configuration file that is loaded **after** this configuration resource.
-"""
+protocol = 'central' # TODO protocol implementation in bob pipelines?
diff --git a/bob/bio/vein/configurations/putvein.py b/bob/bio/vein/configurations/putvein.py
index f8e2325..3d2132f 100644
--- a/bob/bio/vein/configurations/putvein.py
+++ b/bob/bio/vein/configurations/putvein.py
@@ -16,17 +16,29 @@ You can download the raw data of the `PUT Vein`_ database by following
 the link.
 """
 
+from bob.extension import rc
 from ..database.putvein import PutveinBioDatabase
+from bob.bio.base.pipelines.vanilla_biometrics import DatabaseConnector
 
-_putvein_directory = "[YOUR_PUTVEIN_IMAGE_DIRECTORY]"
-"""Value of ``~/.bob_bio_databases.txt`` for this database"""
+_putvein_directory = rc["bob.db.putvein.directory"]
+"""Value in ``~/.bobrc`` for this dataset directory"""
 
-database = PutveinBioDatabase(
+legacy_database = PutveinBioDatabase(
     original_directory = _putvein_directory,
     original_extension = '.bmp',
     )
 """The :py:class:`bob.bio.base.database.BioDatabase` derivative with PUT Vein
 database settings
+"""
+
+database = DatabaseConnector(
+    legacy_database,
+    annotation_type=None,
+    fixed_positions=None
+)
+
+"""
+The database interface wrapped for vanilla-biometrics
 
 .. warning::
 
@@ -34,13 +46,14 @@ database settings
    manner, respecting usage protocols. It does **not** contain the raw
    datafiles. You should procure those yourself.
 
-Notice that ``original_directory`` is set to ``[YOUR_PUTVEIN_IMAGE_DIRECTORY]``.
-You must make sure to create ``${HOME}/.bob_bio_databases.txt`` setting this
-value to the place where you actually installed the PUT Vein Database, as
-explained in the section :ref:`bob.bio.vein.baselines`.
+Notice that ``original_directory`` is set to ``rc[bob.db.putvein.directory]``.
+You must make sure to set this value with
+``bob config set bob.db.putvein.directory`` to the place where you actually
+installed the `put vein`_ dataset, as explained in the section
+:ref:`bob.bio.vein.baselines`.
 """
 
-protocol = 'wrist-LR_1'
+protocol = 'wrist-LR_1' # TODO protocol implementation in bob pipelines?
 """The default protocol to use for tests
 
 You may modify this at runtime by specifying the option ``--protocol`` on the
diff --git a/bob/bio/vein/configurations/utfvp.py b/bob/bio/vein/configurations/utfvp.py
index 216c485..4285598 100644
--- a/bob/bio/vein/configurations/utfvp.py
+++ b/bob/bio/vein/configurations/utfvp.py
@@ -17,16 +17,27 @@ You can download the raw data of the `UTFVP`_ database by following the link.
 .. include:: links.rst
 """
 
+from bob.extension import rc
 from ..database.utfvp import Database
+from bob.bio.base.pipelines.vanilla_biometrics import DatabaseConnector
 
-_utfvp_directory = "[YOUR_UTFVP_DIRECTORY]"
-"""Value of ``~/.bob_bio_databases.txt`` for this database"""
+_utfvp_directory = rc["bob.db.utfvp.directory"]
+"""Value in ``~/.bobrc`` for this dataset directory"""
 
-database = Database(
+legacy_database = Database(
     original_directory = _utfvp_directory,
     original_extension = '.png',
     )
 """The :py:class:`bob.bio.base.database.BioDatabase` derivative with UTFVP settings
+"""
+
+database = DatabaseConnector(
+    legacy_database,
+    annotation_type=None,
+    fixed_positions=None
+)
+"""
+The database interface wrapped for vanilla-biometrics
 
 .. warning::
 
@@ -34,16 +45,13 @@ database = Database(
    manner, respecting usage protocols. It does **not** contain the raw
    datafiles. You should procure those yourself.
 
-Notice that ``original_directory`` is set to ``[YOUR_UTFVP_DIRECTORY]``.
-You must make sure to create ``${HOME}/.bob_bio_databases.txt`` setting this
-value to the place where you actually installed the Verafinger Database, as
-explained in the section :ref:`bob.bio.vein.baselines`.
+Notice that ``original_directory`` is set to ``rc[bob.db.utfvp.directory]``.
+You must make sure to set this value with
+``bob config set bob.db.utfvp.directory`` to the place where you actually
+installed the `utfvp`_ dataset, as explained in the section
+:ref:`bob.bio.vein.baselines`.
 """
 
-protocol = 'nom'
-"""The default protocol to use for tests
 
-You may modify this at runtime by specifying the option ``--protocol`` on the
-command-line of ``verify.py`` or using the keyword ``protocol`` on a
-configuration file that is loaded **after** this configuration resource.
-"""
+
+protocol = 'nom' # TODO protocol implementation in bob pipelines?
diff --git a/bob/bio/vein/configurations/verafinger.py b/bob/bio/vein/configurations/verafinger.py
index a626896..fe102b3 100644
--- a/bob/bio/vein/configurations/verafinger.py
+++ b/bob/bio/vein/configurations/verafinger.py
@@ -17,15 +17,11 @@ from bob.bio.vein.database.verafinger import Database
 from bob.bio.base.pipelines.vanilla_biometrics import DatabaseConnector
 
 _verafinger_directory = rc["bob.db.verafinger.directory"]
-"""Value of ``~/.bobrc`` for this database"""
+"""Value in ``~/.bobrc`` for this dataset directory"""
 
-protocol = 'Nom'
+protocol = 'Nom' # TODO protocol implementation in bob pipelines?
 """The default protocol to use for tests
 
-You may modify this at runtime by specifying the option ``--protocol`` on the
-command-line of ``verify.py`` or using the keyword ``protocol`` on a
-configuration file that is loaded **after** this configuration resource.
-
 We accept any biometric recognition protocol implemented by bob.db.verafinger.
 Variants of the biometric recognition protocol ending in ``-va`` can be used to
 test for vulnerability analysis. For example, use the protocol ``Nom-va`` to
@@ -42,9 +38,8 @@ database = DatabaseConnector(Database(
     annotation_type=None,
     fixed_positions=None
 )
-
 """The :py:class:`bob.bio.base.database.BioDatabase` derivative with Verafinger
-database settings
+database settings, wrapped with the vanilla-biometrics database connector.
 
 .. warning::
 
@@ -52,8 +47,9 @@ database settings
    manner, respecting usage protocols. It does **not** contain the raw
    datafiles. You should procure those yourself.
 
-Notice that ``original_directory`` is set to ``[YOUR_VERAFINGER_DIRECTORY]``.
-You must make sure to create ``${HOME}/.bob_bio_databases.txt`` setting this
-value to the place where you actually installed the Verafinger Database, as
-explained in the section :ref:`bob.bio.vein.baselines`.
+Notice that ``original_directory`` is set to
+``rc[bob.db.verafinger.directory]``. You must make sure to set this value with
+``bob config set bob.db.verafinger.directory`` to the place where you actually
+installed the `vera fingervein`_ dataset, as explained in the section
+:ref:`bob.bio.vein.baselines`.
 """
-- 
GitLab