File Exchange

image thumbnail


version (324 KB) by Eran Mukamel
Toolbox for automated sorting of cellular calcium signals from optical imaging data.


Updated 25 Aug 2016

GitHub view license on GitHub

This toolbox includes routines for using principal component analysis (PCA) and independent component analysis (ICA) to extract cellular signals from imaging data sets. A full description and validation of the method is provided in the paper, "Automated Analysis of Cellular Signals from Large-Scale Calcium Imaging Data," Neuron, 63:747 (2009):

Comments and Ratings (11)

Ok, the function call had a missing input, as I was calling it. It works if I use the statement as stated in the function script.

I'm trying to run CellSort using mu = 0.1 and receive the error message -

Error using CellsortICA (line 55)
Spatio-temporal parameter, mu, must be between 0 and 1.

Error in runCellSort (line 103)
[ica_sig, ica_filters, ica_A, numiter] =
CellsortICA(mixedsig, mixedfilters, PCuse, mu, nIC,
ica_A_guess, termtol, maxrounds);

Now, if I were to check if mu = 0.1; isempty(mu)||(mu>1)||(mu<0); I get -

ans =



However, the error message still occurs and the code breaks.
Is there something I'm doing wrong? Is there any sample code explaining how to specify "mu"?

Eran Mukamel

Dear Phanindra - You can find sample code that will illustrate the appropriate parameters here:

The processing time depends on the size of your data set. The majority of computation time is in the PCA dimensional reduction pre-processing; subsequent cell sorting is relatively fast.

I need to image segment a tiff calcium image data.I am unable to correctly specify the parameters smwidth and thresh? Can u please tell me what are the typical values? Also how much time does it take to run the whole code till segmentation?

What does movm and movtm mean?

Eran Mukamel

Hi Alex - The CellSortPCA function requires a TIFF image stack.

What file input is necessary for CellSortPCA to work?



The associated publication in Neuron 63, 747–760 makes this look promising. However, getting this to run based on the instructions provided in the supplementary publication is very trying for those with less than a mastery of Matlab.

Rob Campbell

These functions are well presented and a lot of care has gone into the code. Well worth a look. However, I have had trouble getting this to work reliably with my data since it has tendency to identify noise as the signal.


June 2016: Fixed an inconsistency in CellsortPCA between create_tcov and
creat_xcov. In the current version, both methods agree with the previous
version of create_tcov.

Fixed a bug affecting performance in recent versions of MATLAB.

Fixed a minor typo in documentation for CellsortICA - EAM 11/24/09

MATLAB Release Compatibility
Created with R2008b
Compatible with any release
Platform Compatibility
Windows macOS Linux