Image Table¶
Every camera trap image that has been taken is documented in this table.
Table Set Up¶
| Column Name | Content | Type | Unique | Nullable | Custom Constraints | Linked Table |
|---|---|---|---|---|---|---|
| ID | ID for Entry | Integer | True | False | ||
| Name | Content Cell | String(255) | True | False | ||
| FolderPath | Content Cell | String(255) | False | False | ||
| Session | camera trap session the image belongs to | Integer | False | False | Sessions ("ID") | |
| DateTimeRaw | time stamp from image metadata | DateTime | False | True, but warning will be given | ||
| DateTimeCorrected | adjusted time stamp if there was an issue with DateTimeRaw | False | False | True | ||
| SequenceIdx | position in order that the images were taken | Integer | False | True |
Functions¶
Test code for each function of the Images table is shown in Functions_Images.ipynb
In order to use the class functions, an instance of the class needs to be created
import T_Tables as tableClasses
#create class instance
Images = tableClasses.T_Images()
add¶
This function adds a singular image to the database.
Images.add(name: str, sessionName: str, folderPath: str = None, dateTimeRaw: datetime = None,dateTimeCorrected: datetime = None, sequenceIdx: int = None)
Parameters
- name: unique name of the image
- sessionName: name of the session the image belongs to
- folderPath: path to folder the image is stored in
- dateTimeRaw metadata time stamp of the image
- dateTimeCorrected newly calculated time stamp if dateTimeRaw is incorrect due to malfunctioning of cameratraps, etc.
- sequenceIdx position within the order that the images were taken by the camera trap
Returns
The function returns nothing.
addBatch¶
This function adds several images at a time.
Images.addBatch(df: pd.DataFrame)
Parameters
- df: dataframe with the following columns (names need to match the ones given below):
- required columns: Name, Session, DateTimeRaw
- optional columns: FolderPath, DateTimeCorrected, SequenceIdx
Returns
The function returns nothing.
update¶
This function allows you to update information of a given column for one entry
Images.update(name, colName: str, value)
Parameters
- name: name of the image you wish to update
- colName: name of the column where you wish to update the value
- value: new value of given column. Make sure that the value matched the data type of the column
Returns
The function returns nothing.
delete¶
This function deletes a singular image from the database. Note, that an Image cannot be deleted if it has been tagged, without its tag being removed first.
Images.delete(name: str)
Parameters
- name: name of the image you wish to delete
Returns
The function returns nothing.
deleteWithTags¶
This function deletes an image and all associated tags from the database.
Images.deleteWithTags(name: str)
Parameters
- name: name of the image you wish to delete
Returns
The function returns nothing. It prints which images have been deleted and the associated tags that have been deleted as well.
get¶
This function gets all information for one image.
Images.get(name: str)
Parameters
- name: name of the image you wish to get information for
Returns
This function returns a pd.dataframe with one row.
getBatch¶
This function gets all information for a list of images.
Images.getBatch(names: list)
Parameters
- names: list of names of the image you wish to get information for
Returns
This function returns a pd.dataframe with one row for each requested image.
getAll¶
This function gets all information for a all images.
Images.getAll()
Parameters
This Function has no parameters.
Returns
This function returns a pd.dataframe with one row for each documented image.
getSessionImages¶
This function gets all information for all images in a specific session.
Images.getSessionImages(sessionName: str)
Parameters
- sessionName: name of the session, for which you wish to have all image information. It has to be an already documented session.
Returns
This function returns a pd.dataframe with one row for each image for the session.