napari_dmc_brainmap.visualization.vis_plots package

Submodules

napari_dmc_brainmap.visualization.vis_plots.barplot_visualization module

class napari_dmc_brainmap.visualization.vis_plots.barplot_visualization.BarplotVisualization(df_all: DataFrame, df: DataFrame, atlas: str, animal_list: List[str], tgt_list: List[str], save_path: Path, barplot_widget: FunctionGui, gene_list: List[str])[source]

Bases: object

Class for generating bar plots and visualizations based on segmentation data and user configurations.

calculate_plot() DataFrame[source]

Calculate data for bar plots based on the provided dataset and user parameters.

Returns:

Data ready for plotting.

Return type:

pd.DataFrame

do_bar_plot(tgt_data_to_plot: DataFrame) FigureCanvasQTAgg[source]

Generate a bar plot with the given data and parameters.

Parameters:

tgt_data_to_plot (pd.DataFrame) – Data to plot.

Returns:

Bar plot visualization.

Return type:

FigureCanvas

napari_dmc_brainmap.visualization.vis_plots.brainsection_plotter module

class napari_dmc_brainmap.visualization.vis_plots.brainsection_plotter.BrainsectionPlotter(atlas: BrainGlobeAtlas, plotting_params: Dict, data_dict: Dict, color_manager, color_dict: Dict)[source]

Bases: object

Class for plotting brain sections and generating visualizations such as schematics, Voronoi diagrams, density maps, and heatmaps.

calculate_heatmap(annot_section_plt: ndarray, df: DataFrame, orient_mapping: Dict, y_bins: ndarray, x_bins: ndarray, bin_size: float) Tuple[ndarray, ndarray][source]

Calculate a heatmap based on data distribution in the specified slice.

Parameters:
  • annot_section_plt (np.ndarray) – Annotated section to use as a base.

  • df (pd.DataFrame) – Dataframe containing plotting data.

  • orient_mapping (Dict) – Mapping for orientation coordinates.

  • y_bins (np.ndarray) – Bin edges for the y-axis.

  • x_bins (np.ndarray) – Bin edges for the x-axis.

  • bin_size (float) – Size of each bin in the heatmap.

Returns:

Heatmap data and mask.

Return type:

Tuple[np.ndarray, np.ndarray]

calculate_heatmap_difference(annot_section_plt: ndarray, df: DataFrame, plotting_params: Dict, orient_mapping: Dict, y_bins: ndarray, x_bins: ndarray, bin_size: float, diff_type: str, diff_items: List[str]) Tuple[ndarray, ndarray][source]

Calculate the difference between heatmaps for two groups.

Parameters:
  • annot_section_plt (np.ndarray) – Annotated section to use as a base.

  • df (pd.DataFrame) – Dataframe containing plotting data.

  • plotting_params (Dict) – Parameters for plotting.

  • orient_mapping (Dict) – Mapping for orientation coordinates.

  • y_bins (np.ndarray) – Bin edges for the y-axis.

  • x_bins (np.ndarray) – Bin edges for the x-axis.

  • bin_size (float) – Size of each bin in the heatmap.

  • diff_type (str) – Column name used for grouping.

  • diff_items (List[str]) – Group names to compare.

Returns:

Heatmap difference data and mask.

Return type:

Tuple[np.ndarray, np.ndarray]

plot_brain_schematic(slice_idx: int, orient_idx: int) List[source]

Generate a schematic plot for a specific brain slice.

Parameters:
  • slice_idx (int) – Index of the brain slice.

  • orient_idx (int) – Orientation index (0: coronal, 1: sagittal, 2: horizontal).

Returns:

Annotated section, unique IDs, and color dictionary.

Return type:

List

plot_brain_schematic_voronoi(df: DataFrame, slice_idx: int, orient_mapping: Dict) List[source]

Generate a Voronoi plot for a specific brain slice.

Parameters:
  • df (pd.DataFrame) – Dataframe containing plot points.

  • slice_idx (int) – Index of the brain slice.

  • orient_mapping (Dict) – Mapping for orientation coordinates.

Returns:

Voronoi mask, unique IDs, and color dictionary.

Return type:

List

napari_dmc_brainmap.visualization.vis_plots.brainsection_visualization module

class napari_dmc_brainmap.visualization.vis_plots.brainsection_visualization.BrainsectionVisualization(input_path: Path, atlas: BrainGlobeAtlas, data_dict: Dict, animal_list: List[str], brainsec_widget: FunctionGui, save_path: Path, gene: str)[source]

Bases: object

Class for visualizing brain sections and generating plots such as schematics, density maps, projections, and gene expression visualizations.

calculate_plot(progress_callback: None | callable = None) List[Tuple[List | None, Dict[str, DataFrame], int]][source]

Calculate data and annotations for all sections.

Parameters:

progress_callback (Optional[callable]) – Callback function for progress updates.

Returns:

Data and annotations for each section.

Return type:

List[Tuple[Optional[List], Dict[str, pd.DataFrame], int]]

do_plot(results: List[Tuple[List | None, Dict[str, DataFrame], int]]) FigureCanvasQTAgg[source]

Generate plots for the given results.

Parameters:

results (List[Tuple[Optional[List], Dict[str, pd.DataFrame], int]]) – Data and annotations for plotting.

Returns:

Canvas containing the generated plots.

Return type:

FigureCanvas

napari_dmc_brainmap.visualization.vis_plots.heatmap_visualization module

class napari_dmc_brainmap.visualization.vis_plots.heatmap_visualization.HeatmapVisualization(df_all: DataFrame, df: DataFrame, atlas, animal_list: list, tgt_list: list, gene: str, heatmap_widget: FunctionGui, save_path: Path)[source]

Bases: object

Class for generating heatmaps and visualizing data using customizable parameters.

calculate_plot(progress_callback: None | callable = None) DataFrame | ndarray[source]

Calculate data for plotting, including group differences if specified.

Parameters:

progress_callback (Optional[callable]) – Callback function to report progress. Defaults to None.

Returns:

Data ready for plotting, or the difference between groups if specified.

Return type:

Union[pd.DataFrame, np.ndarray]

do_plot(tgt_data_to_plot: DataFrame) FigureCanvasQTAgg[source]

Generate and display heatmaps for the specified target data.

Parameters:

tgt_data_to_plot (pd.DataFrame) – Dataframe containing the target data to plot.

Returns:

Matplotlib canvas containing the heatmap visualizations.

Return type:

FigureCanvas

Module contents