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_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 True.
- cc_contour
- Returns:
- cc_index
float The CC index, which is the sum of thicknesses at three measurement points divided by AP 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