frame¶
Helper class for working lvpyio frames retrieved from a set.
- class lvpyioTools.frame.LVFrame(frame: ImageFrame, set: LVSet)[source]¶
Bases:
objectWrapper class for working with lvpyio frames retrieved from a set. This class provides a convenient interface to access frame attributes, image data, and scale information.
- replace_frame(new_frame: ImageFrame)[source]¶
Update the current frame with a new frame. Notably used for performance reasons to not create a new LVFrame object for each frame in a set.
- Parameters:
new_frame (ImageFrame) – The new frame to update with.
- shape()[source]¶
Get the images and masks shapes.
- Returns:
A tuple containing the shapes of the images and masks.
- Return type:
- get(image_number: int = 0)[source]¶
Read the image data from a specific frame and image number.
- Parameters:
image_number (int, optional) – The index of the image to retrieve. Defaults to 0.
- Raises:
IndexError – If the image_number is out of range.
- Returns:
The image data as a NumPy array.
- Return type:
- show(image_number: int = 0, vmin: float | None = None, vmax: float | None = None, cmap: str | Colormap | None = 'gray', _show: bool = True)[source]¶
Display the image data from a specific frame and image number using the default image viewer.
- Parameters:
image_number (int, optional) – The index of the image to display. Defaults to 0.
- scale() Scales[source]¶
Read the scale information from the frame, that is a class containing the following attributes: -
x: The scale in the x-direction (in meters per pixel). -y: The scale in the y-direction (in meters per pixel). -z: The scale in the z-direction (in meters per pixel). -i: The scale in the intensity direction (generally with a slope of 1).Each attributes are
Scaleobjects, which contain the following attributes: -slope: The slope of the scale -offset: The offset of the scale -unit: The unit of the scale (mm, counts, etc.) -description: Mostly just empty- Returns:
A
Scalesobject containing the scale information for the frame.- Return type:
Scales
- get_attribute(attribute: FrameAttribute)[source]¶
Get a specific attribute from the frame.
- Parameters:
attribute (FrameAttribute) – The attribute to retrieve.
- Returns:
The value of the requested attribute, or
Noneif the attribute is not found in the frame.- Return type:
Any
- get_max_intensity()[source]¶
Get the maximum intensity of the pixel values from the frame.
- Raises:
ValueError – If the CAMERA_MAX_INTENSITY attribute is not found or is invalid.
- Returns:
The maximum intensity value of the pixel values from the frame.
- Return type: