RippleImage#

class ripplemapper.classes.RippleImage(*args, roi_x: list[int] = False, roi_y: list[int] = False)[source]#

Bases: object

Class for ripple images.

Initialize a RippleImage instance.

Parameters:
  • *args (tuple) – Arguments to initialize the image. Can be a file path to an image file, or a file name and image data pair.

  • roi_x (list[int], optional) – Region of interest in the x-dimension, by default False.

  • roi_y (list[int], optional) – Region of interest in the y-dimension, by default False.

Raises:

ValueError – If the input is not a valid file path or a file name and image data pair.

Methods Summary

add_contour(*args)

Add a contour to the RippleImage object.

get_contour(contour)

Return a given contour for the image.

plot([include_contours])

Plot the image with optional contours.

save([fname, save_image_data])

Save the image and contours to a file.

smooth_contours(**kwargs)

Smooth all the contours in the image.

Methods Documentation

add_contour(*args)[source]#

Add a contour to the RippleImage object.

Parameters:

*args (tuple) – Arguments to initialize the contour. Can be a file path to a contour file, or a numpy array of contour values and a method string.

get_contour(contour: str | int)[source]#

Return a given contour for the image.

Parameters:

contour (str | int) – Contour identifier. Can be an integer index or a method string.

Returns:

The corresponding RippleContour object.

Return type:

RippleContour

Raises:

ValueError – If the input is not a valid integer or method string.

plot(include_contours: bool = True, *args, **kwargs)[source]#

Plot the image with optional contours.

Parameters:
  • include_contours (bool, optional) – Whether to include contours in the plot, by default True.

  • *args (tuple) – Additional positional arguments for the plot function.

  • **kwargs (dict) – Additional keyword arguments for the plot function.

save(fname: str = False, save_image_data: bool = False)[source]#

Save the image and contours to a file.

Parameters:
  • fname (str, optional) – File name to save the image and contours. If not provided, a default name is generated.

  • save_image_data (bool, optional) – Whether to save the image data, by default False.

Returns:

The file name the image and contours were saved to.

Return type:

str

smooth_contours(**kwargs)[source]#

Smooth all the contours in the image.

Parameters:

**kwargs (dict) – Additional keyword arguments for the smooth method of RippleContour.