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. Calls the draw and print fig |
|
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) |
|
|
|
|
|
|
|
|
|
|
|
|
-
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
(self)¶
-
activate_only_label
(self, enabling_button=False)¶
-
activate_spin_box
(self)¶
-
set_file_value
(self, with_file_dialog=True, file_name=None)¶
-
deactivate
(self, disabling_button=False)¶ Deactivate the module Returns:
-
add_exclusive_modules
(self, 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
(self)¶ From the data gui in widgets, build a dictionnary used to save the parameters Returns:
-
set_config_from_dict
(self, 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
(self, event)¶
Create buttons Returns:
-
display_only_raw_traces_check_box_action
(self)¶
-
launch_exploratory_gui
(self)¶ Returns:
-
load_last_used_config
(self)¶
-
load_config
(self)¶ Returns: None
-
save_config
(self, file_name=None)¶
-
get_config_as_dict
(self)¶ From the data gui in widgets, build a dictionnary used to save the paramters Returns:
-
set_config_from_dict
(self, config_dict)¶ From the data gui in widgets, build a dictionnary used to save the parameters Returns:
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.
-
open_option_format_frame
(self, 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
(self)¶
-
__configure
(self, event)¶
-
select_nwb_file
(self)¶ Open a file dialog to select to cinac file to open and then change the GUI accordingly Returns:
-
_get_segmentations
(self)¶ 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
(self, 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
(self, keys)¶ - Parameters
keys – lsit of string allowing to get the roi repsonse series wanted
Returns:
-
_get_roi_response_series
(self, 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
(self)¶ 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
(self, 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
(self)¶ Returns:
-
select_ci_movie
(self)¶ Open a file dialog to select to calcium imagine movie Returns:
-
select_cinac_file
(self)¶ Open a file dialog to select to cinac file to open and then change the GUI accordingly Returns:
-
__configure
(self, event)¶
-
-
class
deepcinac.gui.cinac_gui.
ManualAction
(session_frame, neuron, is_saved, x_limits=None, y_limits=None)¶ -
undo
(self)¶
-
redo
(self)¶
-
-
class
deepcinac.gui.cinac_gui.
RemoveOnsetAction
(removed_times, **kwargs)¶ Bases:
deepcinac.gui.cinac_gui.ManualAction
-
undo
(self)¶
-
redo
(self)¶
-
-
class
deepcinac.gui.cinac_gui.
RemovePeakAction
(removed_times, amplitudes, removed_onset_action=None, **kwargs)¶ Bases:
deepcinac.gui.cinac_gui.ManualAction
-
undo
(self)¶
-
redo
(self)¶
-
-
class
deepcinac.gui.cinac_gui.
AgreePeakAction
(agreed_peaks_index, agree_onset_action, agreed_peaks_values, peaks_added, **kwargs)¶ Bases:
deepcinac.gui.cinac_gui.ManualAction
-
undo
(self)¶
-
redo
(self)¶
-
-
class
deepcinac.gui.cinac_gui.
DontAgreePeakAction
(not_agreed_peaks_index, dont_agree_onset_action, not_agreed_peaks_values, **kwargs)¶ Bases:
deepcinac.gui.cinac_gui.ManualAction
-
undo
(self)¶
-
redo
(self)¶
-
-
class
deepcinac.gui.cinac_gui.
DontAgreeOnsetAction
(not_agreed_onsets_index, not_agreed_onsets_values, **kwargs)¶ Bases:
deepcinac.gui.cinac_gui.ManualAction
-
undo
(self)¶
-
redo
(self)¶
-
-
class
deepcinac.gui.cinac_gui.
AgreeOnsetAction
(agreed_onsets_index, agreed_onsets_values, onsets_added, **kwargs)¶ Bases:
deepcinac.gui.cinac_gui.ManualAction
-
undo
(self)¶
-
redo
(self)¶
-
-
class
deepcinac.gui.cinac_gui.
AddOnsetAction
(added_time, add_peak_action=None, **kwargs)¶ Bases:
deepcinac.gui.cinac_gui.ManualAction
-
undo
(self)¶
-
redo
(self)¶
-
-
class
deepcinac.gui.cinac_gui.
AddThemAllAction
(first_frame, last_frame, old_peak_values, new_peak_values, old_onset_values, new_onset_values, **kwargs)¶ Bases:
deepcinac.gui.cinac_gui.ManualAction
-
undo
(self)¶
-
redo
(self)¶
-
-
class
deepcinac.gui.cinac_gui.
AddSegmentToSaveAction
(segment_list, segment_added, **kwargs)¶ Bases:
deepcinac.gui.cinac_gui.ManualAction
-
undo
(self)¶
-
redo
(self)¶
-
-
class
deepcinac.gui.cinac_gui.
RemoveSegmentToSaveAction
(segment_list, segment_added, index_to_remove, **kwargs)¶ Bases:
deepcinac.gui.cinac_gui.ManualAction
-
undo
(self)¶
-
redo
(self)¶
-
-
class
deepcinac.gui.cinac_gui.
AddPeakAction
(added_time, amplitude, **kwargs)¶ Bases:
deepcinac.gui.cinac_gui.ManualAction
-
undo
(self)¶
-
redo
(self)¶
-
-
class
deepcinac.gui.cinac_gui.
AddDoubtfulFramesAction
(x_from, x_to, backup_values, **kwargs)¶ Bases:
deepcinac.gui.cinac_gui.ManualAction
-
undo
(self)¶
-
redo
(self)¶
-
-
class
deepcinac.gui.cinac_gui.
RemoveDoubtfulFramesAction
(removed_times, **kwargs)¶ Bases:
deepcinac.gui.cinac_gui.ManualAction
-
undo
(self)¶
-
redo
(self)¶
-
-
class
deepcinac.gui.cinac_gui.
AddMvtFramesAction
(x_from, x_to, backup_values, **kwargs)¶ Bases:
deepcinac.gui.cinac_gui.ManualAction
-
undo
(self)¶
-
redo
(self)¶
-
-
class
deepcinac.gui.cinac_gui.
RemoveMvtFramesAction
(removed_times, **kwargs)¶ Bases:
deepcinac.gui.cinac_gui.ManualAction
-
undo
(self)¶
-
redo
(self)¶
-
-
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. Calls the draw and print fig methods, creates the renderers, etc…
-
figure
¶ A high-level Figure instance
- Type
matplotlib.figure.Figure
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 be 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
(self, *args)¶
-
switch_michou
(self)¶
-
_build_traces
(self)¶ 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
(self, from_movie_button=True)¶
-
switch_mvt_display
(self)¶
-
switch_magnifier
(self)¶
-
set_inter_neuron
(self)¶
-
remove_cell
(self)¶
-
clear_and_update_center_segment_entry_widget
(self)¶
-
clear_and_update_entry_neuron_widget
(self)¶
-
clear_and_update_entry_cell_type_widget
(self)¶
-
update_uncertain_prediction_values
(self, event=None)¶ Update the widget that contain the limit of the prediction we want to look at :param event: :return:
-
cell_type_action
(self, event=None)¶ Action called when the entry widget for cell type is called :param event:
Returns:
-
key_press_action
(self, event)¶
-
key_release_action
(self, event)¶
-
detect_onset_associated_to_peak
(self, 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
(self)¶
-
numbers_of_onset
(self)¶
-
numbers_of_peak
(self)¶
-
numbers_of_onset_to_agree
(self)¶
-
numbers_of_peak_to_agree
(self)¶
-
swith_all_click_actions
(self, initiator)¶
-
center_segment_swith_mode
(self, from_center_segment_button=True)¶
-
switch_prediction_improvement_mode
(self)¶ 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
(self, cell)¶ COmpute prediction improvement only if predictions available for this cell :param cell:
Returns:
-
add_onset_switch_mode
(self, 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
(self, from_remove_onset_button=True)¶
-
add_doubtful_frames_switch_mode
(self, from_add_doubtful_frames_button=True)¶
-
remove_doubtful_frames_switch_mode
(self, from_remove_doubtful_frames_button=True)¶
-
add_mvt_frames_switch_mode
(self, from_add_mvt_frames_button=True)¶
-
remove_mvt_frames_switch_mode
(self, from_remove_mvt_frames_button=True)¶
-
update_transient_prediction_periods_to_check
(self)¶
-
update_predictions_list_box
(self, keep_same_selected_index=False)¶
-
update_segments_to_save_list_box
(self, initial_loading=False)¶
-
segments_to_save_list_box_double_click
(self, 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
(self, index_to_remove)¶
-
change_prediction_transient_to_look_at
(self, 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
(self, evt)¶
-
segments_to_save_list_box_click
(self, evt)¶
-
predictions_list_box_double_click
(self, evt)¶
-
add_current_segment_to_save_list
(self)¶ 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
(self, cell)¶
-
agree_switch_mode
(self, from_agree_button=True)¶
-
dont_agree_switch_mode
(self, from_dont_agree_button=True)¶
-
remove_peak_switch_mode
(self, from_remove_peak_button=True)¶
-
remove_all_switch_mode
(self, from_remove_all_button=True)¶
-
onrelease_map
(self, event)¶ Action when a mouse button is released on cell map :param event: :return:
-
onrelease
(self, event)¶ Action when a mouse button is released :param event: :return:
-
motion
(self, event)¶ Action when the mouse is moved :param event: :return:
-
onclick
(self, event)¶ Action when a mouse button is pressed :param event: :return:
-
remove_onset
(self, x_from, x_to)¶
-
dont_agree_on_fusion
(self, x_from, x_to)¶
-
agree_on_fusion
(self, x_from, x_to)¶
-
remove_all
(self, x_from, x_to)¶
-
remove_peaks_under_threshold
(self)¶
-
remove_peak
(self, x_from, x_to)¶
-
switch_trace_to_be_displayed
(self, trace_str)¶ Called when one of the trace checkbox change selection. Allows to change the trace displayed
Returns:
-
switch_source_profile_mode
(self, from_check_box=True, from_key_shortcut=False, from_magnifier=False)¶
-
activate_movie_zoom
(self, from_check_box=True)¶
-
set_transient_classifier_prediction_for_cell
(self, cell)¶
-
transient_classifier_check_box_action
(self)¶
-
set_cell_type_classifier_prediction_for_cell
(self, cell)¶
Method called when pushing cell type classification button Returns:
-
display_cell_type_predictions
(self)¶ Display in the cell type labels the predictions for the current_neuron Returns:
-
correlation_check_box_action
(self, from_std_treshold=False)¶
-
threshold_check_box_action
(self, from_correlation=False)¶
-
spin_box_pixels_around_cell_update
(self)¶
-
spin_box_transient_classifier_update
(self)¶
-
spin_box_threshold_update
(self)¶
-
spin_box_correlation_update
(self)¶
-
unsaved
(self)¶ means a changed has been done, and the actual plot is not saved
-
update_doubtful_frames_periods
(self, cell)¶
-
update_mvt_frames_periods
(self, cell)¶
-
normalize_traces
(self)¶ 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
(self, at_time)¶
-
add_peak
(self, at_time, amplitude=0)¶
-
update_last_action
(self, 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
(self, 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
(self, x_from, x_to)¶
-
add_doubtful_frames
(self, x_from, x_to)¶
-
remove_mvt_frames
(self, x_from, x_to)¶
-
add_mvt_frames
(self, x_from, x_to)¶
-
validation_before_closing
(self)¶
-
redo_action
(self)¶
-
undo_action
(self)¶ Revoke the last action :return:
-
save_sources_profile_map
(self, key_cmap=None)¶
-
get_square_coord_around_cell
(self, 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
(self, and_close=False)¶
-
save_segments_as
(self, 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
(self)¶
-
plot_magnifier
(self, 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
(self, mouse_x_position=None, mouse_y_position=None)¶
-
corr_between_source_and_transient
(self, 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
(self, 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
(self, transient)¶
-
get_source_profile
(self, 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
(self, cell, transient, pixels_around=0, bounds=None)¶
-
get_cell_new_coord_in_source
(self, cell, minx, miny)¶
-
update_plot_magnifier
(self, mouse_x_position, mouse_y_position, change_frame_ref)¶
-
start_playing_movie
(self, x_from, x_to)¶
-
square_coord_around_cell
(self, 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
(self, i)¶
-
plot_map_img
(self, first_time=True, after_movie=False)¶
-
draw_cell_contour
(self)¶
-
update_plot_map_img
(self, after_michou=False, after_movie=False)¶
-
plot_graph
(self, first_time=False)¶ - Parameters
first_time –
- Returns
-
current_max_amplitude
(self)¶ Ceiling value :return:
-
move_zoom
(self, to_the_left)¶
-
add_them_all
(self)¶ Add all possible onset and peaks based on change of derivative in the smooth trace Returns:
-
update_plot
(self, 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
(self)¶
-
update_after_onset_change
(self, 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
(self)¶
-
select_next_neuron
(self)¶
-
go_to_next_cell_with_same_type
(self)¶ If cell typeis know, allows to display the next cell from the cell type as the cell actualy displayed Returns:
-
update_neuron
(self, 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
()¶