CorpusCallosum.shape.metrics

CorpusCallosum.shape.metrics.calculate_cc_index(cc_contour, plot=False)[source]

Calculate CC index based on three thickness measurements.

The AP line intersects the contour 4 times. The measurements are: - Anterior thickness: distance between intersection points 1 and 2 - Posterior thickness: distance between intersection points 3 and 4 - Middle thickness: perpendicular line through midpoint of AP line

The CC index is: (anterior + posterior + middle) / AP_length

Parameters:
cc_contournp.ndarray

Array of shape (2, N) containing contour points in ACPC space.

plotbool, optional

Whether to generate a debug plot. Default is True.

Returns:
cc_indexfloat

The CC index, which is the sum of thicknesses at three measurement points divided by AP length.

CorpusCallosum.shape.metrics.get_intersections(contour, start_point, direction)[source]

Find intersection points between an infinite line and a closed contour.

Parameters:
contournp.ndarray

Array of shape (2, N) containing contour points in ACPC space.

start_pointnp.ndarray

A point on the line, shape (2,).

directionnp.ndarray

Direction vector of the line, shape (2,).

Returns:
np.ndarray

Array of shape (M, 2) containing intersection points, sorted along the direction.

CorpusCallosum.shape.metrics.plot_cc_index_calculation(ax, cc_contour, anterior_idx, posterior_idx, ap_intersections, middle_intersections, midpoint)[source]

Plot the CC index measurements.

Parameters:
axmatplotlib.axes.Axes

The axes to plot on.

cc_contournp.ndarray

Array of shape (2, N) containing contour points in ACPC space.

anterior_idxint

Index of the anterior point on the contour.

posterior_idxint

Index of the posterior point on the contour.

ap_intersectionsnp.ndarray

Array of shape (4, 2) containing the 4 intersection points of the AP line with the contour.

middle_intersectionsnp.ndarray

Array of shape (2, 2) containing middle perpendicular intersection points.

midpointnp.ndarray

Array of shape (2,) containing the midpoint of the AP line.