diplomat.utils.frame_store_fmt.DLFSReader

class diplomat.utils.frame_store_fmt.DLFSReader(file: BinaryIO)[source]

Bases: FrameReader

A DeepLabCut Frame Store Reader. Allows for reading “.dlfs” files.

__init__(file: BinaryIO)[source]

Create a new DeepLabCut Frame Store Reader.

Parameters

file – The binary file object to read a frame store from, file opened with ‘rb’.

Methods

__init__(file)

Create a new DeepLabCut Frame Store Reader.

close()

Close this frame reader, cleaning up any resources used during reading from the file.

get_header()

Get the header of this Diplomat frame store file.

has_next([num_frames])

Checks if this frame store object at least num_frames more frames to be read.

read_frames([num_frames])

Read the next num_frames frames from this frame store object and returns a TrackingData object.

seek_frame(frame_idx)

Make this frame reader seek to the given frame index.

tell_frame()

Get the current frame the frame reader is on.

Attributes

HEADER_DATA_TYPES

HEADER_OFFSETS

close()[source]

Close this frame reader, cleaning up any resources used during reading from the file. Does not close the passed file handle!

get_header() DLFSHeader[source]

Get the header of this Diplomat frame store file.

Returns

A DLFSHeader object, contains important metadata info from this frame store.

has_next(num_frames: int = 1) bool[source]

Checks if this frame store object at least num_frames more frames to be read.

Parameters

num_frames – An Integer, The number of frames to check the availability of, defaults to 1.

Returns

True if there are at least num_frames more frames to be read, otherwise False.

read_frames(num_frames: int = 1) TrackingData[source]

Read the next num_frames frames from this frame store object and returns a TrackingData object.

Parameters

num_frames – The number of frames to read from the frame store.

Returns

A TrackingData object storing all frame info that was stored in this Diplomat Frame Store….

Raises

An EOFError if more frames were requested then were available.

seek_frame(frame_idx: int)[source]

Make this frame reader seek to the given frame index.

Parameters

frame_idx – An integer, the frame index to have this frame reader seek to. Must land within the valid frame range for this file, being 0 to frame_count - 1.

tell_frame() int[source]

Get the current frame the frame reader is on.

Returns

An integer, being the current frame the DLFSReader will read next.