Social reward outcompetes drug seeking dopaminergic ensembles to prevent relapse.
The 1 match
- [1] § Methods › Cell registration across sessions ↔ GUI/CellReg.m, lines 1–91 · score 0.61 · CellReg, cellular activity, scored, events, MATLAB, neurons
Paper
Loaded from Europe PMC by your browser, not stored by OSCR: doi.org · Europe PMC
The paper is loaded when this pane is shown.
The authors' code
MATLAB · 2,236 lines · 108 KB · GPL-2.0 · 1 match
- function varargout = CellReg(varargin)
- % This GUI is an implementation of a probabilistic approach for the
- % identification of the same neurons (cell registration) across multiple sessions
- % in Ca2+ imaging data, developed by Sheintuch et al., 2017.
- % Input: The inputs for the cell registration method are the spatial footprints of
- % cellular activity of the cells that were detected in the different
- % sessions. Each spatial footprint is a matrix the size of the frame and
- % each pixel's value represents its contribution to the
- % cell's fluorescence.
- % Output: The main output for the cell registration method is the obtained mapping of
- % cell identity across all registered sessions. It is a matrix the size of
- % the final number of registered cells by the number of registered
- % sessions. Each entry holds the index for the cell in a given session.
- % Other outputs include:
- % 1) register scores - providing with the registration quality of each cell register
- % 2) log file - with all the relevant information regarding the data, registration
- % configurations, and a summary of the registration results and quality.
- % 3) figures - important figures that are saved automatically.
- % The GUI includes the following stages:
- % 1) Loading the spatial footprints of cellular activity from the different sessions.
- % 2) Transforming all the sessions to a reference coordinate system using
- % rigid-body transformation.
- % 3) Computing a probabilistic model of the spatial footprints similarities
- % of neighboring cell-pairs from different sessions using the centroid
- % distances and spatial correlations.
- % 4) Obtaining an initial cell registration according to an optimized registration threshold.
- % 5) Obtaining the final cell registration based on a correlation clustering algorithm.
- % CellReg MATLAB code for CellReg.fig
- % CellReg, by itself, creates a new CellReg or raises the existing
- % singleton*.
- %
- % H = CellReg returns the handle to a new CellReg or the handle to
- % the existing singleton*.
- %
- % CellReg('CALLBACK',hObject,eventData,handles,...) calls the local
- % function named CALLBACK in CellReg.M with the given input arguments.
- %
- % CellReg('Property','Value',...) creates a new CellReg or raises the
- % existing singleton*. Starting from the left, property value pairs are
- % applied to the GUI before CellReg_OpeningFcn gets called. An
- % unrecognized property name or invalid value makes property application
- % stop. All inputs are passed to CellReg_OpeningFcn via varargin.
- %
- % *See GUI Options on GUIDE's Tools menu. Choose "GUI allows only one
- % instance to run (singleton)".
- %
- % See also: GUIDE, GUIDATA, GUIHANDLES
- % Edit the above text to modify the response to help CellReg
- % Last Modified by GUIDE v2.5 19-Mar-2018 16:44:19
- % reset figure properties to default:
- if verLessThan('matlab','8.4')
- % MATLAB R2014a and earlier
- % if there are problems with GUI and figures change properties back to default
- else
- % MATLAB R2014b and later
- reset(0);
- end
- % Begin initialization code - DO NOT EDIT
- gui_Singleton = 1;
- gui_State = struct('gui_Name', mfilename, ...
- 'gui_Singleton', gui_Singleton, ...
- 'gui_OpeningFcn', @CellReg_OpeningFcn, ...
- 'gui_OutputFcn', @CellReg_OutputFcn, ...
- 'gui_LayoutFcn', [] , ...
- 'gui_Callback', []);
- if nargin && ischar(varargin{1})
- gui_State.gui_Callback = str2func(varargin{1});
- end
- if nargout
- [varargout{1:nargout}] = gui_mainfcn(gui_State, varargin{:});
- else
- gui_mainfcn(gui_State, varargin{:});
- end
- % End initialization code - DO NOT EDIT
- % --- Executes just before CellReg is made visible.
- function CellReg_OpeningFcn(hObject,~, handles, varargin)
- % This function has no output args, see OutputFcn.
- % hObject handle to figure
- % eventdata reserved - to be defined in a future version of MATLAB
- % handles struct with handles and user data (see GUIDATA)
- % varargin command line arguments to CellReg (see VARARGIN)
- % Choose default command line output for CellReg
- handles.output = hObject;
- % Update handles struct
- guidata(hObject, handles);
- % UIWAIT makes CellReg wait for user response (see UIRESUME)
- % uiwait(handles.figure1);
- % defining data struct:
- data_struct=struct;
- data_struct.sessions_list=[];
- % Reseting figures and GUI parameters:
- cla(handles.axes1,'reset')
- axes(handles.axes1);
- plot([],[])
- set(gca,'xtick',[])
- set(gca,'ytick',[])
- cla(handles.axes2,'reset')
- axes(handles.axes2);
- plot([],[])
- set(gca,'xtick',[])
- set(gca,'ytick',[])
- cla(handles.axes3,'reset')
- axes(handles.axes3);
- plot([],[])
- set(gca,'xtick',[])
- set(gca,'ytick',[])
- cla(handles.axes4,'reset')
- axes(handles.axes4);
- plot([],[])
- set(gca,'xtick',[])
- set(gca,'ytick',[])
- cla(handles.axes5,'reset')
- axes(handles.axes5);
- plot([],[])
- set(gca,'xtick',[])
- set(gca,'ytick',[])
- cla(handles.axes6,'reset')
- axes(handles.axes6);
- plot([],[])
- set(gca,'xtick',[])
- set(gca,'ytick',[])
- cla(handles.axes7,'reset')
- axes(handles.axes7);
- logo=imread('CellReg_Logo.png');
- imagesc(logo);
- set(gca,'xtick',[])
- set(gca,'ytick',[])
- data_struct.sessions_list=[];
- set(handles.list_of_sessions,'value',1)
- set(handles.list_of_sessions,'string',[]);
- set(handles.green_session,'string','2')
- set(handles.blue_session,'string','3')
- set(handles.decision_thresh,'string','0.5')
- set(handles.initial_p_same_slider,'value',0.5);
- set(handles.initial_p_same_threshold,'string','0.5');
- set(handles.final_p_same_slider,'value',0.5);
- set(handles.model_maximal_distance,'string','14')
- set(handles.distance_threshold,'string','5')
- set(handles.correlation_threshold,'string','0.65')
- set(handles.simple_distance_threshold,'string','5')
- set(handles.simple_correlation_threshold,'string','0.65')
- set(handles.figures_visibility_on,'Value',1);
- set(handles.write2file_on, 'Value', 0);
- set(handles.translations_rotations,'Value',1);
- set(handles.spatial_correlations_2,'Value',1);
- set(handles.spatial_correlations,'Value',1);
- set(handles.use_model,'Value',1);
- set(handles.microns_per_pixel,'string',[])
- set(handles.microns_per_pixel,'value',0)
- set(handles.microns_per_pixel,'backgroundColor',[1 1 1]);
- set(handles.reference_session_index,'string','1')
- set(handles.maximal_rotation','string','30')
- set(handles.maximal_rotation','enable','on')
- set(handles.transformation_smoothness,'string','2')
- set(handles.transformation_smoothness,'enable','off')
- set(handles.distance_threshold,'enable','off')
- set(handles.correlation_threshold,'enable','on')
- set(handles.decision_thresh,'enable','on')
- set(handles.simple_distance_threshold,'enable','off')
- set(handles.simple_correlation_threshold,'enable','off')
- set(handles.comments,'string',[])
- handles.data_struct=data_struct;
- guidata(hObject, handles);
- % --- Outputs from this function are returned to the command line.
- function varargout = CellReg_OutputFcn(~, ~, handles)
- % varargout cell array for returning output args (see VARARGOUT);
- % hObject handle to figure
- % eventdata reserved - to be defined in a future version of MATLAB
- % handles struct with handles and user data (see GUIDATA)
- % Get default command line output from handles struct
- varargout{1} = handles.output;
- % --------------------------------------------------------------------
- function load_new_data_Callback(hObject,~, handles)
- % hObject handle to load_new_data (see GCBO)
- % eventdata reserved - to be defined in a future version of MATLAB
- % handles struct with handles and user data (see GUIDATA)
- % Stage 1: Loading the spatial footprints of cellular activity from the different
- % sessions.
- % This callback loads a new data set which includes several sessions with
- % their spatial footprints, centroid locations (optional), and events (optional). A
- % single folder should be selected with all the mat files with number:
- % example: "finalFiltersMat_1", "finalFiltersMat_2", "finalEventsMat_1", "finalEventsMat_2"
- data_struct=handles.data_struct;
- % choosing the files to load:
- msgbox_timed('Please choose the files containing the spatial footprints from all the sessions: ',3)
- [file_names,files_path]=uigetfile('*.mat','MultiSelect','on',...
- 'Choose spatial footprints from all the sessions: ' );
- % in case only one file is selected uigetfile will return a char and not a
- % cell, and thus make later code bug.
- if ischar(file_names)
- warndlg_timed('To process only one session you should use Add Session button',3)
- return
- end
- number_of_sessions=size(file_names,2);
- sessions_list=cell(1,number_of_sessions);
- temp_file_names=cell(1,number_of_sessions);
- for n=1:number_of_sessions
- sessions_list{1,n}=['Session ' num2str(n) ' - ' files_path file_names{1,n}];
- temp_file_names{1,n}=[files_path file_names{1,n}];
- end
- file_names=temp_file_names;
- % defining the microns per pixel ratio:
- microns_per_pixel=str2num(get(handles.microns_per_pixel,'string'));
- if isempty(microns_per_pixel)
- msgbox_timed('Please insert the pixel size in microns and press enter ',3);
- set(handles.microns_per_pixel,'backgroundColor',[1 0.5 0.5]);
- waitfor(handles.microns_per_pixel,'value',1);
- microns_per_pixel=str2num(get(handles.microns_per_pixel,'string'));
- end
- set(handles.microns_per_pixel,'string',num2str(round(100*microns_per_pixel)/100));
- set(handles.microns_per_pixel,'backgroundColor',[1 1 1]);
- % defining the results directory:
- msgbox_timed('Please select the folder in which the results will be saved',3)
- results_directory=uigetdir(files_path); % the directory which the final results will be saved
- figures_directory=fullfile(results_directory,'Figures');
- if exist(figures_directory,'dir')~=7
- mkdir(figures_directory);
- end
- if get(handles.figures_visibility_on,'Value');
- figures_visibility='On';
- else
- figures_visibility='Off';
- end
- % loading the spatial footprints:
- disp('Stage 1 - Loading sessions')
- if get(handles.write2file_on,'Value')
- spatial_footprints = file_names;
- number_of_sessions = length(file_names);
- else
- [spatial_footprints,number_of_sessions]=load_multiple_sessions(file_names);
- end
- [footprints_projections]=compute_footprints_projections(spatial_footprints);
- plot_all_sessions_projections(footprints_projections,figures_directory,figures_visibility)
- % saving the loaded data into the data struct for the GUI
- if get(handles.write2file_on,'Value')
- data_struct.temp_dir = [figures_directory, filesep, 'temp'];
- if ~exist(data_struct.temp_dir)
- mkdir(data_struct.temp_dir);
- end
- else
- data_struct.temp_dir = [];
- end
- data_struct.results_directory=results_directory;
- data_struct.figures_directory=figures_directory;
- data_struct.microns_per_pixel=microns_per_pixel;
- data_struct.spatial_footprints=spatial_footprints;
- data_struct.footprints_projections=footprints_projections;
- data_struct.number_of_sessions=number_of_sessions;
- data_struct.sessions_list=sessions_list;
- data_struct.file_names=file_names;
- set(handles.list_of_sessions,'string',data_struct.sessions_list);
- handles.data_struct=data_struct;
- guidata(hObject, handles)
- disp('Done')
- msgbox_timed('Finished loading sessions',3)
- % --- Executes on button press in add_session.
- function add_session_Callback(hObject,~, handles)
- % hObject handle to add_session (see GCBO)
- % eventdata reserved - to be defined in a future version of MATLAB
- % handles struct with handles and user data (see GUIDATA)
- % This callback adds another session to the list of sessions to be
- % registered. The folder containg the filters, centroid_locations, and events
- % (optional) should be selected
- data_struct=handles.data_struct;
- if get(handles.figures_visibility_on,'Value');
- figures_visibility='On';
- else
- figures_visibility='Off';
- end
- if isfield(data_struct,'spatial_footprints') % some sessions were already loaded
- spatial_footprints=data_struct.spatial_footprints;
- number_of_sessions=data_struct.number_of_sessions;
- file_names=data_struct.file_names;
- sessions_list=data_struct.sessions_list;
- results_directory=data_struct.results_directory;
- % loading the session:
- msgbox_timed('Please choose the file with the spatial footprints for this session: ',1)
- [file_name,file_path]=uigetfile(strcat(results_directory,filesep,'*.mat'),...
- 'Choose the file with the spatial footprints for this session: ','MultiSelect','off');
- number_of_sessions=number_of_sessions+1;
- file_names{number_of_sessions}=[file_path file_name];
- sessions_list{number_of_sessions}=['Session ' num2str(number_of_sessions) ' - ' file_path file_name];
- disp('Stage 1 - Loading sessions')
- if get(handles.write2file_on,'Value')
- added_spatial_footprints = file_names{number_of_sessions};
- else
- [added_spatial_footprints]=load_single_session(file_names{number_of_sessions});
- end
- spatial_footprints{number_of_sessions}=added_spatial_footprints;
- [added_footprints_projection]=compute_footprints_projections({added_spatial_footprints});
- footprints_projections{number_of_sessions}=added_footprints_projection;
- plot_single_session_projections(added_footprints_projection,num2str(number_of_sessions),figures_visibility)
- else % first loaded session
- data_struct=handles.data_struct;
- % chosing the file to load:
- msgbox_timed('Please choose the file with the spatial footprints for this session: ',1)
- [file_name,file_path]=uigetfile('*.mat',...
- 'Choose the file with the spatial footprints for this session: ','MultiSelect','off');
- number_of_sessions=1;
- sessions_list={['Session 1 - ' file_path file_name]};
- file_names={[file_path file_name]};
- % defining the microns per pixel ratio:
- microns_per_pixel=str2num(get(handles.microns_per_pixel,'string'));
- if isempty(microns_per_pixel)
- msgbox_timed('Please insert the pixel size in microns and press enter ',3);
- set(handles.microns_per_pixel,'backgroundColor',[1 0.5 0.5]);
- waitfor(handles.microns_per_pixel,'value',1);
- microns_per_pixel=str2num(get(handles.microns_per_pixel,'string'));
- end
- set(handles.microns_per_pixel,'string',num2str(round(100*microns_per_pixel)/100));
- set(handles.microns_per_pixel,'backgroundColor',[1 1 1]);
- % defining the results directory:
- msgbox_timed('Please select the folder in which the results will be saved',3)
- results_directory=uigetdir(file_path); % the directory which the final results will be saved
- figures_directory=fullfile(results_directory,'Figures');
- if exist(figures_directory,'dir')~=7
- mkdir(figures_directory);
- end
- % loading the spatial footprints:
- disp('Stage 1 - Loading sessions')
- if get(handles.write2file_on,'Value');
- spatial_footprints = {file_names{1}};
- else
- [spatial_footprints]={load_single_session(file_names{1})};
- end
- [footprints_projections]=compute_footprints_projections(spatial_footprints);
- plot_single_session_projections(footprints_projections,1,figures_visibility)
- % saving the loaded data into the data struct for the GUI
- data_struct.results_directory=results_directory;
- data_struct.figures_directory=figures_directory;
- data_struct.microns_per_pixel=microns_per_pixel;
- end
- % saving the loaded data into the data struct for the GUI
- if get(handles.write2file_on,'Value')
- data_struct.temp_dir = [figures_directory, filesep, 'temp'];
- if ~exist(data_struct.temp_dir)
- mkdir(data_struct.temp_dir);
- end
- else
- data_struct.temp_dir = [];
- end
- data_struct.spatial_footprints=spatial_footprints;
- data_struct.footprints_projections=footprints_projections;
- data_struct.number_of_sessions=number_of_sessions;
- data_struct.sessions_list=sessions_list;
- data_struct.file_names=file_names;
- set(handles.list_of_sessions,'string',data_struct.sessions_list);
- handles.data_struct=data_struct;
- guidata(hObject, handles)
- disp('Done')
- msgbox_timed('Finished loading session',1)
- % --- Executes on button press in remove_session.
- function remove_session_Callback(hObject,~, handles)
- % hObject handle to remove_session (see GCBO)
- % eventdata reserved - to be defined in a future version of MATLAB
- % handles struct with handles and user data (see GUIDATA)
- % This callback removes the selected session from the list of sessions to be registered
- data_struct=handles.data_struct;
- if isfield(data_struct,'spatial_footprints')
- % selecting the session to remove:
- number_of_sessions=data_struct.number_of_sessions;
- chosen_session=get(handles.list_of_sessions,'value');
- sessions_to_keep=setdiff(1:number_of_sessions,chosen_session);
- set(handles.list_of_sessions,'value',1)
- number_of_sessions=number_of_sessions-1;
- % removing the session from the data:
- if isfield(data_struct,'spatial_footprints_corrected') % if data was aligned
- centroid_locations=data_struct.centroid_locations(sessions_to_keep);
- adjusted_footprints_projections=data_struct.adjusted_footprints_projections(sessions_to_keep);
- spatial_footprints_corrected=data_struct.spatial_footprints_corrected(sessions_to_keep);
- centroid_locations_corrected=data_struct.centroid_locations_corrected(sessions_to_keep);
- footprints_projections_corrected=data_struct.footprints_projections_corrected(sessions_to_keep);
- % for variables that are compared to a reference session:
- reference_session_index=data_struct.reference_session_index;
- if reference_session_index==chosen_session
- errordlg('This session was used as a reference for alignment and therefore cannot be removed')
- error('This session was used as a reference for alignment and therefore cannot be removed')
- else
- sessions_without_reference=setdiff(1:number_of_sessions+1,reference_session_index);
- chosen_session_compared_to_reference_index=find(sessions_without_reference==chosen_session);
- sessions_to_keep_compared_to_reference=setdiff(1:number_of_sessions,chosen_session_compared_to_reference_index);
- maximal_cross_correlation=data_struct.maximal_cross_correlation(sessions_to_keep_compared_to_reference);
- alignment_translations=data_struct.alignment_translations(:,sessions_to_keep_compared_to_reference);
- end
- if reference_session_index>chosen_session % index of reference should change
- reference_session_index=reference_session_index-1;
- end
- data_struct.centroid_locations=centroid_locations;
- data_struct.adjusted_footprints_projections=adjusted_footprints_projections;
- data_struct.spatial_footprints_corrected=spatial_footprints_corrected;
- data_struct.centroid_locations_corrected=centroid_locations_corrected;
- data_struct.footprints_projections_corrected=footprints_projections_corrected;
- data_struct.maximal_cross_correlation=maximal_cross_correlation;
- data_struct.alignment_translations=alignment_translations;
- data_struct.reference_session_index=reference_session_index;
- end
- spatial_footprints=data_struct.spatial_footprints;
- footprints_projections=data_struct.footprints_projections;
- spatial_footprints=spatial_footprints(sessions_to_keep);
- footprints_projections=footprints_projections(sessions_to_keep);
- file_names=data_struct.file_names(sessions_to_keep);
- sessions_list=cell(1,number_of_sessions);
- for n=1:number_of_sessions
- sessions_list{1,n}=['Session ' num2str(n) ' - ' file_names{1,n}];
- end
- data_struct.number_of_sessions=number_of_sessions;
- data_struct.spatial_footprints=spatial_footprints;
- data_struct.footprints_projections=footprints_projections;
- data_struct.sessions_list=sessions_list;
- data_struct.file_names=file_names;
- data_struct.sessions_list=sessions_list;
- set(handles.list_of_sessions,'string',data_struct.sessions_list);
- handles.data_struct=data_struct;
- guidata(hObject, handles)
- msgbox_timed('Finished removing session',1)
- end
- % --------------------------------------------------------------------
- function load_transformed_data_Callback(hObject,~, handles)
- % hObject handle to load_transformed_data (see GCBO)
- % eventdata reserved - to be defined in a future version of MATLAB
- % handles struct with handles and user data (see GUIDATA)
- % This callback loads sessions that were already aligned into a reference coordinate system.
- % For such data the compute model should be the next step.
- msgbox_timed('Please choose the file containing the aligned data structure: ',3)
- [file_name,file_path]=uigetfile('*.mat',...
- 'Choose the file containing the aligned data: ','MultiSelect','off');
- disp('Loading aligned data')
- aligned_data_struct=load(fullfile(file_path,file_name));
- if ~isstruct(aligned_data_struct)
- errordlg('This file does not contain data with the required format')
- error('This file does not contain data with the required format')
- elseif ~isfield(aligned_data_struct,'aligned_data_struct')
- errordlg('This file does not contain data with the required format')
- error('This file does not contain data with the required format')
- else
- % loading the aligned data:
- msgbox_timed('Please select the folder in which the results will be saved',3)
- results_directory=uigetdir(file_path); % the directory which the final results will be saved
- data_struct=aligned_data_struct.aligned_data_struct;
- data_struct.results_directory=results_directory;
- figures_directory=fullfile(results_directory,'Figures');
- data_struct.figures_directory=figures_directory;
- if exist(figures_directory,'dir')~=7
- mkdir(figures_directory);
- end
- % plotting the aligned data:
- footprints_projections_corrected=data_struct.footprints_projections_corrected;
- overlapping_FOV=data_struct.overlapping_FOV;
- if get(handles.figures_visibility_on,'Value');
- figures_visibility='On';
- else
- figures_visibility='Off';
- end
- plot_all_sessions_projections(footprints_projections_corrected,figures_directory,figures_visibility)
- number_of_sessions=length(footprints_projections_corrected);
- if number_of_sessions>2
- RGB_indexes=[1 2 3];
- else
- RGB_indexes=[1 2];
- end
- axes(handles.axes1);
- plot_RGB_overlay(footprints_projections_corrected,RGB_indexes,overlapping_FOV)
- figure('units','normalized','outerposition',[0.325 0.25 0.35 0.5],'Visible',figures_visibility)
- plot_RGB_overlay(footprints_projections_corrected,RGB_indexes,overlapping_FOV)
- % loading configurations to GUI:
- set(handles.microns_per_pixel,'string',num2str(round(100*data_struct.microns_per_pixel)/100));
- set(handles.reference_session_index,'string',num2str(data_struct.reference_session_index))
- set(handles.list_of_sessions,'string',data_struct.sessions_list)
- if strcmp(data_struct.alignment_type,'Translations')
- set(handles.translations,'Value',1);
- elseif strcmp(data_struct.alignment_type,'Translations and Rotations')
- set(handles.translations_rotations,'Value',1);
- else
- set(handles.non_rigid,'Value',1);
- end
- end
- handles.data_struct=data_struct;
- guidata(hObject, handles)
- disp('Done')
- msgbox_timed('Finished loading aligned sessions',3)
- % --- Executes on button press in load_modeled_data.
- function load_modeled_data_Callback(hObject, eventdata, handles)
- % hObject handle to load_modeled_data (see GCBO)
- % eventdata reserved - to be defined in a future version of MATLAB
- % handles structure with handles and user data (see GUIDATA)
- % This callback loads data that were already modeled.
- % For such data the initial registration should be the next step.
- msgbox_timed('Please choose the file containing the modeled data structure: ',3)
- [file_name,file_path]=uigetfile('*.mat',...
- 'Choose the file containing the modeled data','MultiSelect','off');
- disp('Loading modeled data')
- modeled_data_struct=load(fullfile(file_path,file_name));
- if ~isstruct(modeled_data_struct)
- errordlg('This file does not contain data with the required format')
- error('This file does not contain data with the required format')
- elseif ~isfield(modeled_data_struct,'modeled_data_struct')
- errordlg('This file does not contain data with the required format')
- error('This file does not contain data with the required format')
- else
- % loading the aligned data:
- msgbox_timed('Please select the folder in which the results will be saved',3)
- results_directory=uigetdir(file_path); % the directory which the final results will be saved
- data_struct=modeled_data_struct.modeled_data_struct;
- data_struct.results_directory=results_directory;
- figures_directory=fullfile(results_directory,'Figures');
- data_struct.figures_directory=figures_directory;
- if exist(figures_directory,'dir')~=7
- mkdir(figures_directory);
- end
- % plotting the data:
- footprints_projections_corrected=data_struct.footprints_projections_corrected;
- overlapping_FOV=data_struct.overlapping_FOV;
- if get(handles.figures_visibility_on,'Value');
- figures_visibility='On';
- else
- figures_visibility='Off';
- end
- plot_all_sessions_projections(footprints_projections_corrected,figures_directory,figures_visibility)
- number_of_sessions=length(footprints_projections_corrected);
- if number_of_sessions>2
- RGB_indexes=[1 2 3];
- else
- RGB_indexes=[1 2];
- end
- axes(handles.axes1);
- plot_RGB_overlay(footprints_projections_corrected,RGB_indexes,overlapping_FOV)
- figure('units','normalized','outerposition',[0.325 0.25 0.35 0.5],'Visible',figures_visibility)
- plot_RGB_overlay(footprints_projections_corrected,RGB_indexes,overlapping_FOV)
- % loading configurations to GUI:
- set(handles.microns_per_pixel,'string',num2str(round(100*data_struct.microns_per_pixel)/100));
- set(handles.reference_session_index,'string',num2str(data_struct.reference_session_index))
- set(handles.list_of_sessions,'string',data_struct.sessions_list)
- set(handles.model_maximal_distance,'string',num2str(data_struct.maximal_distance));
- if strcmp(data_struct.alignment_type,'Translations')
- set(handles.translations,'Value',1);
- elseif strcmp(data_struct.alignment_type,'Translations and Rotations')
- set(handles.translations_rotations,'Value',1);
- else
- set(handles.non_rigid,'Value',1);
- end
- end
- handles.data_struct=data_struct;
- guidata(hObject, handles)
- disp('Done')
- msgbox_timed('Finished loading modeled data',1)
- % --- Executes on button press in transform_sessions.
- function transform_sessions_Callback(hObject,~, handles)
- % hObject handle to transform_sessions (see GCBO)
- % eventdata reserved - to be defined in a future version of MATLAB
- % handles struct with handles and user data (see GUIDATA)
- % Stage 2: Aligning all the sessions to a reference coordinate system using
- % rigid-body transformation
- % This callback performs rigid-body transfomration to all the sessions
- % according to a chosen reference ssseion. This stage:
- % 1) Corrects sessions for translation/rotations and transforming the
- % spatial footprints into a single coordinate frame
- % 2) Matches the sizes of all the spatial footprints from the different sessions
- % to the intersction of the different FOVs
- % 3) Evaluate whether or not it is suitable for
- % longitudinal analysis
- use_parallel_processing=true; % either true or false
- data_struct=handles.data_struct;
- number_of_sessions=data_struct.number_of_sessions;
- spatial_footprints=data_struct.spatial_footprints;
- results_directory=data_struct.results_directory;
- figures_directory=data_struct.figures_directory;
- microns_per_pixel=data_struct.microns_per_pixel;
- % defining the aligned data structure:
- aligned_data_struct=struct;
- aligned_data_struct.number_of_sessions=number_of_sessions;
- aligned_data_struct.spatial_footprints=spatial_footprints;
- aligned_data_struct.results_directory=results_directory;
- aligned_data_struct.figures_directory=figures_directory;
- aligned_data_struct.microns_per_pixel=microns_per_pixel;
- aligned_data_struct.footprints_projections=data_struct.footprints_projections;
- aligned_data_struct.sessions_list=data_struct.sessions_list;
- aligned_data_struct.file_names=data_struct.file_names;
- if get(handles.figures_visibility_on,'Value');
- figures_visibility='On';
- else
- figures_visibility='Off';
- end
- % Defining the parameters for image alignment:
- translations_value=get(handles.translations,'Value');
- rotations_value=get(handles.translations_rotations,'Value');
- if translations_value==1
- alignment_type='Translations';
- elseif rotations_value==1
- alignment_type='Translations and Rotations';
- else
- alignment_type='Non-rigid';
- end
- if strcmp(alignment_type,'Translations and Rotations')
- maximal_rotation=str2num(get(handles.maximal_rotation,'string'));
- end
- if strcmp(alignment_type,'Non-rigid')
- transformation_smoothness=str2num(get(handles.transformation_smoothness,'string'));
- if transformation_smoothness>3 || transformation_smoothness<0.5
- errordlg('FOV smoothing parameter should be between 0.5-3')
- error('FOV smoothing parameter should be between 0.5-3')
- end
- end
- reference_session_index=str2num(get(handles.reference_session_index,'string'));
- reference_valid=1;
- if isempty(reference_session_index) || reference_session_index<1 || reference_session_index>number_of_sessions
- reference_valid=0;
- end
- while reference_valid==0
- set(handles.reference_session_index,'value',0)
- msgbox_timed('Please insert a valid reference session number and press enter ',3);
- waitfor(handles.reference_session_index,'value',1);
- reference_session_index=str2num(get(handles.reference_session_index,'string'));
- if ~isempty(reference_session_index) && reference_session_index>=1 && reference_session_index<=number_of_sessions
- reference_valid=1;
- end
- end
- % Preparing the data for alignment:
- disp('Stage 2 - Aligning sessions')
- if ~isempty(data_struct.temp_dir)
- [normalized_spatial_footprints]=normalize_spatial_footprints(spatial_footprints, data_struct.temp_dir);
- else
- [normalized_spatial_footprints]=normalize_spatial_footprints(spatial_footprints);
- end
- [adjusted_spatial_footprints,adjusted_FOV,adjusted_x_size,adjusted_y_size,adjustment_zero_padding]=...
- adjust_FOV_size(normalized_spatial_footprints);
- [adjusted_footprints_projections]=compute_footprints_projections(adjusted_spatial_footprints);
- [centroid_locations]=compute_centroid_locations(adjusted_spatial_footprints,microns_per_pixel);
- [centroid_projections]=compute_centroids_projections(centroid_locations,adjusted_spatial_footprints);
- % Aligning the cells according to the tranlations/rotations that maximize their similarity:
- sufficient_correlation_centroids=0.2; % smaller correlation imply no similarity between sessions
- sufficient_correlation_footprints=0.2; % smaller correlation imply no similarity between sessions
- if strcmp(alignment_type,'Translations and Rotations')
- [spatial_footprints_corrected,centroid_locations_corrected,footprints_projections_corrected,centroid_projections_corrected,maximal_cross_correlation,alignment_translations,overlapping_FOV]=...
- align_images(adjusted_spatial_footprints,centroid_locations,adjusted_footprints_projections,centroid_projections,adjusted_FOV,microns_per_pixel,reference_session_index,alignment_type,sufficient_correlation_centroids,sufficient_correlation_footprints,use_parallel_processing,maximal_rotation);
- elseif strcmp(alignment_type,'Non-rigid')
- [spatial_footprints_corrected,centroid_locations_corrected,footprints_projections_corrected,centroid_projections_corrected,maximal_cross_correlation,alignment_translations,overlapping_FOV,displacement_fields]=...
- align_images(adjusted_spatial_footprints,centroid_locations,adjusted_footprints_projections,centroid_projections,adjusted_FOV,microns_per_pixel,reference_session_index,alignment_type,sufficient_correlation_centroids,sufficient_correlation_footprints,use_parallel_processing,transformation_smoothness);
- else
- [spatial_footprints_corrected,centroid_locations_corrected,footprints_projections_corrected,centroid_projections_corrected,maximal_cross_correlation,alignment_translations,overlapping_FOV]=...
- align_images(adjusted_spatial_footprints,centroid_locations,adjusted_footprints_projections,centroid_projections,adjusted_FOV,microns_per_pixel,reference_session_index,alignment_type,sufficient_correlation_centroids,sufficient_correlation_footprints,use_parallel_processing);
- end
- % Evaluating data quality:
- [all_projections_correlations,number_of_cells_per_session]=...
- evaluate_data_quality(spatial_footprints_corrected,centroid_projections_corrected,footprints_projections_corrected,maximal_cross_correlation,alignment_translations,reference_session_index,sufficient_correlation_footprints,alignment_type);
- % plotting alignment results:
- if strcmp(alignment_type,'Non-rigid')
- plot_alignment_results(adjusted_spatial_footprints,centroid_locations,spatial_footprints_corrected,centroid_locations_corrected,adjusted_footprints_projections,footprints_projections_corrected,reference_session_index,all_projections_correlations,maximal_cross_correlation,alignment_translations,overlapping_FOV,alignment_type,number_of_cells_per_session,figures_directory,figures_visibility,displacement_fields)
- else
- plot_alignment_results(adjusted_spatial_footprints,centroid_locations,spatial_footprints_corrected,centroid_locations_corrected,adjusted_footprints_projections,footprints_projections_corrected,reference_session_index,all_projections_correlations,maximal_cross_correlation,alignment_translations,overlapping_FOV,alignment_type,number_of_cells_per_session,figures_directory,figures_visibility)
- end
- if number_of_sessions>2
- RGB_indexes=[1 2 3];
- else
- RGB_indexes=[1 2];
- end
- axes(handles.axes1);
- plot_RGB_overlay(footprints_projections_corrected,RGB_indexes,overlapping_FOV)
- % saving the results into the data struct for the GUI
- data_struct.reference_session_index=reference_session_index;
- data_struct.alignment_type=alignment_type;
- data_struct.centroid_locations=centroid_locations;
- data_struct.spatial_footprints_corrected=spatial_footprints_corrected;
- data_struct.centroid_locations_corrected=centroid_locations_corrected;
- data_struct.adjusted_footprints_projections=adjusted_footprints_projections;
- data_struct.footprints_projections_corrected=footprints_projections_corrected;
- data_struct.adjusted_x_size=adjusted_x_size;
- data_struct.adjusted_y_size=adjusted_y_size;
- data_struct.overlapping_FOV=overlapping_FOV;
- data_struct.maximal_cross_correlation=maximal_cross_correlation;
- data_struct.alignment_translations=alignment_translations;
- data_struct.adjustment_zero_padding=adjustment_zero_padding;
- % saving the results into the aligned data structure:
- aligned_data_struct.reference_session_index=reference_session_index;
- aligned_data_struct.alignment_type=alignment_type;
- aligned_data_struct.centroid_locations=centroid_locations;
- aligned_data_struct.spatial_footprints_corrected=spatial_footprints_corrected;
- aligned_data_struct.centroid_locations_corrected=centroid_locations_corrected;
- aligned_data_struct.adjusted_footprints_projections=adjusted_footprints_projections;
- aligned_data_struct.footprints_projections_corrected=footprints_projections_corrected;
- aligned_data_struct.adjusted_x_size=adjusted_x_size;
- aligned_data_struct.adjusted_y_size=adjusted_y_size;
- aligned_data_struct.overlapping_FOV=overlapping_FOV;
- aligned_data_struct.maximal_cross_correlation=maximal_cross_correlation;
- aligned_data_struct.alignment_translations=alignment_translations;
- aligned_data_struct.adjustment_zero_padding=adjustment_zero_padding;
- handles.data_struct=data_struct;
- disp('Saving the aligned data structure')
- save(fullfile(results_directory,'aligned_data_struct.mat'),'aligned_data_struct','-v7.3')
- guidata(hObject,handles)
- if use_parallel_processing
- delete(gcp);
- end
- disp('Done')
- msgbox_timed('Finished aligning sessions',1)
- % --- Executes on button press in compute_model.
- function compute_model_Callback(hObject,~, handles)
- % hObject handle to compute_model (see GCBO)
- % eventdata reserved - to be defined in a future version of MATLAB
- % handles struct with handles and user data (see GUIDATA)
- % Stage 3: Computing a probabilistic model of the spatial footprints similarities
- % of neighboring cell-pairs from different sessions using the centroid_locations
- % distances and spatial correlations
- % This callback computes the probability model for the same cells and
- % different cells according to either spatial correlations, centroid
- % distances, or both measures. The output is all the probabilities of
- % neighboring cell-pairs to be the same cell - P_same.
- % reseting figures
- cla(handles.axes2,'reset')
- axes(handles.axes2);
- plot([],[])
- set(gca,'xtick',[])
- set(gca,'ytick',[])
- cla(handles.axes3,'reset')
- axes(handles.axes3);
- plot([],[])
- set(gca,'xtick',[])
- set(gca,'ytick',[])
- cla(handles.axes4,'reset')
- axes(handles.axes4);
- plot([],[])
- set(gca,'xtick',[])
- set(gca,'ytick',[])
- cla(handles.axes5,'reset')
- axes(handles.axes5);
- plot([],[])
- set(gca,'xtick',[])
- set(gca,'ytick',[])
- cla(handles.axes6,'reset')
- axes(handles.axes6);
- plot([],[])
- set(gca,'xtick',[])
- set(gca,'ytick',[])
- data_struct=handles.data_struct;
- spatial_footprints_corrected=data_struct.spatial_footprints_corrected;
- centroid_locations_corrected=data_struct.centroid_locations_corrected;
- microns_per_pixel=data_struct.microns_per_pixel;
- results_directory=data_struct.results_directory;
- figures_directory=data_struct.figures_directory;
- % defining the modeled data structure:
- modeled_data_struct=struct;
- modeled_data_struct.number_of_sessions=data_struct.number_of_sessions;
- modeled_data_struct.spatial_footprints=data_struct.spatial_footprints;
- modeled_data_struct.results_directory=results_directory;
- modeled_data_struct.figures_directory=figures_directory;
- modeled_data_struct.microns_per_pixel=microns_per_pixel;
- modeled_data_struct.reference_session_index=data_struct.reference_session_index;
- modeled_data_struct.alignment_type=data_struct.alignment_type;
- modeled_data_struct.centroid_locations=data_struct.centroid_locations;
- modeled_data_struct.spatial_footprints_corrected=spatial_footprints_corrected;
- modeled_data_struct.centroid_locations_corrected=centroid_locations_corrected;
- modeled_data_struct.adjusted_footprints_projections=data_struct.adjusted_footprints_projections;
- modeled_data_struct.footprints_projections_corrected=data_struct.footprints_projections_corrected;
- modeled_data_struct.adjusted_x_size=data_struct.adjusted_x_size;
- modeled_data_struct.adjusted_y_size=data_struct.adjusted_y_size;
- modeled_data_struct.overlapping_FOV=data_struct.overlapping_FOV;
- modeled_data_struct.maximal_cross_correlation=data_struct.maximal_cross_correlation;
- modeled_data_struct.alignment_translations=data_struct.alignment_translations;
- modeled_data_struct.adjustment_zero_padding=data_struct.adjustment_zero_padding;
- modeled_data_struct.footprints_projections=data_struct.footprints_projections;
- modeled_data_struct.sessions_list=data_struct.sessions_list;
- modeled_data_struct.file_names=data_struct.file_names;
- if get(handles.figures_visibility_on,'Value')
- figures_visibility='On';
- else
- figures_visibility='Off';
- end
- % Defining the parameters for the probabilstic modeling:
- maximal_distance=str2num(get(handles.model_maximal_distance,'string'));
- normalized_maximal_distance=maximal_distance/microns_per_pixel;
- p_same_certainty_threshold=0.95; % certain cells are those with p_same>threshld or <1-threshold
- [number_of_bins,centers_of_bins]=estimate_number_of_bins(spatial_footprints_corrected,normalized_maximal_distance);
- disp('Stage 3 - Calculating a probabilistic model of the data')
- [all_to_all_indexes,all_to_all_spatial_correlations,all_to_all_centroid_distances,neighbors_spatial_correlations,neighbors_centroid_distances,neighbors_x_displacements,neighbors_y_displacements,NN_spatial_correlations,NNN_spatial_correlations,NN_centroid_distances,NNN_centroid_distances]=...
- compute_data_distribution(spatial_footprints_corrected,centroid_locations_corrected,normalized_maximal_distance);
- % saving the results into the data struct for the GUI
- data_struct.all_to_all_indexes=all_to_all_indexes;
- data_struct.all_to_all_spatial_correlations=all_to_all_spatial_correlations;
- data_struct.all_to_all_centroid_distances=all_to_all_centroid_distances;
- data_struct.neighbors_spatial_correlations=neighbors_spatial_correlations;
- data_struct.neighbors_centroid_distances=neighbors_centroid_distances;
- data_struct.neighbors_x_displacements=neighbors_x_displacements;
- data_struct.neighbors_y_displacements=neighbors_y_displacements;
- data_struct.NN_spatial_correlations=NN_spatial_correlations;
- data_struct.NNN_spatial_correlations=NNN_spatial_correlations;
- data_struct.NN_centroid_distances=NN_centroid_distances;
- data_struct.NNN_centroid_distances=NNN_centroid_distances;
- % saving the results into the modeled data structure:
- modeled_data_struct.all_to_all_indexes=all_to_all_indexes;
- modeled_data_struct.all_to_all_spatial_correlations=all_to_all_spatial_correlations;
- modeled_data_struct.all_to_all_centroid_distances=all_to_all_centroid_distances;
- modeled_data_struct.neighbors_spatial_correlations=neighbors_spatial_correlations;
- modeled_data_struct.neighbors_centroid_distances=neighbors_centroid_distances;
- modeled_data_struct.neighbors_x_displacements=neighbors_x_displacements;
- modeled_data_struct.neighbors_y_displacements=neighbors_y_displacements;
- modeled_data_struct.NN_spatial_correlations=NN_spatial_correlations;
- modeled_data_struct.NNN_spatial_correlations=NNN_spatial_correlations;
- modeled_data_struct.NN_centroid_distances=NN_centroid_distances;
- modeled_data_struct.NNN_centroid_distances=NNN_centroid_distances;
- handles.data_struct=data_struct;
- guidata(hObject, handles)
- % Plotting the (x,y) displacements:
- x_y_displacements=plot_x_y_displacements(neighbors_x_displacements,neighbors_y_displacements,microns_per_pixel,normalized_maximal_distance,number_of_bins,centers_of_bins,figures_directory,figures_visibility);
- axes(handles.axes2)
- plot_x_y_displacements_GUI(x_y_displacements,microns_per_pixel,centers_of_bins,normalized_maximal_distance,number_of_bins)
- disp('Calculating a probabilistic model of the data')
- % Modeling the distribution of centroid distances:
- [centroid_distances_model_parameters,p_same_given_centroid_distance,centroid_distances_distribution,centroid_distances_model_same_cells,centroid_distances_model_different_cells,centroid_distances_model_weighted_sum,MSE_centroid_distances_model,centroid_distance_intersection]=...
- compute_centroid_distances_model(neighbors_centroid_distances,microns_per_pixel,centers_of_bins);
- % Modeling the distribution of spatial correlations:
- [spatial_correlations_model_parameters,p_same_given_spatial_correlation,spatial_correlations_distribution,spatial_correlations_model_same_cells,spatial_correlations_model_different_cells,spatial_correlations_model_weighted_sum,MSE_spatial_correlations_model,spatial_correlation_intersection]=...
- compute_spatial_correlations_model(neighbors_spatial_correlations,centers_of_bins);
- % estimating registration accuracy:
- [p_same_centers_of_bins,uncertain_fraction_centroid_distances,cdf_p_same_centroid_distances,false_positive_per_distance_threshold,true_positive_per_distance_threshold,uncertain_fraction_spatial_correlations,cdf_p_same_spatial_correlations,false_positive_per_correlation_threshold,true_positive_per_correlation_threshold]=...
- estimate_registration_accuracy(p_same_certainty_threshold,neighbors_centroid_distances,centroid_distances_model_same_cells,centroid_distances_model_different_cells,p_same_given_centroid_distance,centers_of_bins,neighbors_spatial_correlations,spatial_correlations_model_same_cells,spatial_correlations_model_different_cells,p_same_given_spatial_correlation);
- % Checking which model is better according to a defined cost function:
- [best_model_string]=choose_best_model(MSE_centroid_distances_model,centroid_distances_model_same_cells,centroid_distances_model_different_cells,p_same_given_centroid_distance,MSE_spatial_correlations_model,spatial_correlations_model_same_cells,spatial_correlations_model_different_cells,p_same_given_spatial_correlation);
- % change the initial and final registration according to the best model:
- if strcmp(best_model_string,'Spatial correlation')
- set(handles.spatial_correlations,'Value',1);
- set(handles.spatial_correlations_2,'Value',1);
- set(handles.distance_threshold,'enable','off')
- set(handles.correlation_threshold,'enable','on')
- else
- set(handles.centroid_distances,'Value',1);
- set(handles.centroid_distances_2,'Value',1);
- set(handles.correlation_threshold,'enable','off')
- set(handles.distance_threshold,'enable','on')
- end
- % Plotting the probabilistic models and estimated registration accuracy:
- plot_models(centroid_distances_model_parameters,NN_centroid_distances,NNN_centroid_distances,centroid_distances_distribution,centroid_distances_model_same_cells,centroid_distances_model_different_cells,centroid_distances_model_weighted_sum,centroid_distance_intersection,centers_of_bins,microns_per_pixel,normalized_maximal_distance,figures_directory,figures_visibility,spatial_correlations_model_parameters,NN_spatial_correlations,NNN_spatial_correlations,spatial_correlations_distribution,spatial_correlations_model_same_cells,spatial_correlations_model_different_cells,spatial_correlations_model_weighted_sum,spatial_correlation_intersection)
- plot_estimated_registration_accuracy(p_same_centers_of_bins,p_same_certainty_threshold,p_same_given_centroid_distance,centroid_distances_distribution,cdf_p_same_centroid_distances,uncertain_fraction_centroid_distances,true_positive_per_distance_threshold,false_positive_per_distance_threshold,centers_of_bins,normalized_maximal_distance,microns_per_pixel,figures_directory,figures_visibility,p_same_given_spatial_correlation,spatial_correlations_distribution,cdf_p_same_spatial_correlations,uncertain_fraction_spatial_correlations,true_positive_per_correlation_threshold,false_positive_per_correlation_threshold)
- plot_estimated_accuracy_GUI(handles,p_same_centers_of_bins,p_same_certainty_threshold,p_same_given_centroid_distance,centroid_distances_distribution,cdf_p_same_centroid_distances,true_positive_per_distance_threshold,false_positive_per_distance_threshold,centers_of_bins,normalized_maximal_distance,microns_per_pixel,p_same_given_spatial_correlation,spatial_correlations_distribution,cdf_p_same_spatial_correlations,true_positive_per_correlation_threshold,false_positive_per_correlation_threshold)
- % Computing the P_same for each neighboring cell-pair according to the different models:
- [all_to_all_p_same_centroid_distance_model,all_to_all_p_same_spatial_correlation_model]=...
- compute_p_same(all_to_all_centroid_distances,p_same_given_centroid_distance,centers_of_bins,all_to_all_spatial_correlations,p_same_given_spatial_correlation);
- % saving the results into the data struct for GUI:
- data_struct.best_model_string=best_model_string;
- data_struct.maximal_distance=maximal_distance;
- data_struct.number_of_bins=number_of_bins;
- data_struct.centers_of_bins=centers_of_bins;
- data_struct.false_positive_per_distance_threshold=false_positive_per_distance_threshold;
- data_struct.true_positive_per_distance_threshold=true_positive_per_distance_threshold;
- data_struct.cdf_p_same_centroid_distances=cdf_p_same_centroid_distances;
- data_struct.uncertain_fraction_centroid_distances=uncertain_fraction_centroid_distances;
- data_struct.p_same_given_centroid_distance=p_same_given_centroid_distance;
- data_struct.neighbors_centroid_distances=neighbors_centroid_distances;
- data_struct.MSE_centroid_distances_model=MSE_centroid_distances_model;
- data_struct.centroid_distances_model_parameters=centroid_distances_model_parameters;
- data_struct.centroid_distances_distribution=centroid_distances_distribution;
- data_struct.centroid_distance_intersection=centroid_distance_intersection;
- data_struct.all_to_all_p_same_centroid_distance_model=all_to_all_p_same_centroid_distance_model;
- % saving the results into the modeled data structure:
- modeled_data_struct.best_model_string=best_model_string;
- modeled_data_struct.maximal_distance=maximal_distance;
- modeled_data_struct.number_of_bins=number_of_bins;
- modeled_data_struct.centers_of_bins=centers_of_bins;
- modeled_data_struct.false_positive_per_distance_threshold=false_positive_per_distance_threshold;
- modeled_data_struct.true_positive_per_distance_threshold=true_positive_per_distance_threshold;
- modeled_data_struct.cdf_p_same_centroid_distances=cdf_p_same_centroid_distances;
- modeled_data_struct.uncertain_fraction_centroid_distances=uncertain_fraction_centroid_distances;
- modeled_data_struct.p_same_given_centroid_distance=p_same_given_centroid_distance;
- modeled_data_struct.neighbors_centroid_distances=neighbors_centroid_distances;
- modeled_data_struct.MSE_centroid_distances_model=MSE_centroid_distances_model;
- modeled_data_struct.centroid_distances_model_parameters=centroid_distances_model_parameters;
- modeled_data_struct.centroid_distances_distribution=centroid_distances_distribution;
- modeled_data_struct.centroid_distance_intersection=centroid_distance_intersection;
- modeled_data_struct.all_to_all_p_same_centroid_distance_model=all_to_all_p_same_centroid_distance_model;
- data_struct.false_positive_per_correlation_threshold=false_positive_per_correlation_threshold;
- data_struct.true_positive_per_correlation_threshold=true_positive_per_correlation_threshold;
- data_struct.cdf_p_same_spatial_correlations=cdf_p_same_spatial_correlations;
- data_struct.uncertain_fraction_spatial_correlations=uncertain_fraction_spatial_correlations;
- data_struct.all_to_all_spatial_correlations=all_to_all_spatial_correlations;
- data_struct.MSE_spatial_correlations_model=MSE_spatial_correlations_model;
- data_struct.spatial_correlations_model_parameters=spatial_correlations_model_parameters;
- data_struct.p_same_given_spatial_correlation=p_same_given_spatial_correlation;
- data_struct.spatial_correlations_distribution=spatial_correlations_distribution;
- data_struct.spatial_correlation_intersection=spatial_correlation_intersection;
- data_struct.all_to_all_p_same_spatial_correlation_model=all_to_all_p_same_spatial_correlation_model;
- % saving the results into the modeled data structure:
- modeled_data_struct.false_positive_per_correlation_threshold=false_positive_per_correlation_threshold;
- modeled_data_struct.true_positive_per_correlation_threshold=true_positive_per_correlation_threshold;
- modeled_data_struct.cdf_p_same_spatial_correlations=cdf_p_same_spatial_correlations;
- modeled_data_struct.uncertain_fraction_spatial_correlations=uncertain_fraction_spatial_correlations;
- modeled_data_struct.all_to_all_spatial_correlations=all_to_all_spatial_correlations;
- modeled_data_struct.MSE_spatial_correlations_model=MSE_spatial_correlations_model;
- modeled_data_struct.spatial_correlations_model_parameters=spatial_correlations_model_parameters;
- modeled_data_struct.p_same_given_spatial_correlation=p_same_given_spatial_correlation;
- modeled_data_struct.spatial_correlations_distribution=spatial_correlations_distribution;
- modeled_data_struct.spatial_correlation_intersection=spatial_correlation_intersection;
- modeled_data_struct.all_to_all_p_same_spatial_correlation_model=all_to_all_p_same_spatial_correlation_model;
- % setting the intersection point as the threshold
- set(handles.correlation_threshold,'string',num2str(spatial_correlation_intersection))
- set(handles.distance_threshold,'string',num2str(centroid_distance_intersection))
- handles.data_struct=data_struct;
- disp('Saving the modeled data structure')
- save(fullfile(results_directory,'modeled_data_struct.mat'),'modeled_data_struct','-v7.3')
- guidata(hObject, handles)
- disp('Done')
- msgbox_timed(['Finished computing probabilistic model - The ' best_model_string ' model is best suited for the data'],3)
- % --- Executes on button press in register_cells_initial.
- function register_cells_initial_Callback(hObject,~,handles)
- % hObject handle to register_cells_initial (see GCBO)
- % eventdata reserved - to be defined in a future version of MATLAB
- % handles struct with handles and user data (see GUIDATA)
- % Stage 4: Obtaining an initial cell registration according to an optimized
- % registration threshold.
- % This callback performs initial cell registration according to either
- % spatial correlations or centroid distances:
- data_struct=handles.data_struct;
- microns_per_pixel=data_struct.microns_per_pixel;
- spatial_footprints_corrected=data_struct.spatial_footprints_corrected;
- centroid_locations_corrected=data_struct.centroid_locations_corrected;
- normalized_maximal_distance=data_struct.maximal_distance/microns_per_pixel;
- number_of_bins=data_struct.number_of_bins;
- figures_directory=data_struct.figures_directory;
- if get(handles.figures_visibility_on,'Value');
- figures_visibility='On';
- else
- figures_visibility='Off';
- end
- % Computing the initial registration according to a simple threshold:
- if get(handles.spatial_correlations,'Value')==1 % if spatial correlations are used
- initial_registration_type='Spatial correlation';
- initial_threshold=str2num(get(handles.correlation_threshold,'string'));
- [cell_to_index_map,registered_cells_spatial_correlations,non_registered_cells_spatial_correlations]=...
- initial_registration_spatial_correlations(normalized_maximal_distance,initial_threshold,spatial_footprints_corrected,centroid_locations_corrected);
- plot_initial_registration(cell_to_index_map,number_of_bins,spatial_footprints_corrected,initial_registration_type,figures_directory,figures_visibility,registered_cells_spatial_correlations,non_registered_cells_spatial_correlations)
- else
- initial_registration_type='Centroid distances';
- initial_threshold=str2num(get(handles.distance_threshold,'string'));
- centroid_distances_distribution_threshold=initial_threshold/microns_per_pixel;
- [cell_to_index_map,registered_cells_centroid_distances,non_registered_cells_centroid_distances]=...
- initial_registration_centroid_distances(normalized_maximal_distance,centroid_distances_distribution_threshold,centroid_locations_corrected);
- plot_initial_registration(cell_to_index_map,number_of_bins,spatial_footprints_corrected,initial_registration_type,figures_directory,figures_visibility,registered_cells_centroid_distances,non_registered_cells_centroid_distances,microns_per_pixel,normalized_maximal_distance)
- end
- disp([num2str(size(cell_to_index_map,1)) ' cells were found'])
- disp('Done')
- data_struct.initial_registration_type=initial_registration_type;
- data_struct.cell_to_index_map=cell_to_index_map;
- data_struct.initial_threshold=initial_threshold;
- data_struct.initial_registration_type=initial_registration_type;
- handles.data_struct=data_struct;
- guidata(hObject, handles)
- msgbox_timed(['Finished performing initial cell registration - ' num2str(size(cell_to_index_map,1)) ' were found'],3)
- % --- Executes on button press in register_cells_final.
- function register_cells_final_Callback(hObject,~, handles)
- % hObject handle to register_cells_final (see GCBO)
- % eventdata reserved - to be defined in a future version of MATLAB
- % handles struct with handles and user data (see GUIDATA)
- % Stage 5: Obtaining the final cell registration based on a correlation clustering algorithm.
- % This callback performs the final cell registration according to the
- % probability model for same cells and different cells. P_same can be
- % either according to centroid distances, spatial correlations or both:
- data_struct=handles.data_struct;
- if ~isfield(data_struct,'cell_to_index_map')
- errordlg('Final registration cannot be performed before initial registration')
- error('Final registration cannot be performed before initial registration')
- end
- if get(handles.spatial_correlations_2,'Value')==1
- if isfield(data_struct,'all_to_all_p_same_spatial_correlation_model')
- all_to_all_p_same_spatial_correlation_model=data_struct.all_to_all_p_same_spatial_correlation_model;
- all_to_all_indexes=data_struct.all_to_all_indexes;
- all_to_all_spatial_correlations=data_struct.all_to_all_spatial_correlations;
- else
- errordlg('Please compute the spatial correlations probability model before performing final cell registration')
- error('Please compute the spatial correlations probability model before performing final cell registration')
- end
- elseif get(handles.centroid_distances_2,'Value')==1
- if isfield(data_struct,'all_to_all_p_same_centroid_distance_model')
- all_to_all_p_same_centroid_distance_model=data_struct.all_to_all_p_same_centroid_distance_model;
- all_to_all_indexes=data_struct.all_to_all_indexes;
- all_to_all_centroid_distances=data_struct.all_to_all_centroid_distances;
- end
- end
- results_directory=data_struct.results_directory;
- figures_directory=data_struct.figures_directory;
- overlapping_FOV=data_struct.overlapping_FOV;
- cell_to_index_map=data_struct.cell_to_index_map;
- centroid_locations_corrected=data_struct.centroid_locations_corrected;
- spatial_footprints_corrected=data_struct.spatial_footprints_corrected;
- number_of_sessions=data_struct.number_of_sessions;
- microns_per_pixel=data_struct.microns_per_pixel;
- maximal_distance=data_struct.maximal_distance;
- normalized_maximal_distance=maximal_distance/microns_per_pixel;
- if get(handles.figures_visibility_on,'Value');
- figures_visibility='On';
- else
- figures_visibility='Off';
- end
- if get(handles.spatial_correlations_2,'Value')==1;
- model_type='Spatial correlation';
- else
- model_type='Centroid distance';
- end
- transform_data=false;
- if get(handles.use_model,'Value')==1;
- p_same_threshold=str2num(get(handles.decision_thresh,'string'));
- final_threshold=p_same_threshold;
- registration_approach='Probabilistic';
- else
- registration_approach='Simple threshold';
- if strcmp(model_type,'Spatial correlation')
- final_threshold=str2num(get(handles.simple_correlation_threshold,'string'));
- elseif strcmp(model_type,'Centroid distance')
- final_threshold=str2num(get(handles.simple_distance_threshold,'string'));
- centroid_distances_distribution_threshold=(maximal_distance-final_threshold)/maximal_distance;
- transform_data=true;
- end
- end
- data_struct.final_threshold=final_threshold;
- data_struct.registration_approach=registration_approach;
- data_struct.model_type=model_type;
- % Registering the cells with the clustering algorithm:
- disp('Stage 5 - Performing final registration')
- if strcmp(registration_approach,'Probabilistic')
- if strcmp(model_type,'Spatial correlation')
- [optimal_cell_to_index_map,registered_cells_centroids,cell_scores,cell_scores_positive,cell_scores_negative,cell_scores_exclusive,p_same_registered_pairs]=...
- cluster_cells(cell_to_index_map,all_to_all_p_same_spatial_correlation_model,all_to_all_indexes,normalized_maximal_distance,p_same_threshold,centroid_locations_corrected,registration_approach,transform_data);
- elseif strcmp(model_type,'Centroid distance')
- [optimal_cell_to_index_map,registered_cells_centroids,cell_scores,cell_scores_positive,cell_scores_negative,cell_scores_exclusive,p_same_registered_pairs]=...
- cluster_cells(cell_to_index_map,all_to_all_p_same_centroid_distance_model,all_to_all_indexes,normalized_maximal_distance,p_same_threshold,centroid_locations_corrected,registration_approach,transform_data);
- end
- plot_cell_scores(cell_scores_positive,cell_scores_negative,cell_scores_exclusive,cell_scores,p_same_registered_pairs,figures_directory,figures_visibility)
- elseif strcmp(registration_approach,'Simple threshold')
- if strcmp(model_type,'Spatial correlation')
- [optimal_cell_to_index_map,registered_cells_centroids]=...
- cluster_cells(cell_to_index_map,all_to_all_spatial_correlations,all_to_all_indexes,normalized_maximal_distance,final_threshold,centroid_locations_corrected,registration_approach,transform_data);
- elseif strcmp(model_type,'Centroid distance')
- [optimal_cell_to_index_map,registered_cells_centroids]=...
- cluster_cells(cell_to_index_map,all_to_all_centroid_distances,all_to_all_indexes,normalized_maximal_distance,centroid_distances_distribution_threshold,centroid_locations_corrected,registration_approach,transform_data);
- end
- end
- [is_in_overlapping_FOV]=check_if_in_overlapping_FOV(registered_cells_centroids,overlapping_FOV);
- % Plotting the registration results with the cell maps from all sessions:
- plot_all_registered_projections(spatial_footprints_corrected,optimal_cell_to_index_map,figures_directory,figures_visibility)
- % saving the clustering results:
- disp('Saving the results')
- cell_registered_struct=struct;
- cell_registered_struct.cell_to_index_map=optimal_cell_to_index_map;
- if strcmp(registration_approach,'Probabilistic');
- cell_registered_struct.cell_scores=cell_scores';
- cell_registered_struct.true_positive_scores=cell_scores_positive';
- cell_registered_struct.true_negative_scores=cell_scores_negative';
- cell_registered_struct.exclusivity_scores=cell_scores_exclusive';
- cell_registered_struct.p_same_registered_pairs=p_same_registered_pairs';
- end
- cell_registered_struct.is_cell_in_overlapping_FOV=is_in_overlapping_FOV';
- cell_registered_struct.registered_cells_centroids=registered_cells_centroids';
- cell_registered_struct.centroid_locations_corrected=centroid_locations_corrected';
- cell_registered_struct.spatial_footprints_corrected=spatial_footprints_corrected';
- cell_registered_struct.alignment_x_translations=data_struct.alignment_translations(1,:);
- cell_registered_struct.alignment_y_translations=data_struct.alignment_translations(2,:);
- if strcmp(data_struct.alignment_type,'Translations and Rotations')
- cell_registered_struct.alignment_rotations=data_struct.alignment_translations(3,:);
- end
- cell_registered_struct.adjustment_x_zero_padding=data_struct.adjustment_zero_padding(1,:);
- cell_registered_struct.adjustment_y_zero_padding=data_struct.adjustment_zero_padding(2,:);
- save(fullfile(results_directory,['cellRegistered_' datestr(clock,'yyyymmdd_HHMMss') '.mat']),'cell_registered_struct','-v7.3')
- % Saving a log file with all the chosen parameters:
- comments=get(handles.comments,'string');
- file_names=data_struct.file_names;
- adjusted_x_size=data_struct.adjusted_x_size;
- adjusted_y_size=data_struct.adjusted_y_size;
- alignment_type=data_struct.alignment_type;
- reference_session_index=data_struct.reference_session_index;
- number_of_bins=data_struct.number_of_bins;
- initial_registration_type=data_struct.initial_registration_type;
- initial_threshold=data_struct.initial_threshold;
- if strcmp(registration_approach,'Probabilistic')
- if strcmp(model_type,'Spatial correlation')
- uncertain_fraction_spatial_correlations=data_struct.uncertain_fraction_spatial_correlations;
- false_positive_per_correlation_threshold=data_struct.false_positive_per_correlation_threshold;
- true_positive_per_correlation_threshold=data_struct.true_positive_per_correlation_threshold;
- MSE_spatial_correlations_model=data_struct.MSE_spatial_correlations_model;
- save_log_file(results_directory,file_names,microns_per_pixel,adjusted_x_size,adjusted_y_size,alignment_type,reference_session_index,maximal_distance,number_of_bins,initial_registration_type,initial_threshold,registration_approach,model_type,final_threshold,optimal_cell_to_index_map,cell_registered_struct,comments,uncertain_fraction_spatial_correlations,false_positive_per_correlation_threshold,true_positive_per_correlation_threshold,MSE_spatial_correlations_model)
- elseif strcmp(model_type,'Centroid distance')
- uncertain_fraction_centroid_distances=data_struct.uncertain_fraction_centroid_distances;
- false_positive_per_distance_threshold=data_struct.false_positive_per_distance_threshold;
- true_positive_per_distance_threshold=data_struct.true_positive_per_distance_threshold;
- MSE_centroid_distances_model=data_struct.MSE_centroid_distances_model;
- save_log_file(results_directory,file_names,microns_per_pixel,adjusted_x_size,adjusted_y_size,alignment_type,reference_session_index,maximal_distance,number_of_bins,initial_registration_type,initial_threshold,registration_approach,model_type,final_threshold,optimal_cell_to_index_map,cell_registered_struct,comments,uncertain_fraction_centroid_distances,false_positive_per_distance_threshold,true_positive_per_distance_threshold,MSE_centroid_distances_model)
- end
- elseif strcmp(registration_approach,'Simple threshold')
- if strcmp(model_type,'Spatial correlation')
- save_log_file(results_directory,file_names,microns_per_pixel,adjusted_x_size,adjusted_y_size,alignment_type,reference_session_index,maximal_distance,number_of_bins,initial_registration_type,initial_threshold,registration_approach,model_type,final_threshold,optimal_cell_to_index_map,cell_registered_struct,comments)
- elseif strcmp(model_type,'Centroid distance')
- save_log_file(results_directory,file_names,microns_per_pixel,adjusted_x_size,adjusted_y_size,alignment_type,reference_session_index,maximal_distance,number_of_bins,initial_registration_type,initial_threshold,registration_approach,model_type,final_threshold,optimal_cell_to_index_map,cell_registered_struct,comments)
- end
- end
- if ~isempty(data_struct.temp_dir)
- for file_n = 1:length(spatial_footprints_corrected)
- split_name = strsplit(spatial_footprints_corrected{file_n},filesep);
- f_name = split_name{end};
- footprints = get_spatial_footprints(spatial_footprints_corrected{file_n});
- footprints = footprints.load_footprints;
- footprints = footprints.footprints;
- footprint = mat_to_sparse_cell(footprints);
- spatial_footprints_corrected{file_n} = fullfile(results_directory,f_name);
- save(fullfile(results_directory,f_name),'footprint');
- end
- rmdir(data_struct.temp_dir,'s');
- end
- disp([num2str(size(optimal_cell_to_index_map,1)) ' cells were found'])
- disp('End of cell registration procedure')
- handles.data_struct=data_struct;
- guidata(hObject, handles)
- msgbox_timed(['Finished performing final cell registration - ' num2str(size(optimal_cell_to_index_map,1)) ' were found'],3)
- % --- Executes on button press in reset.
- function reset_Callback(hObject,~, handles)
- % hObject handle to reset (see GCBO)
- % eventdata reserved - to be defined in a future version of MATLAB
- % handles struct with handles and user data (see GUIDATA)
- % defining data struct:
- guidata(hObject, handles);
- data_struct=struct;
- data_struct.sessions_list=[];
- % Reseting Figures and GUI parameters:
- cla(handles.axes1,'reset')
- axes(handles.axes1);
- plot([],[])
- set(gca,'xtick',[])
- set(gca,'ytick',[])
- cla(handles.axes2,'reset')
- axes(handles.axes2);
- plot([],[])
- set(gca,'xtick',[])
- set(gca,'ytick',[])
- cla(handles.axes3,'reset')
- axes(handles.axes3);
- plot([],[])
- set(gca,'xtick',[])
- set(gca,'ytick',[])
- cla(handles.axes4,'reset')
- axes(handles.axes4);
- plot([],[])
- set(gca,'xtick',[])
- set(gca,'ytick',[])
- cla(handles.axes5,'reset')
- axes(handles.axes5);
- plot([],[])
- set(gca,'xtick',[])
- set(gca,'ytick',[])
- cla(handles.axes6,'reset')
- axes(handles.axes6);
- plot([],[])
- set(gca,'xtick',[])
- set(gca,'ytick',[])
- set(handles.list_of_sessions,'value',1)
- set(handles.list_of_sessions,'string',[]);
- set(handles.red_session,'string','1')
- set(handles.green_session,'string','2')
- set(handles.blue_session,'string','3')
- set(handles.decision_thresh,'string','0.5')
- set(handles.initial_p_same_slider,'value',0.5);
- set(handles.initial_p_same_threshold,'string','0.5');
- set(handles.final_p_same_slider,'value',0.5);
- set(handles.model_maximal_distance,'string','14')
- set(handles.distance_threshold,'string','5')
- set(handles.correlation_threshold,'string','0.65')
- set(handles.simple_distance_threshold,'string','5')
- set(handles.simple_correlation_threshold,'string','0.65')
- set(handles.figures_visibility_on,'Value',1);
- set(handles.translations_rotations,'Value',1);
- set(handles.spatial_correlations_2,'Value',1);
- set(handles.use_model,'Value',1);
- set(handles.spatial_correlations,'Value',1);
- set(handles.microns_per_pixel,'value',0)
- set(handles.microns_per_pixel,'string',[])
- set(handles.microns_per_pixel,'backgroundColor',[1 1 1]);
- set(handles.reference_session_index,'string','1')
- set(handles.maximal_rotation','string','30')
- set(handles.maximal_rotation','enable','on')
- set(handles.transformation_smoothness,'string','2')
- set(handles.transformation_smoothness,'enable','off')
- set(handles.distance_threshold,'enable','off')
- set(handles.correlation_threshold,'enable','on')
- set(handles.simple_distance_threshold,'enable','off')
- set(handles.simple_correlation_threshold,'enable','off')
- set(handles.comments,'string',[])
- handles.data_struct=data_struct;
- guidata(hObject, handles)
- % --- Executes during object creation, after setting all properties.
- function correlation_threshold_CreateFcn(~,hObject,~)
- % hObject handle to correlation_threshold (see GCBO)
- % eventdata reserved - to be defined in a future version of MATLAB
- % handles empty - handles not created until after all CreateFcns called
- % Hint: edit controls usually have a white background on Windows.
- % See ISPC and COMPUTER.
- if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
- set(hObject,'BackgroundColor','white');
- end
- % --- Executes during object creation, after setting all properties.
- function distance_threshold_CreateFcn(hObject,~,~)
- % hObject handle to distance_threshold (see GCBO)
- % eventdata reserved - to be defined in a future version of MATLAB
- % handles empty - handles not created until after all CreateFcns called
- % Hint: edit controls usually have a white background on Windows.
- % See ISPC and COMPUTER.
- if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
- set(hObject,'BackgroundColor','white');
- end
- % --- Executes during object creation, after setting all properties.
- function list_of_sessions_CreateFcn(hObject, ~,~)
- % hObject handle to list_of_sessions (see GCBO)
- % eventdata reserved - to be defined in a future version of MATLAB
- % handles empty - handles not created until after all CreateFcns called
- % Hint: listbox controls usually have a white background on Windows.
- % See ISPC and COMPUTER.
- if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
- set(hObject,'BackgroundColor','white');
- end
- % --- Executes during object creation, after setting all properties.
- function maximal_distance_CreateFcn(hObject,~,~)
- % hObject handle to maximal_distance (see GCBO)
- % eventdata reserved - to be defined in a future version of MATLAB
- % handles empty - handles not created until after all CreateFcns called
- % Hint: edit controls usually have a white background on Windows.
- % See ISPC and COMPUTER.
- if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
- set(hObject,'BackgroundColor','white');
- end
- % --- Executes during object creation, after setting all properties.
- function number_of_bins_CreateFcn(hObject,~,~)
- % hObject handle to number_of_bins (see GCBO)
- % eventdata reserved - to be defined in a future version of MATLAB
- % handles empty - handles not created until after all CreateFcns called
- % Hint: edit controls usually have a white background on Windows.
- % See ISPC and COMPUTER.
- if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
- set(hObject,'BackgroundColor','white');
- end
- % --- Executes during object creation, after setting all properties.
- function compute_model_CreateFcn(~,~,~)
- % hObject handle to compute_model (see GCBO)
- % eventdata reserved - to be defined in a future version of MATLAB
- % handles empty - handles not created until after all CreateFcns called
- % --- Executes during object creation, after setting all properties.
- function transformation_type_CreateFcn(~,~,~)
- % hObject handle to transformation_type (see GCBO)
- % eventdata reserved - to be defined in a future version of MATLAB
- % handles empty - handles not created until after all CreateFcns called
- function microns_per_pixel_Callback(~,~, handles)
- % hObject handle to microns_per_pixel (see GCBO)
- % eventdata reserved - to be defined in a future version of MATLAB
- % handles struct with handles and user data (see GUIDATA)
- % Hints: get(hObject,'String') returns contents of microns_per_pixel as text
- % str2num(get(hObject,'String')) returns contents of microns_per_pixel as a double
- microns_per_pixel=get(handles.microns_per_pixel,'string');
- if ~isempty(microns_per_pixel)
- set(handles.microns_per_pixel,'value',1)
- end
- % --- Executes during object creation, after setting all properties.
- function microns_per_pixel_CreateFcn(hObject,~,~)
- % hObject handle to microns_per_pixel (see GCBO)
- % eventdata reserved - to be defined in a future version of MATLAB
- % handles empty - handles not created until after all CreateFcns called
- % Hint: edit controls usually have a white background on Windows.
- % See ISPC and COMPUTER.
- if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
- set(hObject,'BackgroundColor','white');
- end
- function reference_session_index_Callback(~,~, handles)
- % hObject handle to reference_session_index (see GCBO)
- % eventdata reserved - to be defined in a future version of MATLAB
- % handles struct with handles and user data (see GUIDATA)
- % Hints: get(hObject,'String') returns contents of reference_session_index as text
- % str2num(get(hObject,'String')) returns contents of reference_session_index as a double
- reference_session_index=get(handles.reference_session_index,'string');
- if ~isempty(reference_session_index)
- set(handles.reference_session_index,'value',1)
- end
- % --- Executes during object creation, after setting all properties.
- function reference_session_index_CreateFcn(hObject, ~, ~)
- % hObject handle to reference_session_index (see GCBO)
- % eventdata reserved - to be defined in a future version of MATLAB
- % handles empty - handles not created until after all CreateFcns called
- % Hint: edit controls usually have a white background on Windows.
- % See ISPC and COMPUTER.
- if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
- set(hObject,'BackgroundColor','white');
- end
- % --- Executes during object creation, after setting all properties.
- function model_maximal_distance_CreateFcn(hObject,~,~)
- % hObject handle to model_maximal_distance (see GCBO)
- % eventdata reserved - to be defined in a future version of MATLAB
- % handles empty - handles not created until after all CreateFcns called
- % Hint: edit controls usually have a white background on Windows.
- % See ISPC and COMPUTER.
- if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
- set(hObject,'BackgroundColor','white');
- end
- % --- Executes during object creation, after setting all properties.
- function cluster_maximal_distance_CreateFcn(hObject,~,~)
- % hObject handle to cluster_maximal_distance (see GCBO)
- % eventdata reserved - to be defined in a future version of MATLAB
- % handles empty - handles not created until after all CreateFcns called
- % Hint: edit controls usually have a white background on Windows.
- % See ISPC and COMPUTER.
- if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
- set(hObject,'BackgroundColor','white');
- end
- % --- Executes during object creation, after setting all properties.
- function max_iterations_CreateFcn(hObject,~,~)
- % hObject handle to max_iterations (see GCBO)
- % eventdata reserved - to be defined in a future version of MATLAB
- % handles empty - handles not created until after all CreateFcns called
- % Hint: edit controls usually have a white background on Windows.
- % See ISPC and COMPUTER.
- if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
- set(hObject,'BackgroundColor','white');
- end
- % --- Executes during object creation, after setting all properties.
- function decision_thresh_CreateFcn(hObject,~,~)
- % hObject handle to decision_thresh (see GCBO)
- % eventdata reserved - to be defined in a future version of MATLAB
- % handles empty - handles not created until after all CreateFcns called
- % Hint: edit controls usually have a white background on Windows.
- % See ISPC and COMPUTER.
- if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
- set(hObject,'BackgroundColor','white');
- end
- function load_Callback(~,~,~)
- % hObject handle to load (see GCBO)
- % eventdata reserved - to be defined in a future version of MATLAB
- % handles struct with handles and user data (see GUIDATA)
- % --- Executes on selection change in list_of_sessions.
- function list_of_sessions_Callback(hObject, eventdata, handles)
- % hObject handle to list_of_sessions (see GCBO)
- % eventdata reserved - to be defined in a future version of MATLAB
- % handles struct with handles and user data (see GUIDATA)
- % Hints: contents = cellstr(get(hObject,'String')) returns list_of_sessions contents as cell array
- % contents{get(hObject,'Value')} returns selected item from list_of_sessions
- function model_maximal_distance_Callback(hObject, eventdata, handles)
- % hObject handle to model_maximal_distance (see GCBO)
- % eventdata reserved - to be defined in a future version of MATLAB
- % handles struct with handles and user data (see GUIDATA)
- % Hints: get(hObject,'String') returns contents of model_maximal_distance as text
- % str2num(get(hObject,'String')) returns contents of model_maximal_distance as a double
- function number_of_bins_Callback(hObject, eventdata, handles)
- % hObject handle to number_of_bins (see GCBO)
- % eventdata reserved - to be defined in a future version of MATLAB
- % handles struct with handles and user data (see GUIDATA)
- % Hints: get(hObject,'String') returns contents of number_of_bins as text
- % str2num(get(hObject,'String')) returns contents of number_of_bins as a double
- % --- Executes when selected object is changed in transformation_type.
- function transformation_type_SelectionChangeFcn(hObject, eventdata, handles)
- % hObject handle to the selected object in transformation_type
- % eventdata struct with the following fields (see UIBUTTONGROUP)
- % EventName: string 'SelectionChanged' (read only)
- % OldValue: handle of the previously selected object or empty if none was selected
- % NewValue: handle of the currently selected object
- % handles struct with handles and user data (see GUIDATA)
- if get(handles.translations,'Value')==1;
- set(handles.maximal_rotation','enable','off')
- else
- set(handles.maximal_rotation','enable','on')
- set(handles.maximal_rotation','string','30')
- end
- function maximal_rotation_Callback(hObject, eventdata, handles)
- % hObject handle to maximal_rotation (see GCBO)
- % eventdata reserved - to be defined in a future version of MATLAB
- % handles struct with handles and user data (see GUIDATA)
- % Hints: get(hObject,'String') returns contents of maximal_rotation as text
- % str2num(get(hObject,'String')) returns contents of maximal_rotation as a double
- % --- Executes during object creation, after setting all properties.
- function maximal_rotation_CreateFcn(hObject, eventdata, handles)
- % hObject handle to maximal_rotation (see GCBO)
- % eventdata reserved - to be defined in a future version of MATLAB
- % handles empty - handles not created until after all CreateFcns called
- % Hint: edit controls usually have a white background on Windows.
- % See ISPC and COMPUTER.
- if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
- set(hObject,'BackgroundColor','white');
- end
- % --- Executes during object creation, after setting all properties.
- function figure1_CreateFcn(hObject, eventdata, handles)
- % hObject handle to figure1 (see GCBO)
- % eventdata reserved - to be defined in a future version of MATLAB
- % handles empty - handles not created until after all CreateFcns called
- % --- Executes when selected object is changed in initial_register_select.
- function initial_register_select_SelectionChangedFcn(hObject, eventdata, handles)
- % hObject handle to the selected object in initial_register_select
- % eventdata reserved - to be defined in a future version of MATLAB
- % handles struct with handles and user data (see GUIDATA)
- if get(handles.spatial_correlations,'Value')==1;
- set(handles.distance_threshold,'enable','off')
- set(handles.correlation_threshold,'enable','on')
- else
- set(handles.correlation_threshold,'enable','off')
- set(handles.distance_threshold,'enable','on')
- end
- function comments_Callback(hObject, eventdata, handles)
- % hObject handle to comments (see GCBO)
- % eventdata reserved - to be defined in a future version of MATLAB
- % handles struct with handles and user data (see GUIDATA)
- % Hints: get(hObject,'String') returns contents of comments as text
- % str2num(get(hObject,'String')) returns contents of comments as a double
- % --- Executes during object creation, after setting all properties.
- function comments_CreateFcn(hObject, eventdata, handles)
- % hObject handle to comments (see GCBO)
- % eventdata reserved - to be defined in a future version of MATLAB
- % handles empty - handles not created until after all CreateFcns called
- % Hint: edit controls usually have a white background on Windows.
- % See ISPC and COMPUTER.
- if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
- set(hObject,'BackgroundColor','white');
- end
- % --- Executes on button press in display_rgb.
- function display_rgb_Callback(hObject, eventdata, handles)
- % hObject handle to display_rgb (see GCBO)
- % eventdata reserved - to be defined in a future version of MATLAB
- % handles struct with handles and user data (see GUIDATA)
- data_struct=handles.data_struct;
- if ~isfield(data_struct,'footprints_projections_corrected')
- errordlg('RGB overlay cannot be displayed before transformation is performed')
- else
- spatial_footprints_projections=data_struct.footprints_projections_corrected;
- overlapping_FOV=data_struct.overlapping_FOV;
- if get(handles.figures_visibility_on,'Value');
- figures_visibility='On';
- else
- figures_visibility='Off';
- end
- number_of_sessions=data_struct.number_of_sessions;
- red_session=str2num(get(handles.red_session,'string'));
- green_session=str2num(get(handles.green_session,'string'));
- if number_of_sessions>2
- blue_session=str2num(get(handles.blue_session,'string'));
- RGB_indexes=[red_session green_session blue_session];
- else
- RGB_indexes=[red_session green_session];
- end
- axes(handles.axes1);
- plot_RGB_overlay(spatial_footprints_projections,RGB_indexes,overlapping_FOV)
- figure('units','normalized','outerposition',[0.325 0.25 0.35 0.5],'Visible',figures_visibility)
- plot_RGB_overlay(spatial_footprints_projections,RGB_indexes,overlapping_FOV)
- end
- handles.data_struct=data_struct;
- guidata(hObject, handles)
- function red_session_Callback(hObject, eventdata, handles)
- % hObject handle to red_session (see GCBO)
- % eventdata reserved - to be defined in a future version of MATLAB
- % handles struct with handles and user data (see GUIDATA)
- % Hints: get(hObject,'String') returns contents of red_session as text
- % str2num(get(hObject,'String')) returns contents of red_session as a double
- % --- Executes during object creation, after setting all properties.
- function red_session_CreateFcn(hObject, eventdata, handles)
- % hObject handle to red_session (see GCBO)
- % eventdata reserved - to be defined in a future version of MATLAB
- % handles empty - handles not created until after all CreateFcns called
- % Hint: edit controls usually have a white background on Windows.
- % See ISPC and COMPUTER.
- if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
- set(hObject,'BackgroundColor','white');
- end
- function green_session_Callback(hObject, eventdata, handles)
- % hObject handle to green_session (see GCBO)
- % eventdata reserved - to be defined in a future version of MATLAB
- % handles struct with handles and user data (see GUIDATA)
- % Hints: get(hObject,'String') returns contents of green_session as text
- % str2num(get(hObject,'String')) returns contents of green_session as a double
- % --- Executes during object creation, after setting all properties.
- function green_session_CreateFcn(hObject, eventdata, handles)
- % hObject handle to green_session (see GCBO)
- % eventdata reserved - to be defined in a future version of MATLAB
- % handles empty - handles not created until after all CreateFcns called
- % Hint: edit controls usually have a white background on Windows.
- % See ISPC and COMPUTER.
- if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
- set(hObject,'BackgroundColor','white');
- end
- function blue_session_Callback(hObject, eventdata, handles)
- % hObject handle to blue_session (see GCBO)
- % eventdata reserved - to be defined in a future version of MATLAB
- % handles struct with handles and user data (see GUIDATA)
- % Hints: get(hObject,'String') returns contents of blue_session as text
- % str2num(get(hObject,'String')) returns contents of blue_session as a double
- % --- Executes during object creation, after setting all properties.
- function blue_session_CreateFcn(hObject, eventdata, handles)
- % hObject handle to blue_session (see GCBO)
- % eventdata reserved - to be defined in a future version of MATLAB
- % handles empty - handles not created until after all CreateFcns called
- % Hint: edit controls usually have a white background on Windows.
- % See ISPC and COMPUTER.
- if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
- set(hObject,'BackgroundColor','white');
- end
- % --- Executes on slider movement.
- function initial_p_same_slider_Callback(hObject, eventdata, handles)
- % hObject handle to initial_p_same_slider (see GCBO)
- % eventdata reserved - to be defined in a future version of MATLAB
- % handles struct with handles and user data (see GUIDATA)
- % Hints: get(hObject,'Value') returns position of slider
- % get(hObject,'Min') and get(hObject,'Max') to determine range of slider
- data_struct=handles.data_struct;
- initial_p_same_slider_value=round(100*get(handles.initial_p_same_slider,'value'))/100;
- set(handles.initial_p_same_threshold,'string',num2str(initial_p_same_slider_value));
- centers_of_bins=data_struct.centers_of_bins;
- if get(handles.spatial_correlations,'Value')==1
- spatial_correlations_distribution=data_struct.spatial_correlations_distribution;
- p_same_given_spatial_correlation=data_struct.p_same_given_spatial_correlation;
- [~,p_same_ind]=min(abs(initial_p_same_slider_value-(p_same_given_spatial_correlation)));
- spatial_correlation_threshold=round(100*centers_of_bins{2}(p_same_ind))/100;
- set(handles.correlation_threshold,'string',num2str(spatial_correlation_threshold));
- axes(handles.axes4)
- cla(handles.axes4,'reset')
- plot_p_same_spatial_correlation_slider(spatial_correlations_distribution,p_same_given_spatial_correlation,spatial_correlation_threshold,centers_of_bins)
- else
- centroid_distances_distribution=data_struct.centroid_distances_distribution;
- p_same_given_centroid_distance=data_struct.p_same_given_centroid_distance;
- microns_per_pixel=data_struct.microns_per_pixel;
- maximal_distance=data_struct.maximal_distance/microns_per_pixel;
- [~,p_same_ind]=min(abs(initial_p_same_slider_value-(p_same_given_centroid_distance)));
- centroid_distance_threshold=round(microns_per_pixel*100*centers_of_bins{1}(p_same_ind))/100;
- set(handles.distance_threshold,'string',num2str(centroid_distance_threshold));
- axes(handles.axes3)
- cla(handles.axes3,'reset')
- plot_p_same_centroid_distance_slider(centroid_distances_distribution,p_same_given_centroid_distance,centroid_distance_threshold,centers_of_bins,maximal_distance,microns_per_pixel)
- end
- handles.data_struct=data_struct;
- guidata(hObject, handles)
- % --- Executes during object creation, after setting all properties.
- function initial_p_same_slider_CreateFcn(hObject, eventdata, handles)
- % hObject handle to initial_p_same_slider (see GCBO)
- % eventdata reserved - to be defined in a future version of MATLAB
- % handles empty - handles not created until after all CreateFcns called
- % Hint: slider controls usually have a light gray background.
- if isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
- set(hObject,'BackgroundColor',[.9 .9 .9]);
- end
- function initial_p_same_threshold_Callback(hObject, eventdata, handles)
- % hObject handle to initial_all_to_all_centroid_distances (see GCBO)
- % eventdata reserved - to be defined in a future version of MATLAB
- % handles struct with handles and user data (see GUIDATA)
- % Hints: get(hObject,'String') returns contents of initial_all_to_all_centroid_distances as text
- % str2num(get(hObject,'String')) returns contents of initial_all_to_all_centroid_distances as a double
- data_struct=handles.data_struct;
- initial_p_same_slider_value=str2num(get(handles.initial_p_same_threshold,'string'));
- set(handles.initial_p_same_slider,'value',initial_p_same_slider_value);
- centers_of_bins=data_struct.centers_of_bins;
- if get(handles.spatial_correlations,'Value')==1
- spatial_correlations_distribution=data_struct.spatial_correlations_distribution;
- p_same_given_spatial_correlation=data_struct.p_same_given_spatial_correlation;
- [~,p_same_ind]=min(abs(initial_p_same_slider_value-(p_same_given_spatial_correlation)));
- spatial_correlation_threshold=round(100*centers_of_bins{2}(p_same_ind))/100;
- set(handles.correlation_threshold,'string',num2str(spatial_correlation_threshold));
- axes(handles.axes4)
- cla(handles.axes4,'reset')
- plot_p_same_spatial_correlation_slider(spatial_correlations_distribution,p_same_given_spatial_correlation,spatial_correlation_threshold,centers_of_bins)
- else
- centroid_distances_distribution=data_struct.centroid_distances_distribution;
- p_same_given_centroid_distance=data_struct.p_same_given_centroid_distance;
- microns_per_pixel=data_struct.microns_per_pixel;
- maximal_distance=data_struct.maximal_distance/microns_per_pixel;
- [~,p_same_ind]=min(abs(initial_p_same_slider_value-(p_same_given_centroid_distance)));
- centroid_distance_threshold=round(microns_per_pixel*100*centers_of_bins{1}(p_same_ind))/100;
- set(handles.distance_threshold,'string',num2str(centroid_distance_threshold));
- axes(handles.axes3)
- cla(handles.axes3,'reset')
- plot_p_same_centroid_distance_slider(centroid_distances_distribution,p_same_given_centroid_distance,centroid_distance_threshold,centers_of_bins,maximal_distance,microns_per_pixel)
- end
- handles.data_struct=data_struct;
- guidata(hObject, handles)
- % --- Executes during object creation, after setting all properties.
- function initial_p_same_threshold_CreateFcn(hObject, eventdata, handles)
- % hObject handle to initial_all_to_all_centroid_distances (see GCBO)
- % eventdata reserved - to be defined in a future version of MATLAB
- % handles empty - handles not created until after all CreateFcns called
- % Hint: edit controls usually have a white background on Windows.
- % See ISPC and COMPUTER.
- if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
- set(hObject,'BackgroundColor','white');
- end
- % --- Executes on button press in default_initial_registration.
- function default_initial_registration_Callback(hObject, eventdata, handles)
- % hObject handle to default_initial_registration (see GCBO)
- % eventdata reserved - to be defined in a future version of MATLAB
- % handles struct with handles and user data (see GUIDATA)
- initial_p_same_slider_value=0.5;
- data_struct=handles.data_struct;
- set(handles.initial_p_same_slider,'value',initial_p_same_slider_value);
- set(handles.initial_p_same_threshold,'string',num2str(initial_p_same_slider_value));
- centers_of_bins=data_struct.centers_of_bins;
- spatial_correlations_distribution=data_struct.spatial_correlations_distribution;
- p_same_given_spatial_correlation=data_struct.p_same_given_spatial_correlation;
- [~,p_same_ind]=min(abs(initial_p_same_slider_value-(p_same_given_spatial_correlation)));
- spatial_correlation_threshold=round(100*centers_of_bins{2}(p_same_ind))/100;
- set(handles.correlation_threshold,'string',num2str(spatial_correlation_threshold));
- axes(handles.axes4)
- cla(handles.axes4,'reset')
- plot_p_same_spatial_correlation_slider(spatial_correlations_distribution,p_same_given_spatial_correlation,spatial_correlation_threshold,centers_of_bins)
- centroid_distances_distribution=data_struct.centroid_distances_distribution;
- p_same_given_centroid_distance=data_struct.p_same_given_centroid_distance;
- microns_per_pixel=data_struct.microns_per_pixel;
- maximal_distance=data_struct.maximal_distance/microns_per_pixel;
- [~,p_same_ind]=min(abs(initial_p_same_slider_value-(p_same_given_centroid_distance)));
- centroid_distance_threshold=round(microns_per_pixel*100*centers_of_bins{1}(p_same_ind))/100;
- set(handles.distance_threshold,'string',num2str(centroid_distance_threshold));
- axes(handles.axes3)
- cla(handles.axes3,'reset')
- plot_p_same_centroid_distance_slider(centroid_distances_distribution,p_same_given_centroid_distance,centroid_distance_threshold,centers_of_bins,maximal_distance,microns_per_pixel)
- handles.data_struct=data_struct;
- guidata(hObject, handles)
- % --- Executes on slider movement.
- function final_p_same_slider_Callback(hObject, eventdata, handles)
- % hObject handle to final_p_same_slider (see GCBO)
- % eventdata reserved - to be defined in a future version of MATLAB
- % handles structure with handles and user data (see GUIDATA)
- % Hints: get(hObject,'Value') returns position of slider
- % get(hObject,'Min') and get(hObject,'Max') to determine range of slider
- if get(handles.use_model,'Value')==1;
- data_struct=handles.data_struct;
- final_p_same_slider_value=round(100*get(handles.final_p_same_slider,'value'))/100;
- set(handles.decision_thresh,'string',num2str(final_p_same_slider_value));
- centers_of_bins=data_struct.centers_of_bins;
- if get(handles.spatial_correlations_2,'Value')==1
- spatial_correlations_distribution=data_struct.spatial_correlations_distribution;
- p_same_given_spatial_correlation=data_struct.p_same_given_spatial_correlation;
- [~,p_same_ind]=min(abs(final_p_same_slider_value-(p_same_given_spatial_correlation)));
- spatial_correlation_threshold=round(100*centers_of_bins{2}(p_same_ind))/100;
- set(handles.correlation_threshold,'string',num2str(spatial_correlation_threshold));
- axes(handles.axes4)
- cla(handles.axes4,'reset')
- plot_p_same_spatial_correlation_slider(spatial_correlations_distribution,p_same_given_spatial_correlation,spatial_correlation_threshold,centers_of_bins)
- else
- centroid_distances_distribution=data_struct.centroid_distances_distribution;
- p_same_given_centroid_distance=data_struct.p_same_given_centroid_distance;
- microns_per_pixel=data_struct.microns_per_pixel;
- maximal_distance=data_struct.maximal_distance/microns_per_pixel;
- [~,p_same_ind]=min(abs(final_p_same_slider_value-(p_same_given_centroid_distance)));
- centroid_distance_threshold=round(microns_per_pixel*100*centers_of_bins{1}(p_same_ind))/100;
- set(handles.distance_threshold,'string',num2str(centroid_distance_threshold));
- axes(handles.axes3)
- cla(handles.axes3,'reset')
- plot_p_same_centroid_distance_slider(centroid_distances_distribution,p_same_given_centroid_distance,centroid_distance_threshold,centers_of_bins,maximal_distance,microns_per_pixel)
- end
- handles.data_struct=data_struct;
- guidata(hObject, handles)
- end
- % --- Executes during object creation, after setting all properties.
- function final_p_same_slider_CreateFcn(hObject, eventdata, handles)
- % hObject handle to final_p_same_slider (see GCBO)
- % eventdata reserved - to be defined in a future version of MATLAB
- % handles empty - handles not created until after all CreateFcns called
- % Hint: slider controls usually have a light gray background.
- if isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
- set(hObject,'BackgroundColor',[.9 .9 .9]);
- end
- % --- Executes on button press in default_final_registration.
- function default_final_registration_Callback(hObject, eventdata, handles)
- % hObject handle to default_final_registration (see GCBO)
- % eventdata reserved - to be defined in a future version of MATLAB
- % handles struct with handles and user data (see GUIDATA)
- if get(handles.use_model,'Value')==1;
- final_p_same_slider_value=0.5;
- data_struct=handles.data_struct;
- set(handles.final_p_same_slider,'value',final_p_same_slider_value);
- set(handles.decision_thresh,'string',num2str(final_p_same_slider_value));
- optimal_threshold=data_struct.spatial_correlation_intersection;
- set(handles.simple_correlation_threshold,'string',optimal_threshold);
- centers_of_bins=data_struct.centers_of_bins;
- spatial_correlations_distribution=data_struct.spatial_correlations_distribution;
- p_same_given_spatial_correlation=data_struct.p_same_given_spatial_correlation;
- [~,p_same_ind]=min(abs(final_p_same_slider_value-(p_same_given_spatial_correlation)));
- spatial_correlation_threshold=round(100*centers_of_bins{2}(p_same_ind))/100;
- set(handles.correlation_threshold,'string',num2str(spatial_correlation_threshold));
- axes(handles.axes4)
- cla(handles.axes4,'reset')
- plot_p_same_spatial_correlation_slider(spatial_correlations_distribution,p_same_given_spatial_correlation,spatial_correlation_threshold,centers_of_bins)
- centroid_distances_distribution=data_struct.centroid_distances_distribution;
- p_same_given_centroid_distance=data_struct.p_same_given_centroid_distance;
- microns_per_pixel=data_struct.microns_per_pixel;
- maximal_distance=data_struct.maximal_distance/microns_per_pixel;
- [~,p_same_ind]=min(abs(final_p_same_slider_value-(p_same_given_centroid_distance)));
- centroid_distance_threshold=round(microns_per_pixel*100*centers_of_bins{1}(p_same_ind))/100;
- set(handles.distance_threshold,'string',num2str(centroid_distance_threshold));
- axes(handles.axes3)
- cla(handles.axes3,'reset')
- plot_p_same_centroid_distance_slider(centroid_distances_distribution,p_same_given_centroid_distance,centroid_distance_threshold,centers_of_bins,maximal_distance,microns_per_pixel)
- handles.data_struct=data_struct;
- guidata(hObject, handles)
- end
- function decision_thresh_Callback(hObject, eventdata, handles)
- % hObject handle to decision_thresh (see GCBO)
- % eventdata reserved - to be defined in a future version of MATLAB
- % handles struct with handles and user data (see GUIDATA)
- % Hints: get(hObject,'String') returns contents of decision_thresh as text
- % str2num(get(hObject,'String')) returns contents of decision_thresh as a double
- if get(handles.use_model,'Value')==1;
- data_struct=handles.data_struct;
- final_p_same_slider_value=str2num(get(handles.decision_thresh,'string'));
- set(handles.final_p_same_slider,'value',final_p_same_slider_value);
- centers_of_bins=data_struct.centers_of_bins;
- if get(handles.spatial_correlations_2,'Value')==1
- spatial_correlations_distribution=data_struct.spatial_correlations_distribution;
- p_same_given_spatial_correlation=data_struct.p_same_given_spatial_correlation;
- [~,p_same_ind]=min(abs(final_p_same_slider_value-(p_same_given_spatial_correlation)));
- spatial_correlation_threshold=round(100*centers_of_bins{2}(p_same_ind))/100;
- set(handles.correlation_threshold,'string',num2str(spatial_correlation_threshold));
- axes(handles.axes4)
- cla(handles.axes4,'reset')
- plot_p_same_spatial_correlation_slider(spatial_correlations_distribution,p_same_given_spatial_correlation,spatial_correlation_threshold,centers_of_bins)
- else
- centroid_distances_distribution=data_struct.centroid_distances_distribution;
- p_same_given_centroid_distance=data_struct.p_same_given_centroid_distance;
- microns_per_pixel=data_struct.microns_per_pixel;
- maximal_distance=data_struct.maximal_distance/microns_per_pixel;
- [~,p_same_ind]=min(abs(final_p_same_slider_value-(p_same_given_centroid_distance)));
- centroid_distance_threshold=round(microns_per_pixel*100*centers_of_bins{1}(p_same_ind))/100;
- set(handles.distance_threshold,'string',num2str(centroid_distance_threshold));
- axes(handles.axes3)
- cla(handles.axes3,'reset')
- plot_p_same_centroid_distance_slider(centroid_distances_distribution,p_same_given_centroid_distance,centroid_distance_threshold,centers_of_bins,maximal_distance,microns_per_pixel)
- end
- handles.data_struct=data_struct;
- guidata(hObject, handles)
- end
- % --- Executes on button press in use_simple_threshold.
- function use_simple_threshold_Callback(hObject, eventdata, handles)
- % hObject handle to use_simple_threshold (see GCBO)
- % eventdata reserved - to be defined in a future version of MATLAB
- % handles struct with handles and user data (see GUIDATA)
- % Hint: get(hObject,'Value') returns toggle state of use_simple_threshold
- % --- Executes on button press in use_model.
- function use_model_Callback(hObject, eventdata, handles)
- % hObject handle to use_model (see GCBO)
- % eventdata reserved - to be defined in a future version of MATLAB
- % handles struct with handles and user data (see GUIDATA)
- % Hint: get(hObject,'Value') returns toggle state of use_model
- % --- Executes during object creation, after setting all properties.
- function Registration_approach_CreateFcn(hObject, eventdata, handles)
- % hObject handle to Registration_approach (see GCBO)
- % eventdata reserved - to be defined in a future version of MATLAB
- % handles empty - handles not created until after all CreateFcns called
- % --- Executes when selected object is changed in Registration_approach.
- function Registration_approach_SelectionChangeFcn(hObject, eventdata, handles)
- % hObject handle to the selected object in transformation_type
- % eventdata struct with the following fields (see UIBUTTONGROUP)
- % EventName: string 'SelectionChanged' (read only)
- % OldValue: handle of the previously selected object or empty if none was selected
- % NewValue: handle of the currently selected object
- % handles struct with handles and user data (see GUIDATA)
- if get(handles.use_model,'Value')==1;
- set(handles.use_simple_threshold,'value',0)
- set(handles.decision_thresh,'enable','on')
- set(handles.simple_correlation_threshold,'enable','off')
- set(handles.simple_distance_threshold,'enable','off')
- elseif get(handles.use_simple_threshold,'Value')==1;
- set(handles.use_model,'value',0)
- set(handles.decision_thresh,'enable','off')
- if get(handles.spatial_correlations_2,'value')==1
- set(handles.simple_correlation_threshold,'enable','on')
- set(handles.simple_distance_threshold,'enable','off')
- elseif get(handles.centroid_distances_2,'value')==1
- set(handles.simple_correlation_threshold,'enable','off')
- set(handles.simple_distance_threshold,'enable','on')
- end
- end
- function simple_correlation_threshold_Callback(hObject, eventdata, handles)
- % hObject handle to simple_correlation_threshold (see GCBO)
- % eventdata reserved - to be defined in a future version of MATLAB
- % handles struct with handles and user data (see GUIDATA)
- % Hints: get(hObject,'String') returns contents of simple_correlation_threshold as text
- % str2num(get(hObject,'String')) returns contents of simple_correlation_threshold as a double
- % --- Executes during object creation, after setting all properties.
- function simple_correlation_threshold_CreateFcn(hObject, eventdata, handles)
- % hObject handle to simple_correlation_threshold (see GCBO)
- % eventdata reserved - to be defined in a future version of MATLAB
- % handles empty - handles not created until after all CreateFcns called
- % Hint: edit controls usually have a white background on Windows.
- % See ISPC and COMPUTER.
- if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
- set(hObject,'BackgroundColor','white');
- end
- % --- Executes when selected object is changed in probability_model_select.
- function probability_model_select_SelectionChangedFcn(hObject, eventdata, handles)
- % hObject handle to the selected object in probability_model_select
- % eventdata reserved - to be defined in a future version of MATLAB
- % handles struct with handles and user data (see GUIDATA)
- if get(handles.use_model,'Value')==1;
- set(handles.use_simple_threshold,'value',0)
- set(handles.decision_thresh,'enable','on')
- set(handles.simple_correlation_threshold,'enable','off')
- set(handles.simple_distance_threshold,'enable','off')
- elseif get(handles.use_simple_threshold,'Value')==1;
- set(handles.use_model,'value',0)
- set(handles.decision_thresh,'enable','off')
- if get(handles.spatial_correlations_2,'value')==1
- set(handles.simple_correlation_threshold,'enable','on')
- set(handles.simple_distance_threshold,'enable','off')
- elseif get(handles.centroid_distances_2,'value')==1
- set(handles.simple_correlation_threshold,'enable','off')
- set(handles.simple_distance_threshold,'enable','on')
- end
- end
- function simple_distance_threshold_Callback(hObject, eventdata, handles)
- % hObject handle to simple_distance_threshold (see GCBO)
- % eventdata reserved - to be defined in a future version of MATLAB
- % handles struct with handles and user data (see GUIDATA)
- % Hints: get(hObject,'String') returns contents of simple_distance_threshold as text
- % str2num(get(hObject,'String')) returns contents of simple_distance_threshold as a double
- % --- Executes during object creation, after setting all properties.
- function simple_distance_threshold_CreateFcn(hObject, eventdata, handles)
- % hObject handle to simple_distance_threshold (see GCBO)
- % eventdata reserved - to be defined in a future version of MATLAB
- % handles empty - handles not created until after all CreateFcns called
- % Hint: edit controls usually have a white background on Windows.
- % See ISPC and COMPUTER.
- if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
- set(hObject,'BackgroundColor','white');
- end
- function distance_threshold_Callback(hObject, eventdata, handles)
- % hObject handle to distance_threshold (see GCBO)
- % eventdata reserved - to be defined in a future version of MATLAB
- % handles structure with handles and user data (see GUIDATA)
- % Hints: get(hObject,'String') returns contents of distance_threshold as text
- % str2double(get(hObject,'String')) returns contents of distance_threshold as a double
- function correlation_threshold_Callback(hObject, eventdata, handles)
- % hObject handle to correlation_threshold (see GCBO)
- % eventdata reserved - to be defined in a future version of MATLAB
- % handles structure with handles and user data (see GUIDATA)
- % Hints: get(hObject,'String') returns contents of correlation_threshold as text
- % str2double(get(hObject,'String')) returns contents of correlation_threshold as a double
- % --- Executes on button press in non_rigid.
- function non_rigid_Callback(hObject, eventdata, handles)
- % hObject handle to non_rigid (see GCBO)
- % eventdata reserved - to be defined in a future version of MATLAB
- % handles structure with handles and user data (see GUIDATA)
- % Hint: get(hObject,'Value') returns toggle state of non_rigid
- if get(handles.non_rigid,'Value')==1
- set(handles.maximal_rotation,'enable','off')
- set(handles.transformation_smoothness,'enable','on')
- end
- function transformation_smoothness_Callback(hObject, eventdata, handles)
- % hObject handle to transformation_smoothness (see GCBO)
- % eventdata reserved - to be defined in a future version of MATLAB
- % handles structure with handles and user data (see GUIDATA)
- % Hints: get(hObject,'String') returns contents of transformation_smoothness as text
- % str2double(get(hObject,'String')) returns contents of transformation_smoothness as a double
- transformation_smoothness=str2num(get(handles.transformation_smoothness,'string'));
- if transformation_smoothness>3 || transformation_smoothness<0.5
- errordlg('FOV smoothing parameter should be between 0.5-3')
- error('FOV smoothing parameter should be between 0.5-3')
- end
- % --- Executes during object creation, after setting all properties.
- function transformation_smoothness_CreateFcn(hObject, eventdata, handles)
- % hObject handle to transformation_smoothness (see GCBO)
- % eventdata reserved - to be defined in a future version of MATLAB
- % handles empty - handles not created until after all CreateFcns called
- % Hint: edit controls usually have a white background on Windows.
- % See ISPC and COMPUTER.
- if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
- set(hObject,'BackgroundColor','white');
- end
- % --- Executes on button press in translations.
- function translations_Callback(hObject, eventdata, handles)
- % hObject handle to translations (see GCBO)
- % eventdata reserved - to be defined in a future version of MATLAB
- % handles structure with handles and user data (see GUIDATA)
- % Hint: get(hObject,'Value') returns toggle state of translations
- if get(handles.translations,'Value')==1
- set(handles.maximal_rotation,'enable','off')
- set(handles.transformation_smoothness,'enable','off')
- end
- % --- Executes on button press in translations_rotations.
- function translations_rotations_Callback(hObject, eventdata, handles)
- % hObject handle to translations_rotations (see GCBO)
- % eventdata reserved - to be defined in a future version of MATLAB
- % handles structure with handles and user data (see GUIDATA)
- % Hint: get(hObject,'Value') returns toggle state of translations_rotations
- if get(handles.translations_rotations,'Value')==1
- set(handles.maximal_rotation,'enable','on')
- set(handles.transformation_smoothness,'enable','off')
- end
CellReg.m at commit 7066851, under GPL-2.0 · at the source
Overview
- Peking-Tsinghua Center for Life Sciences, PKU-IDG/McGovern Institute for Brain Research, Peking University, Beijing, China
- Peking University Sixth Hospital, Peking University Institute of Mental Health, NHC Key Laboratory of Mental Health (Peking University), National Clinical Research Center for Mental Disorders (Peking University Sixth Hospital), Beijing, China
- National Institute on Drug Dependence, Beijing Key Laboratory of Drug Dependence, Peking University, Beijing, China
- Department of Psychology, School of Humanities and Social Sciences, University of Science and Technology of China, Hefei, China
- Henan Academy of Innovation in Medical Science, Henan University, Kaifeng, China
- Institute of Brain Science and Brain-inspired Research, Shandong First Medical University and Shandong Academy of Medical Sciences, Jinan, China
- Department of Psychology and Program in Behavioral Neuroscience, Western Washington University, Bellingham, WA USA
- Behavioural and Clinical Neuroscience Institute, Department of Psychology, University of Cambridge, Cambridge, UK
- Institute of Science and Technology for Brain-Inspired Intelligence, MOE Frontiers Center for Brain Science, Fudan University, Shanghai, China
- Chinese Institute for Brain Research, Beijing, Beijing, China
Abstract
Drugs of abuse promote substance use disorder (SUD) by hijacking mesolimbic circuits that normally process natural rewards. Among these, social rewards exhibit therapeutic potential, but the underlying neural substrates remain unclear. Using a multimodal approach integrating in vivo single-neuron calcium imaging, optogenetic manipulation, and electrophysiology in male rats, we identified two distinct dopaminergic ensembles in the ventral tegmental area (VTA) that respectively encode social reward and drug seeking. Notably, these antagonistic ensembles exert reciprocal influence through competitive interactions that shape behavioral outcomes. Furthermore, circuit mapping revealed divergent connectivity patterns, with social reward-responsive dopaminergic ensembles receiving preferential input from the dorsal raphe nucleus (DRN). Activation of the DRN-VTA pathway recapitulates the protective effects of social reward against drug seeking. In this study, we uncovered a dynamic competition between functionally specialized dopaminergic ensembles through which social reward attenuates drug seeking, offering insights that may inform development of novel strategies for SUD treatment.
Reproduced under the paper's license (CC BY), from the paper cited above.
Repositories
Its files are read in the Code ↔ Paper reader above, with 1 match between paragraphs and lines of code.
zhoupc/CNMF_E
0f49eb08186c6aca2df0fd4873ec733d0810f1a2, 2 August 2024Availability: 1 check, the latest on 28 September 2026: the link answers
- 28 September 2026: the link answers
266 files
- GUI/
cnmfe.m , MATLAB, 33 lines - GUI/
cnmfe_main.m , MATLAB, 15 lines - GUI/
gui_callbacks/ , MATLAB, 10 linesedit_dir_callback.m - GUI/
gui_callbacks/ , MATLAB, 29 linesedit_file_callback.m - GUI/
gui_callbacks/ , MATLAB, 6 linesedit_gsig_callback.m - GUI/
gui_callbacks/ , MATLAB, 6 linesedit_gsiz_callback.m - GUI/
gui_callbacks/ , MATLAB, 25 linesgui_load_mat.m - GUI/
gui_callbacks/ , MATLAB, 19 linespush_corr_callback.m - GUI/
gui_callbacks/ , MATLAB, 11 linespush_dir_callback.m - GUI/
gui_callbacks/ , MATLAB, 39 linespush_file_callback.m - GUI/
gui_callbacks/ , MATLAB, 17 linespush_init_callback.m - GUI/
gui_callbacks/ , MATLAB, 22 linespush_load_callback.m - GUI/
gui_callbacks/ , MATLAB, 18 linesradio_dilate_callback.m - GUI/
gui_callbacks/ , MATLAB, 16 linesradio_ellipse_callback.m - GUI/
modules/ , MATLAB, 273 linescnmfe_background.m - GUI/
modules/ , MATLAB, 231 linescnmfe_data.m - GUI/
modules/ , MATLAB, 224 linescnmfe_init.m - GUI/
modules/ , MATLAB, 240 linescnmfe_load.m - GUI/
modules/ , MATLAB, 185 linescnmfe_neuron.m - OASIS_matlab/
deconvolveCa.m , MATLAB, 355 lines - OASIS_matlab/
examples/ , MATLAB, 36 linesPaper/ fig1.m - OASIS_matlab/
examples/ , MATLAB, 17 linesPaper/ fig2.m - OASIS_matlab/
examples/ , MATLAB, 144 linesPaper/ fig3.m - OASIS_matlab/
examples/ , MATLAB, 150 linesPaper/ fig4.m - OASIS_matlab/
examples/ , MATLAB, 191 linesPaper/ fig5.m - OASIS_matlab/
examples/ , MATLAB, 7 linesPaper/ fig6.m - OASIS_matlab/
examples/ , MATLAB, 65 linesPaper/ scripts/ compute_rss_g.m - OASIS_matlab/
examples/ , MATLAB, 222 linesPaper/ scripts/ fig2_demo_deconvolveAR1. m - OASIS_matlab/
examples/ , MATLAB, 16 linesPaper/ scripts/ fig4_plot_trace.m - OASIS_matlab/
examples/ , MATLAB, 29 linesPaper/ scripts/ show_results.m - OASIS_matlab/
examples/ , MATLAB, 8 linesPaper/ test_all.m - OASIS_matlab/
examples/ , MATLAB, 74 linesar1_constrained_foopsi.m - OASIS_matlab/
examples/ , MATLAB, 47 linesar1_foopsi.m - OASIS_matlab/
examples/ , MATLAB, 27 linesar1_mcmc.m - OASIS_matlab/
examples/ , MATLAB, 38 linesar1_thresholded_foopsi.m - OASIS_matlab/
examples/ , MATLAB, 36 linesar2_foopsi.m - OASIS_matlab/
examples/ , MATLAB, 26 linesar2_mcmc.m - OASIS_matlab/
examples/ , MATLAB, 54 linesar2_thresholded_foopsi.m - OASIS_matlab/
examples/ , MATLAB, 157 linesfoopsi_kernel.m - OASIS_matlab/
examples/ , MATLAB, 190 linesfoopsi_onnls.m - OASIS_matlab/
examples/ , MATLAB, 63 lineskernel_foopsi.m - OASIS_matlab/
examples/ , MATLAB, 39 lineskernel_thresholded_foops i.m - OASIS_matlab/
examples/ , MATLAB, 39 linesshow_results.m - OASIS_matlab/
examples/ , MATLAB, 85 linestest_all.m - OASIS_matlab/
functions/ , MATLAB, 50 linesGetSn.m - OASIS_matlab/
functions/ , MATLAB, 13 linesar2exp.m - OASIS_matlab/
functions/ , MATLAB, 42 lineschoose_smin.m - OASIS_matlab/
functions/ , MATLAB, 58 linesconstrained_foopsi_cvx.m - OASIS_matlab/
functions/ , MATLAB, 35 linesestimate_baseline_noise. m - OASIS_matlab/
functions/ , MATLAB, 44 linesestimate_parameters.m - OASIS_matlab/
functions/ , MATLAB, 67 linesestimate_time_constant.m - OASIS_matlab/
functions/ , MATLAB, 8 linesexp2ar.m - OASIS_matlab/
functions/ , MATLAB, 17 linesexp2kernel.m - OASIS_matlab/
functions/ , MATLAB, 83 linesfit_gauss1.m - OASIS_matlab/
functions/ , MATLAB, 59 linesfoopsi.m - OASIS_matlab/
functions/ , MATLAB, 62 linesgen_data.m - OASIS_matlab/
functions/ , MATLAB, 63 linesgen_sinusoidal_data.m - OASIS_matlab/
functions/ , MATLAB, 17 linesinit_fig.m - OASIS_matlab/
functions/ , MATLAB, 28 linesmax_ht.m - OASIS_matlab/
oasis_setup.m , MATLAB, 36 lines - OASIS_matlab/
packages/ , MATLAB, 420 linesMCMC/ cont_ca_sampler.m - OASIS_matlab/
packages/ , MATLAB, 143 linesMCMC/ plot_continuous_samples. m - OASIS_matlab/
packages/ , MATLAB, 64 linesMCMC/ sampling_demo_ar2.m - OASIS_matlab/
packages/ , MATLAB, 229 linesMCMC/ utilities/ HMC_exact2.m - OASIS_matlab/
packages/ , MATLAB, 65 linesMCMC/ utilities/ addSpike.m - OASIS_matlab/
packages/ , MATLAB, 51 linesMCMC/ utilities/ get_initial_sample.m - OASIS_matlab/
packages/ , MATLAB, 159 linesMCMC/ utilities/ get_next_spikes.m - OASIS_matlab/
packages/ , MATLAB, 8 linesMCMC/ utilities/ lambda_rate.m - OASIS_matlab/
packages/ , MATLAB, 23 linesMCMC/ utilities/ make_G_matrix.m - OASIS_matlab/
packages/ , MATLAB, 58 linesMCMC/ utilities/ make_mean_sample.m - OASIS_matlab/
packages/ , MATLAB, 58 linesMCMC/ utilities/ plot_marginals.m - OASIS_matlab/
packages/ , MATLAB, 63 linesMCMC/ utilities/ removeSpike.m - OASIS_matlab/
packages/ , MATLAB, 73 linesMCMC/ utilities/ replaceSpike.m - OASIS_matlab/
packages/ , MATLAB, 24 linesMCMC/ utilities/ samples_cell2mat.m - OASIS_matlab/
packages/ , MATLAB, 15 linesMCMC/ utilities/ tau_c2d.m - OASIS_matlab/
packages/ , MATLAB, 15 linesMCMC/ utilities/ tau_d2c.m - OASIS_matlab/
packages/ , MATLAB, 13 linesMCMC/ wrapper.m - OASIS_matlab/
packages/ , MATLAB, 135 linesconstrained-foopsi/ MCEM_foopsi.m - OASIS_matlab/
packages/ , MATLAB, 299 linesconstrained-foopsi/ constrained_foopsi.m - OASIS_matlab/
packages/ , MATLAB, 46 linesconstrained-foopsi/ cvx_foopsi.m - OASIS_matlab/
packages/ , MATLAB, 286 linesconstrained-foopsi/ lars_regression_noise.m - OASIS_matlab/
packages/ , MATLAB, 41 linesoasis/ choose_lambda.m - OASIS_matlab/
packages/ , MATLAB, 261 linesoasis/ constrained_oasisAR1.m - OASIS_matlab/
packages/ , MATLAB, 252 linesoasis/ constrained_oasisAR2.m - OASIS_matlab/
packages/ , MATLAB, 83 linesoasis/ create_kernel.m - OASIS_matlab/
packages/ , MATLAB, 356 linesoasis/ deconvCa.m - OASIS_matlab/
packages/ , MATLAB, 42 linesoasis/ dsKernel.m - OASIS_matlab/
packages/ , MATLAB, 180 linesoasis/ foopsi_oasisAR1.m - OASIS_matlab/
packages/ , MATLAB, 191 linesoasis/ foopsi_oasisAR2.m - OASIS_matlab/
packages/ , MATLAB, 109 linesoasis/ oasisAR1.m - OASIS_matlab/
packages/ , MATLAB, 156 linesoasis/ oasisAR2.m - OASIS_matlab/
packages/ , MATLAB, 214 linesoasis/ onnls.m - OASIS_matlab/
packages/ , MATLAB, 34 linesoasis/ test_oasis.m - OASIS_matlab/
packages/ , MATLAB, 220 linesoasis/ thresholded_nnls.m - OASIS_matlab/
packages/ , MATLAB, 277 linesoasis/ thresholded_oasisAR1.m - OASIS_matlab/
packages/ , MATLAB, 322 linesoasis/ thresholded_oasisAR2.m - OASIS_matlab/
packages/ , MATLAB, 83 linesoasis/ update_g.m - OASIS_matlab/
packages/ , MATLAB, 131 linesoasis/ update_kernel_exp2.m - OASIS_matlab/
packages/ , MATLAB, 78 linesoasis/ update_lam.m - OASIS_matlab/
packages/ , MATLAB, 144 linesoasis/ update_tau.m - OASIS_matlab/
packages/ , MATLAB, 42 linesoasis_kernel/ choose_smin.m - OASIS_matlab/
packages/ , MATLAB, 83 linesoasis_kernel/ create_kernel.m - OASIS_matlab/
packages/ , MATLAB, 358 linesoasis_kernel/ deconvCa.m - OASIS_matlab/
packages/ , MATLAB, 42 linesoasis_kernel/ dsKernel.m - OASIS_matlab/
packages/ , MATLAB, 34 linesoasis_kernel/ test_oasis.m - OASIS_matlab/
packages/ , MATLAB, 130 linesoasis_kernel/ update_kernel_exp2.m - ca_source_extraction/
@Sources2D/ , MATLAB, 115 linesMergeNeighbors.m - ca_source_extraction/
@Sources2D/ , MATLAB, 2,177 linesSources2D.m - ca_source_extraction/
@Sources2D/ , MATLAB, 128 linescorrelation_pnr_parallel .m - ca_source_extraction/
@Sources2D/ , MATLAB, 106 linesdeconvTemporal.m - ca_source_extraction/
@Sources2D/ , MATLAB, 65 linesdecorrTemporal.m - ca_source_extraction/
@Sources2D/ , MATLAB, 163 linesdisplayNeurons.m - ca_source_extraction/
@Sources2D/ , MATLAB, 29 linesdownSample.m - ca_source_extraction/
@Sources2D/ , MATLAB, 292 linesinitComponents_2p.m - ca_source_extraction/
@Sources2D/ , MATLAB, 113 linesinitComponents_batch.m - ca_source_extraction/
@Sources2D/ , MATLAB, 200 linesinitComponents_corr.m - ca_source_extraction/
@Sources2D/ , MATLAB, 204 linesinitComponents_endoscope .m - ca_source_extraction/
@Sources2D/ , MATLAB, 499 linesinitComponents_parallel. m - ca_source_extraction/
@Sources2D/ , MATLAB, 432 linesinitComponents_residual_ parallel.m - ca_source_extraction/
@Sources2D/ , MATLAB, 303 linesinitTemporal.m - ca_source_extraction/
@Sources2D/ , MATLAB, 215 linesmanual_merge_multi_pairs .m - ca_source_extraction/
@Sources2D/ , MATLAB, 240 linesmerge_close_neighbors.m - ca_source_extraction/
@Sources2D/ , MATLAB, 239 linesmerge_high_corr.m - ca_source_extraction/
@Sources2D/ , MATLAB, 246 linesmerge_neurons_dist_corr. m - ca_source_extraction/
@Sources2D/ , MATLAB, 34 linespost_process_spatial.m - ca_source_extraction/
@Sources2D/ , MATLAB, 127 linesquickMerge.m - ca_source_extraction/
@Sources2D/ , MATLAB, 183 linesset_parameters.m - ca_source_extraction/
@Sources2D/ , MATLAB, 171 linesshow_demixed_video.m - ca_source_extraction/
@Sources2D/ , MATLAB, 41 linesupSample.m - ca_source_extraction/
@Sources2D/ , MATLAB, 114 linesupdateBG.m - ca_source_extraction/
@Sources2D/ , MATLAB, 65 linesupdateSpatial_endoscope. m - ca_source_extraction/
@Sources2D/ , MATLAB, 95 linesupdateTemporal_endoscope .m - ca_source_extraction/
@Sources2D/ , MATLAB, 24 linesupdate_background_batch. m - ca_source_extraction/
@Sources2D/ , MATLAB, 334 linesupdate_background_parall el.m - ca_source_extraction/
@Sources2D/ , MATLAB, 45 linesupdate_spatial_batch.m - ca_source_extraction/
@Sources2D/ , MATLAB, 366 linesupdate_spatial_parallel. m - ca_source_extraction/
@Sources2D/ , MATLAB, 33 linesupdate_temporal_batch.m - ca_source_extraction/
@Sources2D/ , MATLAB, 355 linesupdate_temporal_parallel .m - ca_source_extraction/
@Sources2D/ , MATLAB, 208 linesviewNeurons.m - ca_source_extraction/
CNMFSetParms.m , MATLAB, 315 lines - ca_source_extraction/
compress_weights.m , MATLAB, 25 lines - ca_source_extraction/
constrained_foopsi.m , MATLAB, 298 lines - ca_source_extraction/
demo_memmap.m , MATLAB, 55 lines - ca_source_extraction/
demo_script.m , MATLAB, 108 lines - ca_source_extraction/
demo_script_class.m , MATLAB, 105 lines - ca_source_extraction/
endoscope/ , MATLAB, 32 linesGetSn_hist.m - ca_source_extraction/
endoscope/ , MATLAB, 44 linesHALS_spatial_threshold.m - ca_source_extraction/
endoscope/ , MATLAB, 187 linesbsplineM.m - ca_source_extraction/
endoscope/ , MATLAB, 55 linescircular_constraints.m - ca_source_extraction/
endoscope/ , MATLAB, 19 linesconnectivity_constraint. m - ca_source_extraction/
endoscope/ , MATLAB, 97 linescorrelation_image_endosc ope.m - ca_source_extraction/
endoscope/ , MATLAB, 89 linesdeconv_temporal.m - ca_source_extraction/
endoscope/ , MATLAB, 42 linesdetrend_data.m - ca_source_extraction/
endoscope/ , MATLAB, 208 linesdistribute_data.m - ca_source_extraction/
endoscope/ , MATLAB, 43 linesdsData.m - ca_source_extraction/
endoscope/ , MATLAB, 107 linesextract_ac.m - ca_source_extraction/
endoscope/ , MATLAB, 98 linesextract_ac_2p.m - ca_source_extraction/
endoscope/ , MATLAB, 23 linesfit_nmf_model.m - ca_source_extraction/
endoscope/ , MATLAB, 129 linesfit_ring_model.m - ca_source_extraction/
endoscope/ , MATLAB, 42 linesfit_svd_model.m - ca_source_extraction/
endoscope/ , MATLAB, 78 linesget_data_dimension.m - ca_source_extraction/
endoscope/ , MATLAB, 3 linesget_date.m - ca_source_extraction/
endoscope/ , MATLAB, 12 linesget_fullname.m - ca_source_extraction/
endoscope/ , MATLAB, 3 linesget_minute.m - ca_source_extraction/
endoscope/ , MATLAB, 25 linesget_nhood.m - ca_source_extraction/
endoscope/ , MATLAB, 144 linesget_patch_data.m - ca_source_extraction/
endoscope/ , MATLAB, 498 linesgreedyROI_endoscope.m - ca_source_extraction/
endoscope/ , MATLAB, 107 lineslle.m - ca_source_extraction/
endoscope/ , MATLAB, 152 lineslocal_background.m - ca_source_extraction/
endoscope/ , MATLAB, 110 linesnnls_spatial.m - ca_source_extraction/
endoscope/ , MATLAB, 107 linesnnls_spatial_thresh.m - ca_source_extraction/
endoscope/ , MATLAB, 45 linespair_neurons.m - ca_source_extraction/
endoscope/ , MATLAB, 10 linesremove_baseline.m - ca_source_extraction/
endoscope/ , MATLAB, 5 linessavegcf.m - ca_source_extraction/
endoscope/ , MATLAB, 54 linesspatial_constraints.m - ca_source_extraction/
endoscope/ , MATLAB, 48 linesstring2hash.m - ca_source_extraction/
endoscope/ , MATLAB, 13 linesstruct2neuron.m - ca_source_extraction/
endoscope/ , MATLAB, 40 linessvdsecon.m - ca_source_extraction/
endoscope/ , MATLAB, 52 linestif2mat.m - ca_source_extraction/
endoscope/ , MATLAB, 134 linesupdate_spatial_component s_nb.m - ca_source_extraction/
endoscope/ , MATLAB, 378 linesupdate_temporal_componen ts_nb.m - ca_source_extraction/
endoscope/ , MATLAB, 6 lineswriteTiff.m - ca_source_extraction/
initialize_components.m , MATLAB, 129 lines - ca_source_extraction/
merge_components.m , MATLAB, 159 lines - ca_source_extraction/
preprocess_data.m , MATLAB, 148 lines - ca_source_extraction/
run_CNMF_patches.m , MATLAB, 246 lines - ca_source_extraction/
update_spatial_component , MATLAB, 144 liness.m - ca_source_extraction/
update_temporal_componen , MATLAB, 389 linests.m - ca_source_extraction/
update_temporal_parallel , MATLAB, 1 line.m - ca_source_extraction/
utilities/ , MATLAB, 57 linesHALS.m - ca_source_extraction/
utilities/ , MATLAB, 61 linesHALS_2d.m - ca_source_extraction/
utilities/ , MATLAB, 45 linesHALS_spatial.m - ca_source_extraction/
utilities/ , MATLAB, 54 linesHALS_spatial_thresh.m - ca_source_extraction/
utilities/ , MATLAB, 119 linesHALS_temporal.m - ca_source_extraction/
utilities/ , MATLAB, 135 linesMCEM_foopsi.m - ca_source_extraction/
utilities/ , MATLAB, 155 linesbigread2.m - ca_source_extraction/
utilities/ , MATLAB, 36 linesclassify_components.m - ca_source_extraction/
utilities/ , MATLAB, 28 linescom.m - ca_source_extraction/
utilities/ , MATLAB, 77 linescorrelation_image.m - ca_source_extraction/
utilities/ , MATLAB, 46 linescvx_foopsi.m - ca_source_extraction/
utilities/ , MATLAB, 104 linesdetermine_search_locatio n.m - ca_source_extraction/
utilities/ , MATLAB, 44 linesdsData.m - ca_source_extraction/
utilities/ , MATLAB, 79 linesextract_DF_F.m - ca_source_extraction/
utilities/ , MATLAB, 24 linesfind_unsaturatedPixels.m - ca_source_extraction/
utilities/ , MATLAB, 83 linesget_noise_fft.m - ca_source_extraction/
utilities/ , C++, 116 linesgraph_conn_comp_mex.cpp - ca_source_extraction/
utilities/ , MATLAB, 27 linesgraph_connected_comp.m - ca_source_extraction/
utilities/ , MATLAB, 287 linesgreedyROI.m - ca_source_extraction/
utilities/ , MATLAB, 237 linesgreedyROI_corr.m - ca_source_extraction/
utilities/ , MATLAB, 28 linesinterp_missing_data.m - ca_source_extraction/
utilities/ , MATLAB, 174 lineskde.m - ca_source_extraction/
utilities/ , MATLAB, 67 lineskmeans_pp.m - ca_source_extraction/
utilities/ , MATLAB, 25 lineslagrangian_foopsi_tempor al.m - ca_source_extraction/
utilities/ , MATLAB, 286 lineslars_regression_noise.m - ca_source_extraction/
utilities/ , MATLAB, 151 lineslars_spatial.m - ca_source_extraction/
utilities/ , MATLAB, 13 linesmake_G_matrix.m - ca_source_extraction/
utilities/ , MATLAB, 181 linesmake_patch_video.m - ca_source_extraction/
utilities/ , MATLAB, 132 linesmanually_refine_componen ts.m - ca_source_extraction/
utilities/ , MATLAB, 65 linesmemmap/ construct_patches.m - ca_source_extraction/
utilities/ , MATLAB, 64 linesmemmap/ memmap_file.m - ca_source_extraction/
utilities/ , MATLAB, 39 linesmemmap/ memmap_file_sequence.m - ca_source_extraction/
utilities/ , MATLAB, 38 linesorder_ROIs.m - ca_source_extraction/
utilities/ , MATLAB, 59 linesorder_components.m - ca_source_extraction/
utilities/ , MATLAB, 54 linesplain_foopsi.m - ca_source_extraction/
utilities/ , MATLAB, 211 linesplot_components_GUI.m - ca_source_extraction/
utilities/ , MATLAB, 102 linesplot_contours.m - ca_source_extraction/
utilities/ , MATLAB, 120 linesrun_movie.m - ca_source_extraction/
utilities/ , MATLAB, 122 linesrunning_percentile.m - ca_source_extraction/
utilities/ , MATLAB, 453 linessmod_bigread2.m - ca_source_extraction/
utilities/ , MATLAB, 96 linessparse_NMF_initializatio n.m - ca_source_extraction/
utilities/ , MATLAB, 60 linesthreshold_components.m - ca_source_extraction/
utilities/ , MATLAB, 17 linestiff_reader.m - ca_source_extraction/
utilities/ , MATLAB, 30 linesupdate_order.m - ca_source_extraction/
utilities/ , MATLAB, 178 linesview_components.m - cnmfe_setup.m, MATLAB, 53 lines
- demos/
demo_batch_1p.m , MATLAB, 146 lines - demos/
demo_batch_2p.m , MATLAB, 135 lines - demos/
demo_endoscope.m , MATLAB, 230 lines - demos/
demo_large_data_1p.m , MATLAB, 250 lines - demos/
demo_large_data_2p.m , MATLAB, 205 lines - demos/
demo_sfn_2018.m , MATLAB, 252 lines - python_wrapper/
analyze_cnmfe_matlab.ipy , Jupyter, 104 linesnb - python_wrapper/
fix_mat_files.m , MATLAB, 20 lines - python_wrapper/
python_utils.py , Python, 205 lines - python_wrapper/
run_cnmfe_matlab.m , MATLAB, 249 lines - python_wrapper/
run_cnmfe_matlab.py , Python, 115 lines - scripts/
cnmfe_choose_data.m , MATLAB, 67 lines - scripts/
cnmfe_demix_video.m , MATLAB, 71 lines - scripts/
cnmfe_full.m , MATLAB, 49 lines - scripts/
cnmfe_load_data.m , MATLAB, 18 lines - scripts/
cnmfe_manual_merge.m , MATLAB, 60 lines - scripts/
cnmfe_manual_merge_cance , MATLAB, 9 linesl.m - scripts/
cnmfe_manual_merge_merge , MATLAB, 32 lines_neurons.m - scripts/
cnmfe_manual_merge_pick_ , MATLAB, 65 linesneuron.m - scripts/
cnmfe_manual_merge_remov , MATLAB, 51 linese_neuron.m - scripts/
cnmfe_merge_neighbors.m , MATLAB, 57 lines - scripts/
cnmfe_quick_merge.m , MATLAB, 55 lines - scripts/
cnmfe_save_video.m , MATLAB, 119 lines - scripts/
cnmfe_show_corr_pnr.m , MATLAB, 20 lines - scripts/
cnmfe_svd_BG.m , MATLAB, 7 lines - scripts/
cnmfe_unzip_results.m , MATLAB, 42 lines - scripts/
cnmfe_update_BG.m , MATLAB, 20 lines - scripts/
cnmfe_version.m , MATLAB, 18 lines - scripts/
cnmfe_zip_results.m , MATLAB, 16 lines - LICENSE.txt, License, 674 lines
- README.md, Text, 73 lines
zivlab/CellReg
70668513c665e1cb0de218c33264b8736f2976eb, 2 July 2026Availability: 1 check, the latest on 28 September 2026: the link answers
- 28 September 2026: the link answers
62 files
- CellReg/
adjust_FOV_size.m , MATLAB, 67 lines - CellReg/
align_images.m , MATLAB, 446 lines - CellReg/
check_if_in_overlapping_ , MATLAB, 23 linesFOV.m - CellReg/
choose_best_model.m , MATLAB, 48 lines - CellReg/
cluster_cells.m , MATLAB, 335 lines - CellReg/
compute_centroid_distanc , MATLAB, 76 lineses_model.m - CellReg/
compute_centroid_locatio , MATLAB, 75 linesns.m - CellReg/
compute_centroids_projec , MATLAB, 33 linestions.m - CellReg/
compute_data_distributio , MATLAB, 181 linesn.m - CellReg/
compute_footprints_proje , MATLAB, 33 linesctions.m - CellReg/
compute_p_same.m , MATLAB, 63 lines - CellReg/
compute_scores.m , MATLAB, 103 lines - CellReg/
compute_spatial_correlat , MATLAB, 137 linesions_model.m - CellReg/
demo.m , MATLAB, 307 lines - CellReg/
demo_2P.m , MATLAB, 422 lines - CellReg/
display_progress_bar.m , MATLAB, 70 lines - CellReg/
estimate_beta_mixture_pa , MATLAB, 36 linesrams.m - CellReg/
estimate_number_of_bins. , MATLAB, 38 linesm - CellReg/
estimate_registration_ac , MATLAB, 80 linescuracy.m - CellReg/
evaluate_data_quality.m , MATLAB, 80 lines - CellReg/
freezeColors.m , MATLAB, 268 lines - CellReg/
gaussfit.m , MATLAB, 100 lines - CellReg/
initial_registration_cen , MATLAB, 115 linestroid_distances.m - CellReg/
initial_registration_spa , MATLAB, 189 linestial_correlations.m - CellReg/
interpolate_pixel_value. , MATLAB, 40 linesm - CellReg/
load_multiple_sessions.m , MATLAB, 30 lines - CellReg/
load_single_session.m , MATLAB, 21 lines - CellReg/
normalize_spatial_footpr , MATLAB, 55 linesints.m - CellReg/
plot_RGB_overlay.m , MATLAB, 39 lines - CellReg/
plot_alignment_results.m , MATLAB, 357 lines - CellReg/
plot_all_registered_proj , MATLAB, 107 linesections.m - CellReg/
plot_all_sessions_projec , MATLAB, 41 linestions.m - CellReg/
plot_cell_scores.m , MATLAB, 194 lines - CellReg/
plot_estimated_registrat , MATLAB, 204 linesion_accuracy.m - CellReg/
plot_initial_registratio , MATLAB, 71 linesn.m - CellReg/
plot_models.m , MATLAB, 127 lines - CellReg/
plot_single_session_proj , MATLAB, 19 linesections.m - CellReg/
plot_x_y_displacements.m , MATLAB, 67 lines - CellReg/
rotate_cell.m , MATLAB, 42 lines - CellReg/
rotate_image_interp.m , MATLAB, 36 lines - CellReg/
rotate_spatial_footprint , MATLAB, 44 lines.m - CellReg/
save_log_file.m , MATLAB, 142 lines - CellReg/
transform_distance_to_si , MATLAB, 17 linesmilarity.m - CellReg/
translate_projections.m , MATLAB, 30 lines - CellReg/
translate_spatial_footpr , MATLAB, 39 linesint.m - CellReg_setup.m, MATLAB, 5 lines
- GUI/
CellReg.m , MATLAB, 2,236 lines, 1 match - GUI/
msgbox_timed.m , MATLAB, 16 lines - GUI/
plot_estimated_accuracy_ , MATLAB, 125 linesGUI.m - GUI/
plot_p_same_centroid_dis , MATLAB, 54 linestance_slider.m - GUI/
plot_p_same_spatial_corr , MATLAB, 54 lineselation_slider.m - GUI/
plot_x_y_displacements_G , MATLAB, 33 linesUI.m - GUI/
warndlg_timed.m , MATLAB, 16 lines - Helper/
format_conversion_Suite2 , MATLAB, 46 linesp_CNMF_e.m - Helper/
format_conversion_inscop , MATLAB, 29 linesix.m - Helper/
get_spatial_footprints.m , MATLAB, 62 lines - Helper/
load_footprint_data.m , MATLAB, 26 lines - Helper/
mat_to_sparse_cell.m , MATLAB, 8 lines - Helper/
s2pToCellReg.m , MATLAB, 51 lines - Helper/
s2pToCellRegSparseCell.m , MATLAB, 62 lines - LICENSE.txt, License, 339 lines
- README.md, Text, 55 lines
Zenodo 18279500
Availability: 1 check, the latest on 28 September 2026: the link answers (HTTP 200)
- 28 September 2026: the link answers (HTTP 200)
Code availability
Raw Ca²⁺ imaging data were processed using commercial software (Thinkerbiotech, Nanjing, China). The custom MATLAB scripts developed for this data processing are publicly available on Zenodo (10.5281/
Reproduced under the paper's license (CC BY), from the paper cited above.
Tracing map
Proposed by the machine: these links were found in the paper and verified at the source, without human review. The map will receive a Zenodo DOI once one of the paper's authors has validated it with their ORCID.
What the map holds:
- 3 repositories of the authors' code, each at its verified commit, with its license and how the link was found in the paper;
- 324 scripts, each with its path and the digest of its content;
- 1 match between paragraphs of the paper and lines of the code (method lexical-v1);
- neither the text of the paper nor the code itself.
Its JSON (tracing-map.json) is deposited on Zenodo with its DOI once the map is validated.
Data
Datasets cited
- figshare:29908157, at figshare; found in DataCite
Data availability
All the data generated in this study are provided in the article and the Supplementary Information. The relevant raw data are provided as a Source data file. Source data are provided with this paper.
Reproduced under the paper's license (CC BY), from the paper cited above.
Versions
The history of this record: each version stored by the harvester or made by a correction of its authors or of the maintainers of its code, and what changed in its facts. The texts of the paper (its abstract, its availability statements) are not part of it; versions that changed only those are not listed.
Version 1, 28 September 2026: the first record
Recorded: type, language, journal, volume, issue, pages, dates, 14 authors, 2 keywords, 14 MeSH terms, 1 funder, 65 references.
Cite
This paper
Zheng, W., Liu, X., Lu, T., Lv, X., Guan, X., Yu, Y., Li, X., Wang, Z., Yuan, K., Grimm, J. W., Robbins, T. W., Shi, J., Lu, L., & Xue, Y.-X. (2026). Social reward outcompetes drug seeking dopaminergic ensembles to prevent relapse. Nature communications, 17(1), 3462. https://
BibTeX
@article{zheng2026social
author = {Zheng, Wei and Liu, Xiaoxing and Lu, Tangsheng and Lv, Xinyou and Guan, Xuefang and Yu, Yifan and Li, Xue and Wang, Zhe and Yuan, Kai and Grimm, Jeffrey W and Robbins, Trevor W and Shi, Jie and Lu, Lin and Xue, Yan-Xue},
title = {{Social reward outcompetes drug seeking dopaminergic ensembles to prevent relapse}},
journal = {Nature communications},
year = {2026},
month = apr,
volume = {17},
number = {1},
pages = {3462},
publisher = {Nature Publishing Group},
issn = {2041-1723},
doi = {10.1038/
url = {https://
pmid = {41932919},
pmcid = {PMC13076667}
}
RIS
TY - JOUR
AU - Zheng, Wei
AU - Liu, Xiaoxing
AU - Lu, Tangsheng
AU - Lv, Xinyou
AU - Guan, Xuefang
AU - Yu, Yifan
AU - Li, Xue
AU - Wang, Zhe
AU - Yuan, Kai
AU - Grimm, Jeffrey W
AU - Robbins, Trevor W
AU - Shi, Jie
AU - Lu, Lin
AU - Xue, Yan-Xue
TI - Social reward outcompetes drug seeking dopaminergic ensembles to prevent relapse
T2 - Nature communications
J2 - Nat Commun
PY - 2026
DA - 2026/
VL - 17
IS - 1
SP - 3462
SN - 2041-1723
PB - Nature Publishing Group
DO - 10.1038/
UR - https://
LA - en
ER -
CSL-JSON
{
"id": "10.1038/
"type": "article-journal",
"title": "Social reward outcompetes drug seeking dopaminergic ensembles to prevent relapse",
"container-title": "Nature communications",
"author": [
{
"family": "Zheng",
"given": "Wei"
},
{
"family": "Liu",
"given": "Xiaoxing"
},
{
"family": "Lu",
"given": "Tangsheng"
},
{
"family": "Lv",
"given": "Xinyou"
},
{
"family": "Guan",
"given": "Xuefang"
},
{
"family": "Yu",
"given": "Yifan"
},
{
"family": "Li",
"given": "Xue"
},
{
"family": "Wang",
"given": "Zhe"
},
{
"family": "Yuan",
"given": "Kai"
},
{
"family": "Grimm",
"given": "Jeffrey W"
},
{
"family": "Robbins",
"given": "Trevor W"
},
{
"family": "Shi",
"given": "Jie"
},
{
"family": "Lu",
"given": "Lin"
},
{
"family": "Xue",
"given": "Yan-Xue"
}
],
"container-title-short":
"volume": "17",
"issue": "1",
"page": "3462",
"DOI": "10.1038/
"PMID": "41932919",
"PMCID": "PMC13076667",
"ISSN": "2041-1723",
"publisher": "Nature Publishing Group",
"URL": "https://
"language": "en",
"issued": {
"date-parts": [
[
2026,
4,
3
]
]
}
}
The tracing map gets a citation of its own once an author has validated it and it has a DOI.
Similar papers
The papers with a page that share the most with this one: the tools found in their code, their categories, datasets, cited references and authors, the rarest counting most.
- [1] doi:10.1038/s41467-026-73994-1 [code]
- Prediction error correlates in the striosome-dopamine circuit emerge from information gain.Journal: Nature communicationsIn common: Optimization Toolbox, Statistics and Machine Learning Toolbox, SciPy, 2 other tools, 6 references
- [2] doi:10.7554/elife.93664 [code]
- Drug-induced changes in connectivity to midbrain dopamine cells revealed by rabies monosynaptic tracing.Journal: eLifeIn common: SciPy, Matplotlib, NumPy, other condition, 7 references
- [3] doi:10.1016/j.isci.2026.117130 [code]
- Region-specific weighting of sensory intensity and reward prediction error by dopamine signals.Journal: iScienceIn common: SciPy, Matplotlib, NumPy, 7 references
- [4] doi:10.1038/s41467-026-75371-4 [code]
- Cerebellar neural populations orchestrate dopamine reward signaling with single-trial precision.Journal: Nature communicationsIn common: Signal Processing Toolbox, Statistics and Machine Learning Toolbox, SciPy, 2 other tools, systems, 5 references
- [5] doi:10.1523/jneurosci.2001-25.2026 [code]
- Dynamics of Dentate Gyrus Place Cells and Dentate Spikes during Spatial and Nonspatial Changes in Environments.Journal: The Journal of neuroscience : the official journal of the Society for NeuroscienceIn common: Optimization Toolbox, Image Processing Toolbox, Signal Processing Toolbox, 4 other tools, rat, systems
- [6] doi:10.1038/s41467-026-75490-y [code]
- Topographically organized dorsal raphe activity modulates forebrain sensory-motor representations and contributes to defensive behaviors.Journal: Nature communicationsIn common: Image Processing Toolbox, Signal Processing Toolbox, Statistics and Machine Learning Toolbox, 3 references
- [7] doi:10.1038/s41467-026-70519-8 [code]
- Dopamine and serotonin inversely modulate D2 medium spiny neurons to regulate cocaine reward.Journal: Nature communicationsIn common: other condition, 5 references
- [8] doi:10.1016/j.isci.2026.117375 [code]
- Motor priming is associated with widespread recruitment into neural ensembles and more rapid ensemble transitions.Journal: iScienceIn common: Optimization Toolbox, Image Processing Toolbox, Signal Processing Toolbox, 4 other tools, systems
- [9] doi:10.1038/s41467-026-75347-4 [code]
- Sleep reveals dynamics integrating and segregating movement and stimulus representations in V1.Journal: Nature communicationsIn common: Optimization Toolbox, Image Processing Toolbox, Signal Processing Toolbox, 4 other tools, systems
- [10] doi:10.1016/j.celrep.2026.117646 [code]
- Medial entorhinal-hippocampal desynchronization parallels the emergence of memory impairment in a mouse model of Alzheimer's disease pathology.Journal: Cell reportsIn common: Optimization Toolbox, Image Processing Toolbox, Signal Processing Toolbox, 4 other tools, systems
Contribute
The authors of this paper can claim it, correct its record and validate its tracing map, and the maintainers of its code (its owner, or a public member of its organization) correct what it says of their repository; anyone signed in can ask for its removal. Every request goes to OSCR's own machine, which answers it; your account page follows them.
Sign in with ORCID to claim this paper as one of its authors, correct its record or validate its tracing map: when the paper's metadata lists your ORCID iD, you are recognized at once. Maintainers of its code: sign in with GitHub, then claim the repository on your account page.
Claim this paper
Correct its record
Say what each link of this record is, remove the ones that are not the paper's, add the ones that are missing. The correction becomes a new version of the record, in its Versions section.
Validate its tracing map
You validate the map as this page shows it: 3 repositories of the authors' code, each at its verified commit and with its license, 324 scripts, and 1 match between paragraphs and code (see the Code and Map sections). It then receives a DOI on Zenodo, with you (your ORCID iD) and OSCR as its creators; the code itself is not deposited.
The map's fingerprint: sha256:ebab3a3c3a46338b…
Add the badge to its README
The badge links the code to this page. Copy one of these into the README of the paper's code: only you decide where it goes, and nothing is changed for you.
Markdown
[, paste the snippet at the top, then “Commit changes…” and, to review it first, “Create a new branch and start a pull request”. You open the pull request; OSCR asks for no permission.
Request its removal
To ask OSCR to remove this record, the copies of its authors' scripts or its tracing map, use the removal request page: signed in, you say who you are, what to remove and why, then review and confirm the request. Published rules decide every request (how).
Discussion, reproductions, activity
Discussion: questions and error reports about this paper and its code, from signed-in readers and its authors. It opens with sign-in.
Reproductions: reports from readers who ran the authors' code: what they reproduced, with which environment, commit and data. It opens with sign-in.
Activity: what happens around this paper: new versions of its record, its map's validation, discussions and reproductions. It opens with sign-in.
