CorpusCallosum.utils.visualization¶
- CorpusCallosum.utils.visualization.plot_contours(slice_or_slab, split_contours=None, midline_equidistant=None, levelpaths=None, output_path=None, ac_coords_vox=None, pc_coords_vox=None, vox2ras=None, title='')[source]¶
Creates a figure of the contours (shape) and the subdivisions of the corpus callosum.
- Parameters:
- slice_or_slab
np.ndarray Intensities of the current slice, midslice or midslab (will plot middle slice).
- split_contours
list[np.ndarray],optional List of contour arrays for each subdivision (ignore contours on None) in upright AS coordinates each with shape (N, 2).
- midline_equidistant
np.ndarray,optional Midline points at equidistant spacing (ignore midline on None) in upright AS coordinates with shape (2, N).
- levelpaths
list[np.ndarray],optional List of level paths for visualization (ignore level paths on None) in upright AS coordinates each with shape (2, N).
- output_path
strorPathorlistofPaths,optional Path to save the plot (show and do not save on None).
- ac_coords_vox
np.ndarray,optional AC coordinates for visualization (ignore AC on None) in LIA voxel coordinates.
- pc_coords_vox
np.ndarray,optional PC coordinates for visualization (ignore PC on None) in LIA voxel coordinates.
- vox2ras
AffineMatrix4x4,optional Slice vox2ras transformation matrix.
- title
str, default=”” Title for the plot.
- slice_or_slab
Notes
Creates a visualization of the corpus callosum contours and their subdivisions. If output_path is provided, saves the plot to that location.
- CorpusCallosum.utils.visualization.plot_standardized_space(ax_row, vol, ac_coords, pc_coords)[source]¶
Plot standardized space visualization across three views.
- Parameters:
- ax_row
list[plt.Axes] Row of axes to plot on (should be length 3).
- vol
np.ndarray Volume data to visualize.
- ac_coords
np.ndarray AC coordinates in standardized space.
- pc_coords
np.ndarray PC coordinates in standardized space.
- ax_row
Notes
Creates three views: - Axial (top view) - Sagittal (side view) - Coronal (front view)
- CorpusCallosum.utils.visualization.visualize_coordinate_spaces(orig, upright, standardized, ac_coords_orig, pc_coords_orig, ac_coords_3d, pc_coords_3d, ac_coords_standardized, pc_coords_standardized, output_plot_path)[source]¶
Visualize the AC and PC coordinates in different coordinate spaces.
Creates a figure showing the anterior and posterior commissure points in three different coordinate spaces for testing/debugging.
- Parameters:
- orig
nibabel.Nifti1Image Original image volume.
- upright
np.ndarray Volume in fsaverage space.
- standardized
np.ndarray Volume in standardized space.
- ac_coords_orig
np.ndarray AC coordinates in original space.
- pc_coords_orig
np.ndarray PC coordinates in original space.
- ac_coords_3d
np.ndarray AC coordinates in fsaverage space.
- pc_coords_3d
np.ndarray PC coordinates in fsaverage space.
- ac_coords_standardized
np.ndarray AC coordinates in standardized space.
- pc_coords_standardized
np.ndarray PC coordinates in standardized space.
- output_plot_path
strorPath Directory to save visualization.
- orig
Notes
Saves a visualization of the anterior (red) and posterior (blue) commisure in three different view: 1. the orig image (orig), 2. fs-average standardized image space, and 3. standardized image space as a single image named ‘ac_pc_spaces.png’ in
output_dir.