Visualization Functions
- transbrain.vis.map_phenotype_to_nifti(phenotype_df, atlas_dict)[source]
Map phenotype values to a mouse atlas and create a NIfTI image.
- Parameters:
phenotype_df (pd.DataFrame) – DataFrame with ‘Phenotype’ column and anatomical names as index.
atlas_dict (dict) – Dictionary with ‘info_table’ (mapping anatomical names to atlas indices) and ‘atlas’ (NIfTI image of the mouse brain atlas).
- Returns:
NIfTI image with phenotype values mapped to atlas regions.
- Return type:
phenotype_img (nib.Nifti1Image)
- transbrain.vis.plot_mouse_phenotype(phenotype_img, coor=[1.85, 0.85, -1.65, -2.15, -3.15], normalize_img=False, symmetric_cbar=True, vmax=2, threshold=0)[source]
Visualize the phenotype map and overlay contours.
- Parameters:
phenotype_img (NIfTI image) – The phenotype image to visualize. This is a 3D NIfTI image containing the data to be plotted.
coor (List, optional) – Coordinates for display
normalize_img (bool, optional) – If True, the phenotype image will be normalized using z-score transformation. Default is False.
symmetric_cbar (bool, optional) – Whether to use a symmetric colorbar (True) or not (False). Default is True.
vmax (float, optional) – Maximum value for colormap scaling. Default is 2. This parameter defines the upper bound for the colormap range.
threshold (float, optional) – Threshold value for masking the image. Default is 0. Any values below this threshold will be masked (set to 0).
- Returns:
This function does not return any value. It generates and displays a plot of the phenotype image with contours.
- Return type:
None
- transbrain.vis.plot_human_phenotype(phenotype_img, normalize_img=False, cut_coords=range(0, 50, 10), vmax=2, symmetric_cbar=True)[source]
Plots the human phenotype data on the MNI152 template.
- Parameters:
phenotype_img (nib.Nifti1Image) – A NIfTI image containing the phenotype data to be visualized. This image will be overlaid on the MNI152 template.
normalize_img (bool, optional, default=False) – If True, the phenotype image will be normalized using z-score transformation before visualization.
cut_coords (range, optional, default=range(0, 50, 10)) – Slice coordinates at which the phenotype data will be displayed. The default is from 0 to 50 in steps of 10.
vmax (float, optional, default=2) – The maximum value for color intensity in the plot. This parameter controls the upper bound for the colormap range.
symmetric_cbar (bool, optional, default=True) – If True, the colorbar will be symmetric, with zero at the center. If False, the colorbar will scale based on the provided data.
- Return type:
None
- transbrain.surf.plot_surface_phenotype(vertex_data, vmax=2, thresh=0, darkness=0.6, show_boundary=True, sym_bar=True)[source]
Visualize the surface phenotype data by generating a surface map with the given input data.
- Parameters:
vertex_data (array-like) – The input vertex data representing the surface phenotype values.
vmax (float, optional, default=2) – The maximum value for the color scale.
thresh (float, optional, default=0) – The threshold value below which data is not displayed.
darkness (float, optional, default=0.6) – The darkness level for the background surface. Ranges between 0 (light) and 1 (dark).
show_boundary (bool, optional, default=True) – Whether to show the boundary overlay on the surface map.
sym_bar (bool, optional, default=True) – Whether to make the colorbar symmetric around zero.
- Returns:
visualize – The generated figure containing the surface phenotype visualization.
- Return type:
PIL.Image.Image