derotation.analysis.fit_ellipse#
This module contains functions to fit an ellipse to the largest blob centers
in each image of an image stack. The fit_ellipse_to_points function uses
the least squares optimization to fit an ellipse to the points. The
plot_ellipse_fit_and_centers function plots the fitted ellipse on the
largest blob centers. The derive_angles_from_ellipse_fits function
derives the rotation plane angle and orientation from the ellipse fits.
Functions
| 
 | Derive the rotation plane angle and orientation from the ellipse fits. | 
| 
 | Fit an ellipse to the points using least squares optimization. | 
| 
 | Plot the fitted ellipse on the largest blob centers. | 
- derotation.analysis.fit_ellipse.fit_ellipse_to_points(centers, pixels_in_row=256)[source]#
- Fit an ellipse to the points using least squares optimization. - Parameters:
- centers (np.ndarray) – The centers of the largest blob in each image. 
- Returns:
- The center of the ellipse (center_x, center_y), the semi-major axis (a), the semi-minor axis (b), and the rotation angle (theta). 
- Return type:
- Tuple[int, int, int, int, int] 
 
- derotation.analysis.fit_ellipse.plot_ellipse_fit_and_centers(centers, center_x, center_y, a, b, theta, image_stack, debug_plots_folder, saving_name='ellipse_fit.png')[source]#
- Plot the fitted ellipse on the largest blob centers. - Parameters:
- centers (np.ndarray) – The centers of the largest blob in each image. 
- center_x (int) – The x-coordinate of the center of the ellipse 
- center_y (int) – The y-coordinate of the center of the ellipse 
- a (int) – The semi-major axis of the ellipse 
- b (int) – The semi-minor axis of the ellipse 
- theta (int) – The rotation angle of the ellipse 
- image_stack (np.ndarray) – The image stack to plot the ellipse on. 
- debug_plots_folder (Path) – The folder to save the debug plot to. 
- saving_name (str, optional) – The name of the file to save the plot to, by default “ellipse_fit.png”. 
 
 
- derotation.analysis.fit_ellipse.derive_angles_from_ellipse_fits(ellipse_fits)[source]#
- Derive the rotation plane angle and orientation from the ellipse fits. - Parameters:
- ellipse_fits (np.ndarray) – The fitted ellipse parameters 
- Returns:
- The rotation plane (in degrees) angle and orientation 
- Return type:
- Tuple[int, int]