strip#
- deeptrack.image.strip(element: Image | List | Tuple | Any) Any #
Recursively extract the underlying value from an Image object.
This function strips away the Image wrapper to return the underlying _value attribute. If the input is a list or tuple, it recursively processes each element, preserving the original structure. For other types, the input is returned unchanged.
Parameters#
- elementImage or List or Tuple or Any
The input to process.
Returns#
- Any
The stripped value. If element is an Image, its _value is returned. If element is a list or tuple, the corresponding stripped structure is returned. Otherwise, element is returned unchanged.
Examples#
>>> from deeptrack.image import Image, strip
>>> img = Image([1, 2, 3]) >>> strip(img) array([1, 2, 3])
>>> nested = [Image([1, 2]), Image([3, 4])] >>> strip(nested) [array([1, 2]), array([3, 4])]
>>> mixed = (Image([5]), 6, 'a') >>> strip(mixed) (array([5]), 6, 'a')