Skip to content

pixano.features.schemas.views.sequence_frame

SequenceFrame(created_at=None, updated_at=None, **data)

Bases: Image

Sequence Frame view.

Attributes:

Name Type Description
timestamp float

The timestamp of the frame.

frame_index int

The index of the frame in the sequence.

Source code in pixano/features/schemas/base_schema.py
def __init__(self, /, created_at: datetime | None = None, updated_at: datetime | None = None, **data: Any):
    """Create a new model by parsing and validating input data from keyword arguments.

    Raises [`ValidationError`][pydantic_core.ValidationError] if the input data cannot be
    validated to form a valid model.

    `self` is explicitly positional-only to allow `self` as a field name.

    Args:
        created_at: The creation date of the object.
        updated_at: The last modification date of the object.
        data: The data of the object validated by Pydantic.
    """
    created_at, updated_at = validate_and_init_create_at_and_update_at(created_at, updated_at)
    data.update({"created_at": created_at, "updated_at": updated_at})
    super().__init__(**data)

create_sequence_frame(url, timestamp, frame_index, id='', item_ref=ItemRef.none(), parent_ref=ViewRef.none(), width=None, height=None, format=None, url_relative_path=None)

Create a SequenceFrame instance.

Parameters:

Name Type Description Default
url Path

The frame URL. If not relative, the URL is converted to a relative path using other_path.

required
timestamp float

The timestamp of the frame.

required
frame_index int

The index of the frame in the sequence.

required
id str

Point cloud ID.

''
item_ref ItemRef

Item reference.

none()
parent_ref ViewRef

Parent view reference.

none()
width int | None

The frame width. If None, the width is extracted from the frame file.

None
height int | None

The frame height. If None, the height is extracted from the frame file.

None
format str | None

The frame format. If None, the format is extracted from the frame file.

None
url_relative_path Path | None

The path to convert the URL to a relative path.

None

Returns:

Type Description
SequenceFrame

The created SequenceFrame instance.

Source code in pixano/features/schemas/views/sequence_frame.py
def create_sequence_frame(
    url: Path,
    timestamp: float,
    frame_index: int,
    id: str = "",
    item_ref: ItemRef = ItemRef.none(),
    parent_ref: ViewRef = ViewRef.none(),
    width: int | None = None,
    height: int | None = None,
    format: str | None = None,
    url_relative_path: Path | None = None,
) -> SequenceFrame:
    """Create a `SequenceFrame` instance.

    Args:
        url: The frame URL. If not relative, the URL is converted to a relative path using `other_path`.
        timestamp: The timestamp of the frame.
        frame_index: The index of the frame in the sequence.
        id: Point cloud ID.
        item_ref: Item reference.
        parent_ref: Parent view reference.
        width: The frame width. If None, the width is extracted from the frame file.
        height: The frame height. If None, the height is extracted from the frame file.
        format: The frame format. If None, the format is extracted from the frame file.
        url_relative_path: The path to convert the URL to a relative path.

    Returns:
        The created `SequenceFrame` instance.
    """
    image = create_image(url, id, item_ref, parent_ref, width, height, format, url_relative_path)
    return SequenceFrame(
        id=id,
        item_ref=item_ref,
        parent_ref=parent_ref,
        url=image.url,
        width=image.width,
        height=image.height,
        format=image.format,
        timestamp=timestamp,
        frame_index=frame_index,
    )

is_sequence_frame(cls, strict=False)

Check if the given class is a subclass of SequenceFrame.

Source code in pixano/features/schemas/views/sequence_frame.py
def is_sequence_frame(cls: type, strict: bool = False) -> bool:
    """Check if the given class is a subclass of `SequenceFrame`."""
    return issubclass_strict(cls, SequenceFrame, strict)