image

Image class and relative functions

Defines the Image class and functions that operate on it.

CLASSES

Image

Subclass of numpy ndarray. Has the additional attribute properties which contains the properties used to generate it as a list of dicts.

Functions

pad_image_to_fft(image: Image, axes = (0, 1))

Pads the image with zeros to optimize the speed of Fast Fourier Transforms.

Module classes

Image

class deeptrack.image.Image

Subclass of numpy ndarray

The class Image is used by features to resolve images and store the current values of the properties of each feature in the feature series. These properties are stored in the field properties as a list of dictionaries, in the same order as that in which the features have been evaluated.

The field properties is used to store and extract information about how an image has been generated.

Parameters
  • input_array (array_like) – An array_like object that is used to instantiate the ndarray.

  • properties (list of dicts, optional) – Optional parameter to set as the initial value for the field properties.

properties

List of dictionaries of the current value of all properties of the features used to resolve the image.

Type

list

append(property_dict: dict)

Appends a dictionary to the properties list.

Parameters

property_dict (dict) – A dictionary to append to the property list. Most commonly the current values of the properties of a feature.

Returns

Returns itself.

Return type

Image

get_property(key: str, get_one: bool = True, default: any = None) → list

Retrieve a property.

If the feature has the property defined by key, return its current_value. Otherwise, return default. If get_one is True, the first instance is returned; otherwise, all instances are returned as a list.

Parameters
  • key – The name of the property.

  • get_one (optional) – Whether to return all instances of that property or just the first.

  • default (optional) – What is returned if the property is not found.

Returns

The value of the property if found, else default.

Return type

any

merge_properties_from(other: deeptrack.image.Image) → deeptrack.image.Image

Merge properties with those from another Image.

Appends properties from another images such that no property is duplicated. Uniqueness of a dictionary of properties is determined from the property hash_key.

Most functions involving two images should automatically output an image with merged properties. However, since each property is guaranteed to be unique, it is safe to manually call this function if there is any uncertainty.

Parameters

other – The Image to retrieve properties from.

Module functions

pad_image_to_fft

deeptrack.image.pad_image_to_fft(image: deeptrack.image.Image, axes=(0, 1)) → deeptrack.image.Image

Pads image to speed up fast fourier transforms. Pads image to speed up fast fourier transforms by adding 0s to the end of the image.

Parameters
  • image – The image to pad

  • axes (iterable of int, optional) – The axes along which to pad.