MoveAxis#

class deeptrack.features.MoveAxis(source: int, destination: int, **kwargs: dict[str, Any])#

Bases: Feature

Moves the axis of the input image.

This feature rearranges the axes of an input image, moving a specified source axis to a new destination position. All other axes remain in their original order.

Parameters#

source: int

The axis to move.

destination: int

The destination position of the axis.

**kwargs:: dict of str to Any

Additional keyword arguments passed to the parent Feature class.

Methods#

get(image: np.ndarray, source: int, destination: int, **kwargs: dict[str, Any]) -> np.ndarray

Move the specified axis of the input image to a new position.

Examples#

>>> import deeptrack as dt
>>> import numpy as np

Create an input array: >>> input_image = np.random.rand(2, 3, 4) >>> print(input_image.shape) (2, 3, 4)

Apply a MoveAxis feature: >>> move_axis_feature = dt.MoveAxis(source=0, destination=2) >>> output_image = move_axis_feature(input_image) >>> print(output_image.shape) (3, 4, 2)

Methods Summary

get(image, source, destination, **kwargs)

Move the specified axis of the input image to a new position.

Methods Documentation

get(image: ndarray, source: int, destination: int, **kwargs: dict[str, Any]) ndarray#

Move the specified axis of the input image to a new position.

Parameters#

image: np.ndarray

The input image to process.

source: int

The axis to move.

destination: int

The destination position of the axis.

**kwargs:: dict of str to Any

Additional keyword arguments (unused here).

Returns#

np.ndarray

The input image with the specified axis moved to the destination.