Skip to content

Understand CNMF E results

Pengcheng Zhou edited this page Sep 26, 2017 · 2 revisions

CNMF-E stores all results in the class object neuron.

An example

Her is a typical form of final results

>> neuron

neuron = 

  Sources2D with properties:

              A: [16384x169 double]
              C: [169x1000 double]
          C_raw: [169x1000 double]
              S: [169x1000 double]
         kernel: [1x1 struct]
              b: {2x2 cell}
              f: {2x2 cell}
              W: {2x2 cell}
             b0: {2x2 cell}
        options: [1x1 struct]
              P: [1x1 struct]
             Fs: 6
           file: '/Users/zhoupc/Dropbox/github/CNMF_E/demos/data_endoscope.tif'
    frame_range: [1 1000]
            ids: [1x169 double]
           tags: [169x1 uint16]
             Cn: [128x128 double]
            PNR: []
           Coor: {169x1 cell}
             Df: []
           C_df: []
           S_df: []

In this pase, I will provide a detailed explanation to most fileds of neuron

The most important variables: A & C

Neuron shapes and neuron activities are the two main things we need for further analysis. You can get them from neuron.A and neuron.C.

neuron.A is a 2D matrix with the dimension (# pixels X # neurons), and neuron.C is also a 2D matrix with the dimension (# neurons X # frames). Here the pixel number is 16384 (128 X 128) and the frame number is 1000. We extracted 169 components and expect them to be real individual neurons. For the i-th neuron, neuron.A(:, i) is its spatial shape and neuron.C(i, :) is its temporal traces. You can visualize the neuron shape using the command

neuron.image(neuron.A(:, i); 

or you can view both the spatial and temporal components using the command

neuron.viewNeurons(i); 

or you can view all of them

neuron.viewNeurons([]); 

Usually, we want to represent each neuron's shape as a 2D matrix, instead of a single column vector. To get a 2D representation of a neuron shape, we can use following command:

ai = neuron.reshape(neuron.A(:, i), 2)

or you can convert the 2D matrix neuron.A into a 3D matrix A and A(:, :, i) represents the spatial shape of the i-th neuron:

A = neuron.reshape(neuron.A, 2); 

Two important intermediate results: C_raw and S

For most people, having A & C are enough for their downstream analysis. However, the better understand the quality of your extracted traces, neuron.C_raw is a good way of visualizing the noise level. When downstream analysis is about the rising time of calcium transients or spiking activity, neuron.S is a good thing to use.

As we mentioned in model overview, the temporal activity C is constrained by calcium dynamics. The first step of estimating each c_i is computing the weighted average of fluorescence intensities after subtracting other neurons' temporal activity within th i-th neuron's ROI, which is the i-th row of C_raw (ci_raw). Then a deconvolution approach was applied to ci_raw for inferring spiking activity si and get the denoised version of ci, which is the i-th column of C.

Thus C_raw correspond to a scaled version of DF, which is a metric used in most calcium imaging literature. C is its denoised version, and S is the inferred spiking activity.

not our interest, but important for reconstructing the data: b, f, b0 and W

These variables are used for reconstructing the background B in the model. In general, the background is not needed for our downstream analysis. However, without good estimation of these variables, it's hard to extract good neural signals.