utfvp.py 1.39 KB
Newer Older
1 2
#!/usr/bin/env python
# vim: set fileencoding=utf-8 :
André Anjos's avatar
André Anjos committed
3
# Fri 04 Nov 2016 14:46:53 CET
4

André Anjos's avatar
André Anjos committed
5
from bob.bio.base.database import BioFile, BioDatabase
6 7


André Anjos's avatar
André Anjos committed
8 9 10 11 12 13 14 15 16 17 18 19 20 21
class File(BioFile):
    """
    Implements extra properties of vein files for the UTFVP Fingervein database


    Parameters:

      f (object): Low-level file (or sample) object that is kept inside

    """

    def __init__(self, f):

        super(File, self).__init__(client_id=f.client_id, path=f.path,
Amir Mohammadi's avatar
Amir Mohammadi committed
22
                                   file_id=f.id)
André Anjos's avatar
André Anjos committed
23 24 25 26
        self.__f = f


class Database(BioDatabase):
27 28 29 30 31 32
    """
    Implements verification API for querying UTFVP Fingervein database.
    """

    def __init__(self, **kwargs):

André Anjos's avatar
André Anjos committed
33
        super(Database, self).__init__(name='utfvp', **kwargs)
34
        from bob.db.utfvp.query import Database as LowLevelDatabase
Amir Mohammadi's avatar
Amir Mohammadi committed
35
        self._db = LowLevelDatabase()
André Anjos's avatar
André Anjos committed
36

37 38
    def model_ids_with_protocol(self, groups=None, protocol=None, **kwargs):
        protocol = protocol if protocol is not None else self.protocol
Amir Mohammadi's avatar
Amir Mohammadi committed
39
        return self._db.model_ids(groups=groups, protocol=protocol)
André Anjos's avatar
André Anjos committed
40

41
    def objects(self, groups=None, protocol=None, purposes=None,
Amir Mohammadi's avatar
Amir Mohammadi committed
42
                model_ids=None, **kwargs):
43

Amir Mohammadi's avatar
Amir Mohammadi committed
44 45
        retval = self._db.objects(groups=groups, protocol=protocol,
                                  purposes=purposes, model_ids=model_ids, **kwargs)
André Anjos's avatar
André Anjos committed
46 47

        return [File(f) for f in retval]
Amir Mohammadi's avatar
Amir Mohammadi committed
48 49 50

    def annotations(self, file):
        return None