magmap.gui.atlas_editor module¶
Atlas editing GUI in the MagellanMapper package.
- class magmap.gui.atlas_editor.AtlasEditor(img5d, labels_img, channel, offset, fn_close_listener, borders_img=None, fn_show_label_3d=None, title=None, fn_refresh_atlas_eds=None, fig=None, fn_status_bar=None)[source]¶
Bases:
ImageSyncMixinGraphical interface to view an atlas in multiple orthogonal dimensions and edit atlas labels.
plot_edsare dictionaries of keys specified by one ofmagmap.config.PLANEplane orientations to Plot Editors.- Variables:
labels_img – Numpy image array in z,y,x format.
channel – Channel of the image to display.
offset – Index of plane at which to start viewing in x,y,z (user) order.
fn_close_listener – Handle figure close events.
borders_img – Numpy image array in z,y,x,[c] format to show label borders, such as that generated during label smoothing. Defaults to None. If this image has a different number of labels than that of
labels_img, a new colormap will be generated.fn_show_label_3d – Function to call to show a label in a 3D viewer. Defaults to None.
title (str) – Window title; defaults to None.
fn_refresh_atlas_eds (func) – Callback for refreshing other Atlas Editors to synchronize them; defaults to None. Typically takes one argument, this
AtlasEditorobject to refreshing it. Defaults to None.alpha_slider – Matplotlib alpha slider control.
alpha_reset_btn – Maplotlib button for resetting alpha transparency.
alpha_last – Float specifying the previous alpha value.
interp_planes – Current
InterpolatePlanesobject.interp_btn – Matplotlib button to initiate plane interpolation.
save_btn – Matplotlib button to save the atlas.
fn_status_bar (func) – Function to call during status bar updates in
pixel_display.PixelDisplay; defaults to None.fn_update_coords (func) – Handler for coordinate updates, which takes coordinates in z-plane orientation; defaults to None.
- alpha_reset(event)[source]¶
Reset the alpha transparency in all plot editors.
- Parameters:
event – Button event, currently ignored.
- alpha_update(event)[source]¶
Update the alpha transparency in all plot editors.
- Parameters:
event – Slider event.
- color_picker_changed(text)[source]¶
Respond to color picker
TextBoxchanges by updating the specified intensity value in all plot editors.- Parameters:
text (str) – String of text box value. Converted to an int if non-empty.
- get_save_path()[source]¶
- Get figure save path based on filename, ROI, and overview plane
shown.
- Returns:
Figure save path.
- Return type:
- interpolate(event)[source]¶
Interpolate planes using
interp_planes.- Parameters:
event – Button event, currently ignored.
- planes: Sequence[str]¶
Sequence of planes to show in the Plot Editors. Planes are given as axis-border strings (eg “xy”). Defaults to
magmap.settings.config.PLANE. Plots are ordered clockwise from the left of the Atlas Editor and can be None to remove the plot.
- refresh_images(plot_ed=None, update_atlas_eds=False)[source]¶
Refresh images in a plot editor, such as after editing one editor and updating the displayed image in the other editors.
- save_atlas(event=None)[source]¶
Save atlas labels using the registered image suffix given by
config.reg_suffixes[config.RegSuffixes.ANNOTATION].- Parameters:
event (default:
None) – Button event, currently not used; defaults to None.
- scroll_overview(event)[source]¶
Scroll images and crosshairs in all plot editors
- Parameters:
event – Scroll event.
- toggle_edit_mode(event)[source]¶
Toggle editing mode, determining the current state from the first
magmap.plot_editor.PlotEditorand switching to the opposite value for all plot editors.- Parameters:
event – Button event, currently not used.
- update_color_picker(val)[source]¶
Update the color picker
TextBoxwith the given value.- Parameters:
val (str) – Color value. If None, only
color_picker_changed()will be triggered.
- update_coords(coord, plane_src='xy')[source]¶
Update all plot editors with given coordinates.
- Parameters:
coord – Coordinate at which to center images, in z,y,x order.
plane_src (default:
'xy') – One ofmagmap.config.PLANE(defaults to first element) to specify the orientation from which the coordinates were given.
- class magmap.gui.atlas_editor.InterpolatePlanes(btn)[source]¶
Bases:
objectTrack manually edited planes between which to interpolate changes for a given label.
This interpolation replaces unedited planes based on the trends of the edited ones to avoid the need to manually edit every single plane.
- Variables:
btn (
matplotlib.widgets.Button) – Button to initiate plane interpolation.plane (str) – Plane in which editing has occurred.
bounds (List[int]) – Unsorted start and end planes.
label_id (int) – Label ID of the edited region.
- property bounds¶
Get the bounds property.