ListOfBlobs#
Warning
The code reference is a work in progress and may contain inconsistencies.
- class idtrackerai.ListOfBlobs(blobs_in_video: list[list[Blob]])[source]#
Contains all the instances of the class
Blob.- blobs_in_video: list[list[Blob]]#
Main and only attribute of the class. For every frame in the video, it contains the list of its
Blobinstances
- classmethod load(file_path: Path | str, verbose: bool = True) ListOfBlobs[source]#
Loads a ListOfBlobs saved in a .pickle file (or in a .npy file from idtracker.ai v4).
- Parameters:
file_path (Path | str) – Path to a saved instance of a ListOfBlobs object
verbose (bool, optional) – Whether to show a progress bar while loading, by default True
- Return type:
- save(file_path: Path | str) None[source]#
Saves the instance with Python’s pickle protocol.
The next links of the blobs are not pickled, they are rebuilt from the previous ones when loading.
- Parameters:
file_path (Path | str) – Path where to save the object
- property number_of_blobs: int#
Total number of Blobs in self
- property number_of_frames: int#
Number of frames in the video, equal to the number of lists of Blobs in self
- compute_overlapping_between_subsequent_frames() None[source]#
Computes overlapping between blobs in consecutive frames.
Two blobs in consecutive frames overlap if their contours overlap.
See also
- disconnect()[source]#
Removes the next links of all blobs, see
reconnect()
- set_images_for_identification(episodes: list[Episode], id_images_files: list[Path], id_image_size: list[int], resolution_reduction: float, n_jobs: int) None[source]#
Computes and saves the images used to classify blobs as crossings and individuals and to identify the animals along the video.
- static set_id_images_per_episode(inputs: tuple[int, Path, float, Episode, list[list[Blob]]]) None[source]#
Computes and saves the identification images of the blobs in one episode
- remove_centroid(frame_number: int, centroid_to_remove, id_to_remove)[source]#
[Validation] Removes the centroid with identity id_to_remove located at centroid_to_remove in the given frame.
- update_centroid(frame_number: int, centroid_id: int, old_centroid, new_centroid)[source]#
[Validation] Moves the centroid with identity centroid_id closest to old_centroid to new_centroid in the given frame.
- add_centroid(frame_number: int, identity: int, centroid)[source]#
[Validation] Adds a centroid to the blob containing it (or to the closest one). A new blob is created if the frame has none.
- add_blob(frame_number: int, centroid: tuple, identity: int)[source]#
[Validation] Adds a new Blob to a frame.
Adds a Blob object to a given frame_number with a given centroid and identity. Its contour is a small square around the centroid. Note that this Blob won’t have most of the features (e.g. area, contour, fragment_identifier, bbox, …). It is only intended to be used for validation and correction of trajectories. The new blobs generated are considered to be individuals.
- Parameters:
frame_number (int) – Frame in which the new blob will be added
centroid (tuple) – The centroid of the new blob
identity (int) – Identity of the new blob
- property max_number_of_blobs_in_one_frame#
Max number of blobs in one frame
Deprecated since version 6.0.0: Use max(map(len, ListOfBlobs.blobs_in_video)) instead
- load_from_v4()[source]#
Load from v4
Deprecated since version 6.0.0: Loading ListOfBlobs from v4 is not supported anymore