zivlab / CellReg

Registration of cells across sessions.
GNU General Public License v2.0
70 stars 33 forks source link

CELLReg Schnitzer Lab test results/issues #1

Closed bahanonu closed 7 years ago

bahanonu commented 7 years ago

@Sheintuch I'll put my testing results and any issues I run into here.

bahanonu commented 7 years ago

A quick example of the GUI situation I was talking about in the email below. I'm running CellReg through the sample data and then through some real data today, I'll get back with impressions/results soon.

With my default settings

image

Resetting Matlab figure defaults

I have the following default settings for the figures, maybe you could have your own defaults that are auto-loaded to prevent the GUI from breaking?

display('setting graphics defaults...')
defaultFontStr = 'Futura Std Book';
defaultUIFontStr = 'Arial';
set(0, 'DefaultFigureColor', 'White',...
    'defaulttextinterpreter','tex',...
'DefaultFigurePaperType', 'a4letter', ...
'DefaultFigureWindowStyle','docked',...
'DefaultAxesColor', 'white', ...
'DefaultAxesDrawmode', 'fast', ...
'DefaultAxesFontUnits', 'points', ...
'DefaultAxesFontSize', 13, ...
'DefaultAxesFontAngle', 'Normal', ...
'DefaultAxesFontName', defaultFontStr, ...
'DefaultAxesGridLineStyle', ':', ...
'DefaultAxesInterruptible', 'on', ...
'DefaultAxesLayer', 'Bottom', ...
'DefaultAxesLineWidth', 2, ...
'DefaultAxesNextPlot', 'replace', ...
'DefaultAxesUnits', 'normalized', ...
'DefaultAxesXcolor', [0, 0, 0], ...
'DefaultAxesYcolor', [0, 0, 0], ...
'DefaultAxesZcolor', [0, 0, 0], ...
'DefaultAxesVisible', 'on', ...
'DefaultLineColor', 'Red', ...
'DefaultLineLineStyle', '-', ...
'DefaultLineLineWidth', 0.5, ...
'DefaultLineMarker', 'none', ...
'DefaultLineMarkerSize', 8, ...
'DefaultTextColor', [0, 0, 0], ...
'DefaultTextFontUnits', 'Points', ...
'DefaultTextFontSize', 13, ...
'DefaultTextFontName', defaultFontStr, ...
'DefaultUIControlFontName', defaultUIFontStr, ...
'DefaultUIControlFontSize', 16, ...
'DefaultTextVerticalAlignment', 'middle', ...
'DefaultTextHorizontalAlignment', 'left',...
'DefaultPatchFaceColor',[0 0 0],...
'DefaultPatchEdgeColor','w',...
'DefaultAxesTickDir','out',...
'DefaultAxesTickDirMode', 'manual',...
'defaultAxesBox','off'...
);

iptsetpref('ImshowInitialMagnification', 'fit')
bahanonu commented 7 years ago

See below for figure outputs from running data in SampleData on my end. I didn't run into any errors. Using Matlab 2015b.

Could you include a MAT-file (e.g. cellRegistered_Final_<date>_<time>.mat) or figures in the repository with the results run on your computer so future users have both the input data and the output to make sure everything ran normally?

image

image

image

image

image

image

image

image

image

image

image

bahanonu commented 7 years ago

When I attempt to load events on my own data, I am getting the below error. image

The sizes for the images and event matrices are verified at 305x325x225 double and 305x17997 logical respectively, so they should follow the format requested. Do you want a specific variable name for the Events_.*.mat files? If I ignore the option to load events, the spatial filters load fine, e.g. see below.

image

bahanonu commented 7 years ago

Seems after running CellReg on my data, that in transformed_data_struct.mat, the events have been loaded fine despite the error message at the beginning. Do you know why this would be the case? Also, I noticed that even though CellReg seems to have loaded the events there doesn't seem to be an indication that has occured in the GUI.

image

bahanonu commented 7 years ago

See below for how well the registration went for 7 imaging sessions from a dorsal striatum miniscope animal. I have also included registration from my algorithm so you can get a visual comparison.

Original, no correction

2017_05_02_p545_m121_p215_raw

CellReg corrected

2017_05_02_p545_m121_p215_corrected

My registration algorithm for comparison

I use color as an indication here of the cell's global ID, so same color = same cell under the quick iteration parameters used in the below run. 2017_05_02_p545_m121_p215_corrected_biafraalgorithm2

bahanonu commented 7 years ago

CellReg outputs

image

image

image

image

image

image

image

image

image

image

image

Sheintuch commented 7 years ago

@bahanonu We thought to set the figure default values before opening the GUI. However, since there are many different properties, that different users can change for themselves, we are not sure whether to set them all and whether it should be done by us at all. We're actually not sure if there's a canonical way to perform this. Are you familiar with one? When you set your default values they are reset when you exit Matlab, right?

bahanonu commented 7 years ago

@Sheintuch I have my figure defaults loaded as part of a startup.m script (https://www.mathworks.com/help/matlab/ref/startup.html), so they are always automatically set in my case each time I load Matlab (else they are reset as you noted).

I think the canonical way is to use set(0,'DefaultFigureProperty') as I noted in https://github.com/zivlab/CellReg/issues/1#issuecomment-298764578. You could then have a function with the figure defaults (users can also then easily change these if desired by modifying that m-file) called when the user loaders the GUI-based version of the code. I think having a basic default would be good, then users can edit if they notice problems on their end (or if all the GUI elements are relative/resizable instead of fixed size, might be less of an issue).

Sheintuch commented 7 years ago

We are actually still unsure about the proper way to solve this. The values you chose to change in your startup.m file are only a subset of the available values, correct? When we execute set(0,'DefaultFigureProperty') we should change the word 'Property' to each of the properties you changed? If these are some subset of all available properties how do we set all parameters to their default values?

bahanonu commented 7 years ago

Yep, they are only the ones I've found I needed to change so far. Use the same way I did it in that other comment, so FigureProperty is the part that needs to be replaced with appropriate figure, line, axes, etc. properties. See https://www.mathworks.com/help/matlab/creating_plots/default-property-values.html

Since 0 is the default figure, if you do reset(0) that returns all properties to their default state. See https://www.mathworks.com/help/matlab/ref/reset.html

Sheintuch commented 7 years ago

Thanks for the suggestion. This solved the problem. We released a new version (v1.1.0) and we would be glad if you can test it and verify that the issue has been solved.

bahanonu commented 7 years ago

Great to hear that worked out. I'll test out the code this week and get back with similar feedback as before, let me know if there's anything specific you'd like me to focus on when testing.