Stack#
- class deeptrack.features.Stack(value: Any | Callable[[...], Any], **kwargs: dict[str, Any])#
Bases:
FeatureStacks the input and the value.
This feature combines the output of the input data (image) and the value produced by the specified feature (value). The resulting output is a list where the elements of the image and value are concatenated.
If either the input (image) or the value is a single Image object, it is automatically converted into a list to maintain consistency in the output format.
If B is a feature, Stack can be visualized as:
>>> A >> Stack(B) = [*A(), *B()]
Parameters#
- value: PropertyLike[Any]
The feature or data to stack with the input.
- **kwargs: dict of str to Any
Additional arguments passed to the parent Feature class.
Attributes#
- __distributed__: bool
Indicates whether this feature distributes computation across inputs. Always False for Stack, as it processes all inputs at once.
Methods#
- get(image: Any, value: Any, **kwargs: dict[str, Any]) -> list[Any]
Concatenate the input with the value.
Examples#
>>> import deeptrack as dt
Start by creating a pipeline using Stack: >>> pipeline = dt.Value([1, 2, 3]) >> dt.Stack(value=[4, 5]) >>> print(pipeline.resolve()) [1, 2, 3, 4, 5]
Equivalently, this pipeline can be created using: >>> pipeline = dt.Value([1, 2, 3]) & [4, 5]
Or: >>> pipeline = [4, 5] & dt.Value([1, 2, 3]) # Different result.
Methods Summary
get(image, value, **kwargs)Concatenate the input with the value.
Methods Documentation
- get(image: Any | list[Any], value: Any | list[Any], **kwargs: dict[str, Any]) list[Any]#
Concatenate the input with the value.
It ensures that both the input (image) and the value (value) are treated as lists before concatenation.
Parameters#
- image: Any or list[Any]
The input data to stack. Can be a single element or a list.
- value: Any or list[Any]
The feature or data to stack with the input. Can be a single element or a list.
- **kwargs: dict of str to Any
Additional keyword arguments (not used here).
Returns#
- list[Any]
A list containing all elements from image and value.