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
- 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
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