aicscytoparam.alignment package

Submodules

aicscytoparam.alignment.generic_2d_shape module

class aicscytoparam.alignment.generic_2d_shape.ElongatedHexagonalShape(base, elongation, pad=5)[source]

Bases: Generic2DShape

Elongated hexagonal shape

static get_default_parameters_as_dict(elongation=8, base_ini=24, base_end=64)[source]
class aicscytoparam.alignment.generic_2d_shape.Generic2DShape[source]

Bases: object

Generic class for 2D shapes

find_angle_that_minimizes_countour_distance(cx, cy)[source]

Find the angle that minimizes the distance between the shape and the contour (cx, cy) :Parameters: * cx (np.ndarray) – x coordinates of the contour

  • cy (np.ndarray) – y coordinates of the contour

Returns:

  • angle (int) – angle that minimizes the distance

  • dist (float) – minimum distance

static get_contour_from_3d_image(image, pad=5, center=True)[source]

Get the contour of a 3D image :Parameters: * image (np.ndarray) – 3D image

  • pad (int) – padding

  • center (bool) – center the contour

Returns:

  • cx (np.ndarray) – x coordinates of the contour

  • cy (np.ndarray) – y coordinates of the contour

static rotate_contour(cx, cy, theta)[source]

Rotate a contour around the origin :Parameters: * cx (np.ndarray) – x coordinates of the contour

  • cy (np.ndarray) – y coordinates of the contour

  • theta (float) – angle of rotation

Returns:

  • cxrot (np.ndarray) – x coordinates of the rotated contour

  • cyrot (np.ndarray) – y coordinates of the rotated contour

show(ax=None)[source]

aicscytoparam.alignment.shape_library_2d module

class aicscytoparam.alignment.shape_library_2d.ShapeLibrary2D[source]

Bases: object

Define a library of 2D shapes

display(xlim=[-150, 150], ylim=[-50, 50], contours_to_match=None)[source]

Display the shapes in the library :Parameters: * xlim (list) – x limits of the plot

  • ylim (list) – y limits of the plot

  • contours_to_match (list of tuples) – list of tuples with the contours to match

find_best_match(cx, cy)[source]

Find the best match between the contour (cx, cy) and the shapes in the library :Parameters: * cx (np.ndarray) – x coordinates of the contour

  • cy (np.ndarray) – y coordinates of the contour

Returns:

  • idx (int) – index of the best match

  • params (dict) – parameters of the best match

  • angle (float) – angle that minimizes the distance

set_base_shape(polygon)[source]

Set the base shape for the library :Parameters: polygon (Generic2DShape) – base shape for the library

set_parameters_range(params_dict)[source]

Set the parameters range for the library :Parameters: params_dict (dict) – dictionary with the parameters range

Module contents