Skip to content

Commit

Permalink
resolving merge issues
Browse files Browse the repository at this point in the history
  • Loading branch information
Alice committed Feb 20, 2022
2 parents 29c69c7 + c05590b commit 8e290eb
Show file tree
Hide file tree
Showing 8 changed files with 86 additions and 35 deletions.
13 changes: 6 additions & 7 deletions CellReg/demo.m
Original file line number Diff line number Diff line change
Expand Up @@ -29,12 +29,11 @@

%% Setting paths for the cell registration procedure:

% we need to find the path up-two levels
[fileroot,~,~] = fileparts(mfilename('fullpath'));
[fileroot,~,~] = fileparts(fileroot);
% Defining the data directory:
data_path='D:\dev\Cell registration\CellReg';

% Defining the results_directory and creating the figures_directory:
results_directory= fullfile(fileroot,'SampleData', 'Results') ;
results_directory=fullfile(data_path,'SampleData','Results') ;

figures_directory=fullfile(results_directory,'Figures');
if exist(figures_directory,'dir')~=7
Expand All @@ -43,11 +42,11 @@

figures_visibility='on'; % either 'on' or 'off' (in any case figures are saved)

% define path of sample data
% define file names of sample data:
number_of_sessions=5;
file_names=cell(1,number_of_sessions);
for it = 1:number_of_sessions
file_names{it} = fullfile(fileroot, 'SampleData',sprintf('spatial_footprints_0%1i.mat',it));
for file_index=1:number_of_sessions
file_names{file_index}=fullfile(data_path,'SampleData',sprintf('spatial_footprints_0%1i.mat',file_index));
end

%% Stage 1 - Loading the spatial footprints of cellular activity:
Expand Down
1 change: 1 addition & 0 deletions CellReg_setup.m
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
CellReg_directory=fileparts(which('CellReg_setup.m'));
addpath(genpath(fullfile(CellReg_directory,'CellReg')));
addpath(genpath(fullfile(CellReg_directory,'GUI')));
addpath(genpath(fullfile(CellReg_directory,'Helper')));
savepath();
Binary file modified GUI/CellReg_Logo.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
46 changes: 46 additions & 0 deletions Helper/format_conversion_Suite2p_CNMF_e.m
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
%% Converting the outputs from CNMF-e or Suite2p to the required input format for CellReg

input_format='Suite2p'; % could be either 'CNMF-e' or 'Suite2p'

%% Choosing the files for conversion:
[file_names,files_path]=uigetfile('*.mat','MultiSelect','on',...
'Choose the spatial footprints from all the sessions: ' );

if iscell(file_names)
number_of_sessions=size(file_names,2);
else
number_of_sessions=1;
end
for n=1:number_of_sessions
if iscell(file_names)
this_session_data=load([files_path file_names{n}]);
else
this_session_data=load([files_path file_names]);
end
if strcmp(input_format,'Suite2p')
this_session_x_size=this_session_data.ops.Lx+1;
this_session_y_size=this_session_data.ops.Ly+1;
this_session_num_cells=size(this_session_data.stat,2);
this_session_converted_footprints=zeros(this_session_num_cells,this_session_y_size,this_session_x_size);
for k=1:this_session_num_cells
for l=1:length(this_session_data.stat{k}.ypix)
this_session_converted_footprints(k,this_session_data.stat{k}.ypix(l)+1,this_session_data.stat{k}.xpix(l)+1)=this_session_data.stat{k}.lam(l);
end
end

elseif strcmp(input_format','CNMF-e')
this_session_y_size=this_session_data.neuron.options.d1;
this_session_x_size=this_session_data.neuron.options.d2;
this_session_num_cells=size(this_session_data.neuron.A,2);
this_session_converted_footprints=zeros(this_session_num_cells,this_session_y_size,this_session_x_size);
for k=1:this_session_num_cells
this_session_converted_footprints(k,:,:)=reshape(this_session_data.neuron.A(:,k),this_session_y_size,this_session_x_size);
end
end
if iscell(file_names)
save([files_path 'converted_' file_names{n}],'this_session_converted_footprints','-v7.3')
else
save([files_path 'converted_' file_names],'this_session_converted_footprints','-v7.3')
end
end

29 changes: 29 additions & 0 deletions Helper/format_conversion_inscopix.m
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
%% Converting the Inscopix .tif cell spatial footprints to input format for CellReg

[files_path]=uigetdir('Choose the location of the footprints from one session: ' );
file_names = dir(fullfile(files_path, '**', '*_CNMFe_CellSet_C*'));
%
this_session_num_cells = length(file_names);

% get size of footprints first
fname = file_names(1);
fname = fullfile(fname.folder, fname.name);
footprint = read(Tiff(fname,'r'));
[~,folder_name] = fileparts(files_path);
%
this_session_converted_footprints=zeros(this_session_num_cells,size(footprint, 1), size(footprint, 2));

%
for n=1:this_session_num_cells

fname = file_names(n);
fname = fullfile(fname.folder, fname.name);

%
footprint = read(Tiff(fname,'r'));
this_session_converted_footprints(n,:,:)= footprint;

end
fname_out = fullfile(file_names(1).folder, [folder_name, '_converted.mat']);
save(fname_out,'this_session_converted_footprints','-v7.3')

26 changes: 0 additions & 26 deletions Helper/remove_bad_aligned_datasets.m

This file was deleted.

2 changes: 2 additions & 0 deletions Helper/s2pToCellReg.m
Original file line number Diff line number Diff line change
Expand Up @@ -47,3 +47,5 @@


end


4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,12 @@ in Ca2+ imaging data. The package includes a GUI that supports the entire regist
For more information contact [email protected] or join our [slack channel](https://cellreg.slack.com).

## Setting up the repository
We encourage the use of official versions (e.g., v1.4.5) for easier debugging processes. Switch to the releases tab on GitHub and checkout the latest version.
We encourage the use of official versions (e.g., v1.4.9) for easier debugging processes. Switch to the releases tab on GitHub and checkout the latest version.

1. Cloning:
`git clone https://github.com/zivlab/CellReg.git`
2. Checkout version:
`git checkout v<major>.<minor>.<bugfix> (e.g., v1.4.5)`
`git checkout v<major>.<minor>.<bugfix> (e.g., v1.4.9)`
3. Run `setup.m`

## Usage and documentation
Expand Down

0 comments on commit 8e290eb

Please sign in to comment.