CorpusCallosum.shape.metrics¶
- CorpusCallosum.shape.metrics.calculate_cc_index(cc_contour, plot=False)[source]¶
Calculate the dimensionless corpus callosum index (CCI).
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 index is
(anterior + middle + posterior) / AP_length, following Figueira et al. (2007), https://doi.org/10.1590/S0004-282X2007000600001.- Parameters:
- cc_contour
np.ndarray Array of shape (2, N) containing contour points in ACPC space.
- plot
bool,optional Whether to generate a debug plot. Default is False.
- cc_contour
- Returns:
- cc_index
float Sum of the anterior, middle, and posterior widths divided by the anterior-posterior length.
- cc_index
- CorpusCallosum.shape.metrics.get_intersections(contour, start_point, direction)[source]¶
Find intersection points between an infinite line and a closed contour.
- Parameters:
- contour
np.ndarray Array of shape (2, N) containing contour points in ACPC space.
- start_point
np.ndarray A point on the line, shape (2,).
- direction
np.ndarray Direction vector of the line, shape (2,).
- contour
- Returns:
np.ndarrayArray 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:
- ax
matplotlib.axes.Axes The axes to plot on.
- cc_contour
np.ndarray Array of shape (2, N) containing contour points in ACPC space.
- anterior_idx
int Index of the anterior point on the contour.
- posterior_idx
int Index of the posterior point on the contour.
- ap_intersections
np.ndarray Array of shape (4, 2) containing the 4 intersection points of the AP line with the contour.
- middle_intersections
np.ndarray Array of shape (2, 2) containing middle perpendicular intersection points.
- midpoint
np.ndarray Array of shape (2,) containing the midpoint of the AP line.
- ax