ibl_alignment_gui.plugins.datoviz_3d
Functions
Open the 3D viewer. |
|
Create a random hex color code. |
|
Convert data values to RGBA color codes. |
|
Get unique brain regions that the shank passes through, in the Allen mapping. |
|
Get the xyz coordinates of the picks for the shank. |
|
Set up the 3D Features plugin. |
|
Get the channel data for the chosen plot. |
|
Get the cluster data for the chosen plot. |
Classes
A class to manage viewing features in a 3D Urchin viewer. |
|
Popup window hosting the datoviz 3D scene and its display controls. |
- class ibl_alignment_gui.plugins.datoviz_3d.Features3D(controller)[source]
Bases:
objectA class to manage viewing features in a 3D Urchin viewer.
- Parameters:
controller (AlignmentGUIController) – The main application controller.
- Variables:
controller (AlignmentGUIController) – The main application controller.
particles (oursin.particles.ParticleSystem or None) – The particle system for displaying points.
markers (oursin.particles.ParticleSystem or None) – The particle system for displaying markers.
regions (list or np.ndarray) – The list of brain regions displayed.
texts (list) – The list of text objects displayed.
point_size (float) – The size of the points displayed.
plot (str) – The type of plot currently displayed (‘channels’ or ‘clusters’).
plot_type (str or None) – The specific plot name currently displayed.
side (oursin.utils.Side) – The hemisphere side for displaying regions.
region_toggle (QtWidgets.QAction or None) – The action to toggle region visibility.
ba (AllenAtlas) – A brain atlas instance.
- add_regions(regions, hemisphere=-1)[source]
Add a list of brain regions to the 3D view.
- Parameters:
regions (list or np.ndarray) – A list of region names to add.
hemisphere (int, optional) – The hemisphere to display the regions in (-1 for left, 1 for right). Default is -1.
- Return type:
None
- data_button_pressed()[source]
Add regions and plots to the 3D view for the chosen probe.
Called when the data button is pressed in the main application.
- Return type:
None
- on_close()[source]
Triggered when the plugin window is closed.
Deactivate the plugin and callbacks.
- Return type:
None
- on_point_size_changed(slider)[source]
Update the size of the points in the 3D view based on the slider value.
- Parameters:
slider (QtWidgets.QSlider) – A slider widget with values from 1 to 10 representing point size.
- Return type:
None
- plot_channels(plot_key, *args)[source]
Plot channel data in the 3D view.
- Parameters:
plot_key (str) – The name of channel plot to display.
- Return type:
None
- plot_clusters(plot_key, *args)[source]
Plot cluster data in the 3D view.
- Parameters:
plot_key (str) – The name of the cluster plot to display.
- Return type:
None
- plot_picks()[source]
Plot channel data in the 3D view.
- Parameters:
plot_key (str) – The name of channel plot to display.
- Return type:
None
- set_markers(markers)[source]
Add markers and text to indicate shank positions in the 3D view.
- Parameters:
markers (dict) – A list of marker positions, colors, and names.
- Return type:
None
- set_picks(points)[source]
Add a set of pick points to the 3D view.
- Parameters:
points (dict) – The position and color of the pick points to add.
- Return type:
None
- set_point_size(point_size)[source]
Set the size of the points in the 3D view.
- Parameters:
point_size (float) – The size of the points to set.
- Return type:
None
- set_points(points)[source]
Add a set of points to the 3D view.
- Parameters:
points (dict) – The position and color of the points to add.
- Return type:
None
- toggle_picks(display)[source]
Show or hide the pick points in the 3D view.
- Parameters:
display (bool) – Whether to display the pick points.
- Return type:
None
- class ibl_alignment_gui.plugins.datoviz_3d.Viewer3D(title, controller)[source]
Bases:
PopupWindowPopup window hosting the datoviz 3D scene and its display controls.
- Parameters:
title (str) – Title shown in the popup’s title bar.
controller (AlignmentGUIController) – The main application controller.
- ibl_alignment_gui.plugins.datoviz_3d.callback(controller)[source]
Open the 3D viewer.
- Return type:
None
- ibl_alignment_gui.plugins.datoviz_3d.create_random_color()[source]
Create a random hex color code.
- Returns:
A hex color code.
- Return type:
str
- ibl_alignment_gui.plugins.datoviz_3d.data_to_colors(data, cmap, vmin, vmax)[source]
Convert data values to RGBA color codes.
- Parameters:
data (list or np.ndarray) – The data values to convert to colors.
cmap (str) – The name of the matplotlib colormap to use.
vmin (float) – The minimum value for the colormap.
vmax (float) – The maximum value for the colormap.
- Returns:
chex – A list of RGBA color codes corresponding to each data value.
- Return type:
list
- ibl_alignment_gui.plugins.datoviz_3d.get_regions(_, items, **kwargs)[source]
Get unique brain regions that the shank passes through, in the Allen mapping.
The regions come from the track rather than the histology figure, so they do not change with the mapping chosen in the Set Mapping menu.
- Parameters:
items (ShankController) – A ShankController instance containing model data.
- Returns:
An array of unique region names.
- Return type:
np.ndarray
- ibl_alignment_gui.plugins.datoviz_3d.get_xyz_picks(_, items, **kwargs)[source]
Get the xyz coordinates of the picks for the shank.
- Parameters:
items (ShankController) – A ShankController instance containing model data.
- Returns:
An array of xyz coordinates of the picks.
- Return type:
np.ndarray
- ibl_alignment_gui.plugins.datoviz_3d.setup(controller)[source]
Set up the 3D Features plugin.
Adds a submenu to the main menu with options to show/hide regions and adjust point size. Also attaches necessary callbacks to the controller.
- Parameters:
controller (AlignmentGUIController) – The main application controller.
- Return type:
None
- ibl_alignment_gui.plugins.datoviz_3d.update_channels(_, items, plot_key, **kwargs)[source]
Get the channel data for the chosen plot.
- Parameters:
items (ShankController) – A ShankController instance containing model data.
plot_key (str) – The name of the plot to display data for.
- Returns:
A dictionary containing data for 3D plotting.
- Return type:
dict
- ibl_alignment_gui.plugins.datoviz_3d.update_clusters(_, items, plot_key, **kwargs)[source]
Get the cluster data for the chosen plot.
- Parameters:
items (ShankController) – A ShankController instance containing model data.
plot_key (str) – The name of the plot to display data for.
- Returns:
A dictionary containing data for 3D plotting.
- Return type:
dict