CorpusCallosum.shape.thickness¶
- CorpusCallosum.shape.thickness.cc_thickness(contour_2d, endpoint_idx, n_points=100)[source]¶
Calculate corpus callosum thickness using Laplace equation.
- Parameters:
- contour_2d
np.ndarray Array of shape (N, 2) containing contour points.
- endpoint_idx
pairofints Indices of anterior and posterior endpoints in contour.
- n_points
int, default=100 Number of points for thickness measurement.
- contour_2d
- Returns:
- midline_length
float Total length of the midline.
- thickness
float Mean thickness across all level paths.
- curvature
float Mean absolute curvature in degrees.
- midline_equidistant
np.ndarray Equidistant points along the midline in same space as contour2d of shape (N, 2).
- levelpaths
list[np.ndarray] Level paths for thickness measurement in same space as contour2d, each of shape (N, 2).
- contour_with_thickness
np.ndarray Contour coordinates with thickness information in same space as contour2d of shape (N+2, 3).
- endpoint_indices
pairofints Pair of updated indices of anterior and posterior endpoint.
- midline_length
Notes
Uses the Laplace equation to compute thickness by: 1. Creating a triangular mesh from the contour 2. Setting boundary conditions (0 at endpoints, ±1 on sides) 3. Solving Laplace equation to get level sets 4. Computing thickness along level sets
- CorpusCallosum.shape.thickness.find_closest_edge(point, contour)[source]¶
Find the index of the edge closest to the given point.
- Parameters:
- point
np.ndarray 2D point coordinates.
- contour
np.ndarray Array of shape (N, 2) containing contour points.
- point
- Returns:
intIndex of the closest edge.
- CorpusCallosum.shape.thickness.insert_point_with_thickness(contour_in_as_space, contour_thickness, point, thickness_value, return_index=False)[source]¶
Inserts a point and its thickness value into the contour.
- Parameters:
- contour_in_as_space
np.ndarray Array of coordinates of the contour in AS space, shape (N, 2).
- contour_thickness
np.ndarray Array of thickness values of the contour, shape (N,).
- point
np.ndarray 2D point to insert, shape (2,).
- thickness_value
float Thickness value corresponding to the point.
- return_index
bool, default=False If True, return the index where point was inserted, by default False.
- contour_in_as_space
- Returns:
- contour_in_as_space
np.ndarray Updated contour of shape (N+1, 2).
- contour_thickness
np.ndarray Updated thickness values of shape (N+1,).
- insertion_index
int The index, where the point was inserted (only if return_index is True).
- contour_in_as_space
- CorpusCallosum.shape.thickness.make_mesh_from_contour(contour_2d, max_volume=0.5, min_angle=25, verbose=False)[source]¶
Create a triangular mesh from a 2D contour.
- Parameters:
- contour_2d
np.ndarray Array of shape (N, 2) containing contour points.
- max_volume
float,optional Maximum triangle area, by default 0.5.
- min_angle
float,optional Minimum angle in triangles (degrees), by default 25.
- verbose
bool,optional Whether to print mesh generation info, by default False.
- contour_2d
- Returns:
- mesh_points
np.ndarray Array of shape (M, 2) containing mesh vertices.
- mesh_trias
np.ndarray Array of shape (K, 3) containing triangle indices.
- mesh_points
Notes
Uses meshpy.triangle to create a constrained Delaunay triangulation of the contour. The contour must not have duplicate points.
- CorpusCallosum.shape.thickness.set_contour_zero_idx(contour, idx, anterior_endpoint_idx, posterior_endpoint_idx)[source]¶
Roll contour points to set a new zero index, while keeping track of CC endpoints.
- Parameters:
- contour
np.ndarray Array of contour points.
- idx
int New zero index.
- anterior_endpoint_idx
int Index of anterior endpoint.
- posterior_endpoint_idx
int Index of posterior endpoint.
- contour
- Returns:
- contour
np.ndarray Rolled contour points.
- anterior_endpoint_idx
int Updated anterior endpoint index.
- posterior_endpoint_idx
int Updated posterior endpoint index.
- contour