Database

Database are generated by the rendering module, and contains all images and there corresponding position-orientations.

  • position_orientation: containing all position and orientation of where images were rendered. The position-orientation is described by [‘x’,’y’,’z’,’alpha_0’,’alpha_1’,’alpha_2’]
  • image: containing all images ever rendered. Each channel of each image are normalised, so to use the full coding range.
  • normalisation: the normalisation constantes

How to load a database

from database import DataBaseLoad
mydb_filename = 'database.db'
mydb = DataBaseLoad(mydb_filename)

How to load all position-orientation

The database contains all position-orientation at which an image as been rendered. In certain situation, it may be usefull to know all position-orientation in the database. More technically speaking, loading the full table of position-orientaiton.

posorients = mydb.get_posorients()
posorients.head()

How to load an image

The database contains images which can be processed differently depending on the navigation strategy beeing used.

Images are at given position-orientations. To load an image the position-orientation can be given. The DataBaseLoader will look if this position-orientation has been rendered. If it is the case, the image will be returned.

posorient = pd.Series(index=['x', 'y', 'z',
                          'alpha_0', 'alpha_1', 'alpha_2'])
posorient.x = -0.6
posorient.y = -7.2
posorient.z = 2.35
posorient.alpha_0 = np.pi / 2
posorient.alpha_1 = 0
posorient.alpha_2 = 0
image = mydb.read_image(posorient=posorient)

(Source code, png, hires.png, pdf)

_images/load_image_posorient.png

However, looking in the database if an image has already been rendered at a given position-orientation can cost time. To speed up certain calculation, image can instead be access by row number. Indeed each position-orientation can be identified by a unique row number. This number is consistant through the entire database. Thus, an image can be loaded by providing the row number.

rowid = 1000
image = mydb.read_image(rowid=rowid)

(Source code, png, hires.png, pdf)

_images/load_image_rowid.png

A database generated by the rendering module is based on sqlite3.

use to decide weather to alter the database or not return False because we do not want to write on database (Load class)

Iter through all position orientation in the database

Return the position orientations of all points in the database