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#

sourceint

The axis to move.

destinationint

The destination position of the axis.

**kwargsDict[str, Any]

Additional keyword arguments passed to the parent Feature class.

Example#

>>> import numpy as np
>>> from deeptrack.features import MoveAxis

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 = 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#

imagenp.ndarray

The input image to process.

sourceint

The axis to move.

destinationint

The destination position of the axis.

**kwargsDict[str, Any]

Additional keyword arguments (unused here).

Returns#

np.ndarray

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