deepcinac.gui.cinac_gui
¶
Module Contents¶
Classes¶
Button widget. |
|
Frame widget which may contain other widgets and can have a 3D border. |
|
Frame widget which may contain other widgets and can have a 3D border. |
|
Frame widget which may contain other widgets and can have a 3D border. |
|
Frame widget which may contain other widgets and can have a 3D border. |
|
Frame widget which may contain other widgets and can have a 3D border. |
|
The canvas the figure renders into. |
|
Frame widget which may contain other widgets and can have a 3D border. |
Functions¶
|
|
|
Take a window as argument (like tk.root()) and put it on front of all other |
|
|
|
Take a tkinter OptionMenu instance and load it using the fields of a matlab or npy file. |
|
Load data from a numpy or matlab file (.npz, .npz or .mat) |
|
|
|
|
|
|
|
|
|
|
|
|
Attributes¶
- deepcinac.gui.cinac_gui.NWB_PACKAGE_AVAILABLE = True¶
- deepcinac.gui.cinac_gui.NWB_PACKAGE_AVAILABLE = False¶
- deepcinac.gui.cinac_gui.event_lambda(f, *args, **kwds)¶
- class deepcinac.gui.cinac_gui.DataAndParam(path_data=None)¶
- class deepcinac.gui.cinac_gui.MySessionButton(master)¶
Bases:
tkinter.Button
Button widget.
- deepcinac.gui.cinac_gui.raise_above_all(window)¶
Take a window as argument (like tk.root()) and put it on front of all other :param window:
Returns:
Take a tkinter OptionMenu instance and load it using the fields of a matlab or npy file. :param file_name: string :param menu_tk: OptionMenu instance :param menu_variable: Variable from the menu :param keyword_for_key: string, keyword, if found in one of the field, this field will be selected by default :param in the menu:
Returns: a list of string representing the options of the menu
- class deepcinac.gui.cinac_gui.RawFormatOptionModule(button_text, label_text, with_file_dialog, file_dialog_filetypes, file_dialog_title, root, mandatory, with_only_label=False, with_check_box=False, label_check_box=None, check_box_active_by_default=True, active_label_text=None, with_option_menu=False, with_spin_box=False, menu_keyword_for_key=None, fct_to_call_at_update=None, last_path_open=None, height_button=3, command_fct=None, default_path=None, master=None)¶
Bases:
Tkinter.Frame
Frame widget which may contain other widgets and can have a 3D border.
- check_box_action()¶
- button_action()¶
- activate_only_label(enabling_button=False)¶
- activate_spin_box()¶
- set_file_value(with_file_dialog=True, file_name=None)¶
- deactivate(disabling_button=False)¶
Deactivate the module Returns:
- add_exclusive_modules(exclusive_modules)¶
Means that only one among self and exclusive_modules can be activated at once. When one is activated, the other are deactivated :param exclusive_modules: list of instance of RawFormatOptionModule
Returns:
- get_config_as_dict()¶
From the data gui in widgets, build a dictionnary used to save the parameters Returns:
- set_config_from_dict(config_dict)¶
From the data gui in widgets, build a dictionnary used to save the parameters Returns:
- class deepcinac.gui.cinac_gui.ChoiceRawFormatFrame(default_path=None, master=None)¶
Bases:
Tkinter.Frame
Frame widget which may contain other widgets and can have a 3D border.
- __configure(event)¶
- create_buttons()¶
Create buttons Returns:
- display_only_raw_traces_check_box_action()¶
- launch_exploratory_gui()¶
Returns:
- load_last_used_config()¶
- load_config()¶
Returns: None
- save_config(file_name=None)¶
- get_config_as_dict()¶
From the data gui in widgets, build a dictionnary used to save the paramters Returns:
- set_config_from_dict(config_dict)¶
From the data gui in widgets, build a dictionnary used to save the parameters Returns:
- update_launch_gui_button()¶
Update the launch gui button depending on the file being selected Returns:
- deepcinac.gui.cinac_gui.load_data_from_npy_or_mat_file(file_name, data_descr, attr_name=None)¶
Load data from a numpy or matlab file (.npz, .npz or .mat) :param file_name: :param data_descr: string used to display error message if the file is not in the good format :param attr_name:
Returns:
- class deepcinac.gui.cinac_gui.ChoiceFormatFrame(default_path=None, master=None)¶
Bases:
Tkinter.Frame
Frame widget which may contain other widgets and can have a 3D border.
- create_buttons()¶
- open_option_format_frame(format_str)¶
- deepcinac.gui.cinac_gui.display_loading_window(message, fct_to_run, args_for_fct)¶
- class deepcinac.gui.cinac_gui.ChoiceNwbFormatFrame(default_path=None, master=None)¶
Bases:
Tkinter.Frame
Frame widget which may contain other widgets and can have a 3D border.
- neuronal_data_check_box_action()¶
- activate_all_buttons()¶
- deactivate_all_buttons()¶
- __configure(event)¶
- select_nwb_file()¶
Open a file dialog to select to cinac file to open and then change the GUI accordingly Returns:
- _get_segmentations()¶
Returns: a dict that for each step till plane_segmentation represents the different option. First dict will have as keys the name of the modules, then for each modules the value will be a new dict with keys the ImageSegmentation names and then the value will be a list representing the segmentation plane
- get_pixel_mask(segmentation_info)¶
Return pixel_mask which is a list of list of pair of integers representing the pixels coordinate (x, y) for each cell. the list length is the same as the number of cells. :param segmentation_info: a list of 3 elements: first one being the name of the module, then the name :param of image_segmentation and then the name of the segmentation plane.:
Returns:
- _get_roi_response_serie_data(keys)¶
- Parameters
keys – lsit of string allowing to get the roi repsonse series wanted
Returns:
- _get_roi_response_series(keywords_to_exclude=None)¶
param: keywords_to_exclude: if not None, list of str, if one of neuronal data has this keyword, then we don’t add it to the choices
Returns: a list or dict of objects representing all roi response series (rrs) names rrs could represents raw traces, or binary raster, and its link to a given segmentation. The results returned should allow to identify the segmentation associated. Object could be strings, or a list of strings, that identify a rrs and give information how to get there.
- launch_exploratory_gui()¶
Returns:
- class deepcinac.gui.cinac_gui.ChoiceCinacFormatFrame(default_path=None, master=None)¶
Bases:
Tkinter.Frame
Frame widget which may contain other widgets and can have a 3D border.
- launch_exploratory_gui_for_a_segment(segment_selected)¶
Launch the exploratory GUI for a given segment :param segment_selected: tuple of 3 int representing the cell, first_frame and last_frame
Returns:
- launch_exploratory_gui()¶
Returns:
- select_ci_movie()¶
Open a file dialog to select to calcium imagine movie Returns:
- activate_all_buttons()¶
- deactivate_all_buttons()¶
- select_cinac_file()¶
Open a file dialog to select to cinac file to open and then change the GUI accordingly Returns:
- __configure(event)¶
- class deepcinac.gui.cinac_gui.ManualAction(session_frame, neuron, is_saved, x_limits=None, y_limits=None)¶
- undo()¶
- redo()¶
- class deepcinac.gui.cinac_gui.RemoveOnsetAction(removed_times, **kwargs)¶
Bases:
ManualAction
- undo()¶
- redo()¶
- class deepcinac.gui.cinac_gui.RemovePeakAction(removed_times, amplitudes, removed_onset_action=None, **kwargs)¶
Bases:
ManualAction
- undo()¶
- redo()¶
- class deepcinac.gui.cinac_gui.AgreePeakAction(agreed_peaks_index, agree_onset_action, agreed_peaks_values, peaks_added, **kwargs)¶
Bases:
ManualAction
- undo()¶
- redo()¶
- class deepcinac.gui.cinac_gui.DontAgreePeakAction(not_agreed_peaks_index, dont_agree_onset_action, not_agreed_peaks_values, **kwargs)¶
Bases:
ManualAction
- undo()¶
- redo()¶
- class deepcinac.gui.cinac_gui.DontAgreeOnsetAction(not_agreed_onsets_index, not_agreed_onsets_values, **kwargs)¶
Bases:
ManualAction
- undo()¶
- redo()¶
- class deepcinac.gui.cinac_gui.AgreeOnsetAction(agreed_onsets_index, agreed_onsets_values, onsets_added, **kwargs)¶
Bases:
ManualAction
- undo()¶
- redo()¶
- class deepcinac.gui.cinac_gui.AddOnsetAction(added_time, add_peak_action=None, **kwargs)¶
Bases:
ManualAction
- undo()¶
- redo()¶
- class deepcinac.gui.cinac_gui.AddThemAllAction(first_frame, last_frame, old_peak_values, new_peak_values, old_onset_values, new_onset_values, **kwargs)¶
Bases:
ManualAction
- undo()¶
- redo()¶
- class deepcinac.gui.cinac_gui.AddSegmentToSaveAction(segment_list, segment_added, **kwargs)¶
Bases:
ManualAction
- undo()¶
- redo()¶
- class deepcinac.gui.cinac_gui.RemoveSegmentToSaveAction(segment_list, segment_added, index_to_remove, **kwargs)¶
Bases:
ManualAction
- undo()¶
- redo()¶
- class deepcinac.gui.cinac_gui.AddPeakAction(added_time, amplitude, **kwargs)¶
Bases:
ManualAction
- undo()¶
- redo()¶
- class deepcinac.gui.cinac_gui.AddDoubtfulFramesAction(x_from, x_to, backup_values, **kwargs)¶
Bases:
ManualAction
- undo()¶
- redo()¶
- class deepcinac.gui.cinac_gui.RemoveDoubtfulFramesAction(removed_times, **kwargs)¶
Bases:
ManualAction
- undo()¶
- redo()¶
- class deepcinac.gui.cinac_gui.AddMvtFramesAction(x_from, x_to, backup_values, **kwargs)¶
Bases:
ManualAction
- undo()¶
- redo()¶
- class deepcinac.gui.cinac_gui.RemoveMvtFramesAction(removed_times, **kwargs)¶
Bases:
ManualAction
- undo()¶
- redo()¶
- deepcinac.gui.cinac_gui.get_file_name_and_path(path_file)¶
- deepcinac.gui.cinac_gui.do_traces_smoothing(traces)¶
- class deepcinac.gui.cinac_gui.MyCanvas(figure, parent_frame, manual_onset_frame)¶
Bases:
matplotlib.backends.backend_tkagg.FigureCanvasTkAgg
The canvas the figure renders into.
- figure¶
A high-level figure instance.
- Type
matplotlib.figure.Figure
- button_press_event(event, **args)¶
Callback processing for mouse button press events.
Backend derived classes should call this function on any mouse button press. (x, y) are the canvas coords ((0, 0) is lower left). button and key are as defined in MouseEvent.
This method will call all functions connected to the ‘button_press_event’ with a MouseEvent instance.
- class deepcinac.gui.cinac_gui.ManualOnsetFrame(data_and_param, default_path=None, segment_mode=False, parent=None, title=None)¶
Bases:
Tkinter.Frame
Frame widget which may contain other widgets and can have a 3D border.
- RAW_TRACE = 'Cell'¶
- RAW_TRACE_WITHOUT_OVERLAP = 'Cell no over'¶
- NEUROPIL_TRACE = 'Neuropil (Np)'¶
- RAW_M_NEUROPIL_TRACE = 'Cell no over - Np'¶
- neuron_entry_change(*args)¶
- switch_michou()¶
- _build_traces()¶
Build different fluorescence signal for each cell. Fill the self.traces_dict, each key is a trace description (str), and each value is a 2d array (n cells * n frames) Returns:
- switch_movie_mode(from_movie_button=True)¶
- switch_mvt_display()¶
- switch_magnifier()¶
- set_inter_neuron()¶
- remove_cell()¶
- clear_and_update_center_segment_entry_widget()¶
- clear_and_update_entry_neuron_widget()¶
- clear_and_update_entry_cell_type_widget()¶
- update_uncertain_prediction_values(event=None)¶
Update the widget that contain the limit of the prediction we want to look at :param event: :return:
- center_segment_button_action(event=None)¶
- cell_type_action(event=None)¶
Action called when the entry widget for cell type is called :param event:
Returns:
- go_to_neuron_button_action(event=None)¶
- key_press_action(event)¶
- key_release_action(event)¶
- detect_onset_associated_to_peak(peak_times)¶
Return an array with the onset times (from trace time) associated to the peak_times. We look before each peak_time (1sec before), for current_neurons :param peak_times: :return:
- update_onset_times()¶
- numbers_of_onset()¶
- numbers_of_peak()¶
- numbers_of_onset_to_agree()¶
- numbers_of_peak_to_agree()¶
- swith_all_click_actions(initiator)¶
- center_segment_swith_mode(from_center_segment_button=True)¶
- switch_prediction_improvement_mode()¶
Allows to display a signal that might change a prediction according for ex to neuropil variation or transient correlation. Mode only active if predictions are available Returns:
- compute_prediction_improvement_for_cell(cell)¶
COmpute prediction improvement only if predictions available for this cell :param cell:
Returns:
- add_onset_switch_mode(with_peak=False, from_add_onset_button=True)¶
- Parameters
with_peak – if True, then a peak after onset will be added automatically
from_add_onset_button –
Returns:
- remove_onset_switch_mode(from_remove_onset_button=True)¶
- add_doubtful_frames_switch_mode(from_add_doubtful_frames_button=True)¶
- remove_doubtful_frames_switch_mode(from_remove_doubtful_frames_button=True)¶
- add_mvt_frames_switch_mode(from_add_mvt_frames_button=True)¶
- remove_mvt_frames_switch_mode(from_remove_mvt_frames_button=True)¶
- update_transient_prediction_periods_to_check()¶
- update_predictions_list_box(keep_same_selected_index=False)¶
- update_segments_to_save_list_box(initial_loading=False)¶
- segments_to_save_list_box_double_click(evt)¶
Called when a double click is done on segments to save list_box. It removes from the list the element that is double clicked :param evt:
Returns:
- remove_segment_to_save(index_to_remove)¶
- change_prediction_transient_to_look_at(period)¶
CHange the plot such as the period indicated is displayed :param period: a tuple of len 4: cell, x_left, x_right, pred :return:
- predictions_list_box_click(evt)¶
- segments_to_save_list_box_click(evt)¶
- predictions_list_box_double_click(evt)¶
- add_current_segment_to_save_list()¶
Add the current view as a segment. The view should have a minimum of 10 frames. The view should not be already added. Returns:
- update_contour_for_cell(cell)¶
- agree_switch_mode(from_agree_button=True)¶
- dont_agree_switch_mode(from_dont_agree_button=True)¶
- remove_peak_switch_mode(from_remove_peak_button=True)¶
- remove_all_switch_mode(from_remove_all_button=True)¶
- onrelease_map(event)¶
Action when a mouse button is released on cell map :param event: :return:
- onrelease(event)¶
Action when a mouse button is released :param event: :return:
- motion(event)¶
Action when the mouse is moved :param event: :return:
- onclick(event)¶
Action when a mouse button is pressed :param event: :return:
- remove_onset(x_from, x_to)¶
- dont_agree_on_fusion(x_from, x_to)¶
- agree_on_fusion(x_from, x_to)¶
- remove_all(x_from, x_to)¶
- remove_peaks_under_threshold()¶
- remove_peak(x_from, x_to)¶
- switch_trace_to_be_displayed(trace_str)¶
Called when one of the trace checkbox change selection. Allows to change the trace displayed
Returns:
- switch_source_profile_mode(from_check_box=True, from_key_shortcut=False, from_magnifier=False)¶
- activate_movie_zoom(from_check_box=True)¶
- set_transient_classifier_prediction_for_cell(cell)¶
- transient_classifier_check_box_action()¶
- set_cell_type_classifier_prediction_for_cell(cell)¶
- cell_type_classifier_button_action()¶
Method called when pushing cell type classification button Returns:
- display_cell_type_predictions()¶
Display in the cell type labels the predictions for the current_neuron Returns:
- correlation_check_box_action(from_std_treshold=False)¶
- threshold_check_box_action(from_correlation=False)¶
- spin_box_pixels_around_cell_update()¶
- spin_box_transient_classifier_update()¶
- spin_box_threshold_update()¶
- spin_box_correlation_update()¶
- unsaved()¶
means a changed has been done, and the actual plot is not saved
- update_doubtful_frames_periods(cell)¶
- update_mvt_frames_periods(cell)¶
- normalize_traces()¶
Normalize the fluorescence signal using z-score and change the value of smooth smooth_traces so there are displayed under the raw smooth_traces Returns:
- add_onset(at_time)¶
- add_peak(at_time, amplitude=0)¶
- update_last_action(new_action, from_redo_action=False)¶
Keep the size of the last_actions up to five actions :param new_action: :return:
- add_peak_switch_mode(from_add_peak_button=True)¶
- Parameters
from_add_peak_button – indicate the user click on the add_peak button, otherwise it means the
function has been called after another button has been clicked :return:
- remove_doubtful_frames(x_from, x_to)¶
- add_doubtful_frames(x_from, x_to)¶
- remove_mvt_frames(x_from, x_to)¶
- add_mvt_frames(x_from, x_to)¶
- validation_before_closing()¶
- redo_action()¶
- undo_action()¶
Revoke the last action :return:
- save_sources_profile_map(key_cmap=None)¶
- get_square_coord_around_cell(cell, x_len_max, y_len_max, square_size)¶
- Parameters
cell –
x_len_max – max x value (border of the movie)
y_len_max – max y value (border of the movie)
square_size – number of pixels that compose the border of the square
Returns: Two int representing the minx and miny of the square that will be used to train the classifier
- save_segments(and_close=False)¶
- save_segments_as(and_close=False)¶
Open a filedialog to save the data in a .cinac extension (hdf5 format). The data saved correspond to the onset and peak for the cells and frames displayed over the smooth_traces. Returns: None
- get_threshold()¶
- plot_magnifier(first_time=False, mouse_x_position=None, mouse_y_position=None)¶
Plot the magnifier :param first_time: if True, means the function is called for the first time, allow sto initialize some variables. :param mouse_x_position: indicate the x position of the mouse cursor :param mouse_y_position: indicate the y position of the mouse cursor :return: None
- draw_magnifier_marker(mouse_x_position=None, mouse_y_position=None)¶
- corr_between_source_and_transient(cell, transient, pixels_around=1, redo_computation=False)¶
- Parameters
cell – int
transient – (int, int) first_frame and last_frame
pixels_around –
redo_computation – if True, means that even if the correlation has been done before for the peak,
it will be redo (useful if the onset has changed for exemple :return:
- compute_source_and_transients_correlation(main_cell, redo_computation=False, with_overlapping_cells=True)¶
Compute the source and transient profiles of a given cell. Should be call for each new neuron displayed :param cell: :param redo_computation: if True, means that even if the correlation has been done before for this cell, it will be redo (useful if the onsets or peaks has changed for exemple) :return:
- plot_source_transient(transient)¶
- get_source_profile(cell, pixels_around=0, bounds=None, buffer=None, with_full_frame=False)¶
- Parameters
cell –
pixels_around –
bounds –
buffer –
with_full_frame – Average the full frame
- Returns
- get_transient_profile(cell, transient, pixels_around=0, bounds=None)¶
- get_cell_new_coord_in_source(cell, minx, miny)¶
- update_plot_magnifier(mouse_x_position, mouse_y_position, change_frame_ref)¶
- start_playing_movie(x_from, x_to)¶
- square_coord_around_cell(cell, size_square, x_len_max, y_len_max)¶
For a given cell, give the coordinates of the square surrounding the cell.
- Parameters
cell –
size_square –
x_len_max –
y_len_max –
- Returns
(x_beg, x_end, y_beg, y_end)
- animate_movie(i)¶
- plot_map_img(first_time=True, after_movie=False)¶
- draw_cell_contour()¶
- update_plot_map_img(after_michou=False, after_movie=False)¶
- plot_graph(first_time=False)¶
- Parameters
first_time –
- Returns
- current_max_amplitude()¶
Ceiling value :return:
- move_zoom(to_the_left)¶
- add_them_all()¶
Add all possible onset and peaks based on change of derivative in the smooth trace Returns:
- update_plot(new_neuron=False, amplitude_zoom_fit=True, new_x_limit=None, new_y_limit=None, changing_face_color=False, new_trace=False, raw_trace_display_action=False)¶
- Parameters
new_neuron –
amplitude_zoom_fit –
new_x_limit –
new_y_limit –
changing_face_color –
new_trace – if True, means the trace has changed, and so we want to adapt the y-axis limit
raw_trace_display_action –
Returns:
- update_to_agree_label()¶
- update_after_onset_change(new_neuron=-1, new_x_limit=None, new_y_limit=None)¶
Update the frame if an onset change has been made :param new_neuron: if -1, then the neuron hasn’t changed, neuron might change if undo or redo are done. :return:
- select_previous_neuron()¶
- select_next_neuron()¶
- go_to_next_cell_with_same_type()¶
If cell typeis know, allows to display the next cell from the cell type as the cell actualy displayed Returns:
- update_neuron(new_neuron, new_x_limit=None, new_y_limit=None, amplitude_zoom_fit=True)¶
Call when the neuron number has changed :return:
- deepcinac.gui.cinac_gui.print_save(text, file, to_write, no_print=False)¶
- deepcinac.gui.cinac_gui.merge_close_values(raster, raster_to_fill, cell, merging_threshold)¶
- Parameters
raster – Raster is a 2d binary array, lines represents cells, columns binary values
cell – which cell to merge
merging_threshold – times separation between two values under which to merge them
- Returns
- deepcinac.gui.cinac_gui.fusion_gui_selection(path_data)¶
- deepcinac.gui.cinac_gui.launch_cinac_gui()¶