brails.types.image_set module

This module contains classes for managing and manipulating image sets.

Classes:
  • Image: A class to represent an individual image.

  • ImageSet: A class for handling collections of images.

Image(filename[, properties])

A class to represent an image.

ImageSet()

A class representing a set of images.

class brails.types.image_set.Image(filename: str, properties: dict | None = None)

Bases: object

A class to represent an image.

Attributes:

filename (str): filename of image properties (dict): properties of image if known, i.e., camera

location, depth map

Methods:

set_image: Set the filename for an Image. update_properties: Update image properties. print_info: Print Image properties.

print_info()

Print Image properties.

set_image(filename: str)

Set the filename for an Image.

Args:

filename (str): New filename.

update_properties(additional_properties: dict)

Update Image properties.

Args: additional_properties (dict): additional properties to update the

current Image properties

class brails.types.image_set.ImageSet

Bases: object

A class representing a set of images.

Attributes:
dir_path (str):

A path to image directory if images all in same location.

images (dict):

A dict of all images, key is the id for the image, value is an Image

Methods:

set_directory: Set the directory path and load existing images. add_image: Create and add a new image to the ImageSet. get_image: Retrieve an image by its key. print_info: Print details of the image set.

add_image(key: str | int, filename: str, properties: dict | None = None)

Create and add a new image to the ImageSet.

Args:

key (str|int): The identifier for the image. filename (str): The name of the file containing the image. properties (dict): Image properties (default is an empty dict).

Returns:

bool: True if Image is added, False if Image already exists.

get_image(key: str | int)

Get an image.

Args:

key (str|int): The identifier for the image.

Returns:
Image:

The image or None if no image with key

print_info()

Print the image set.

set_directory(path_to_dir: str, include_existing_images: bool = False, limited_to_extension_types=None)

Set the directory path.

Args:
path_to_dir (str):

The path to the directory.

include_existing_images(bool):

Boolean to indicate if all files in path_to_dir should be added in self.images.

limited_to_extension_types (list):

if include_existing_images will only include files with specific extensions in list, default is None, i.e. include all files

Returns:
bool:

True if the directory exists and is valid, False otherwise.