# Difference between revisions of "Cross correlation matrix"

Line 15: | Line 15: | ||

# compute missing wedges for particles ''i'' and ''j'' -> W<sub>i</sub>, W<sub>j</sub> | # compute missing wedges for particles ''i'' and ''j'' -> W<sub>i</sub>, W<sub>j</sub> | ||

# rotate missing wedges -> R<sub>i</sub>W<sub>i</sub>, R<sub>j</sub>W<sub>j</sub> | # rotate missing wedges -> R<sub>i</sub>W<sub>i</sub>, R<sub>j</sub>W<sub>j</sub> | ||

+ | #: R<sub>i</sub> is the rotational part of A<sub>i</sub> | ||

# compute Fourier coefficients common to bCoth rotated missing wedges | # compute Fourier coefficients common to bCoth rotated missing wedges | ||

#:C<sub>ij</sub> = intersection(R<sub>i</sub>W<sub>i</sub>, R<sub>j</sub>W<sub>j</sub>) | #:C<sub>ij</sub> = intersection(R<sub>i</sub>W<sub>i</sub>, R<sub>j</sub>W<sub>j</sub>) | ||

− | # filter p<sub>i</sub> with C<sub>ij</sub> | + | # filter both p<sub>i</sub> and p<sub>j</sub> with C<sub>ij</sub> |

#: p̃<sub>i</sub> = F<sup>-1</sup>[ F(p<sub>i</sub>).* C<sub>ij</sub> ] | #: p̃<sub>i</sub> = F<sup>-1</sup>[ F(p<sub>i</sub>).* C<sub>ij</sub> ] | ||

+ | #: (.* is pixelwise multiplication) | ||

# compare the filtered particles inside the classification mask. | # compare the filtered particles inside the classification mask. | ||

#: ccmatrix(i,j)<- normalized cross correlation(p̃<sub>i</sub>|<sub>m</sub>, p̃<sub>j</sub>|<sub>m</sub>) | #: ccmatrix(i,j)<- normalized cross correlation(p̃<sub>i</sub>|<sub>m</sub>, p̃<sub>j</sub>|<sub>m</sub>) |

## Latest revision as of 11:16, 19 April 2016

The cross correlation matrix (often called *ccmatrix* in *Dynamo* jargon) of a set of *N* particles is an *N X N* matrix. Each entry *(i,j)* represents the similarity of particles *i* and *j* in the data set.

## Contents

## Definition of similarity

This similarity of particles *i* and *j* measured in terms of the normalized cross correlation of the the two aligned particles, filtered to their common fourier components, and restricted to a region in direct space (indicated by a classification mask). The pseudo code will run as:
```
```

- Input
- particles p
_{i} and p_{j}
- alignment parameters A
_{i} and A_{j}
- classification mask m

- read particles
*i* and *j* -> p_{i}, p_{j}
- align particles
*i*, and *j* -> A_{i}p_{i}, A_{j}p_{j}
- compute missing wedges for particles
*i* and *j* -> W_{i}, W_{j}
- rotate missing wedges -> R
_{i}W_{i}, R_{j}W_{j}
- R
_{i} is the rotational part of A_{i}

- compute Fourier coefficients common to bCoth rotated missing wedges
- C
_{ij} = intersection(R_{i}W_{i}, R_{j}W_{j})

- filter both p
_{i} and p_{j} with C_{ij}
- p̃
_{i} = F^{-1}[ F(p_{i}).* C_{ij} ]
- (.* is pixelwise multiplication)

- compare the filtered particles inside the classification mask.
- ccmatrix(i,j)<- normalized cross correlation(p̃
_{i}|_{m}, p̃_{j}|_{m})

```
```

## Input for ccmatrix construction

The minimal input is a set of particles (formatted as a data folder) and their alignment parameters (formatted as a table). You also may want to specify a classification mask and optatively additional mathematical operations on the particles (as bandpassing or symmetrization).

## Computation of a ccmatrix

*Dynamo* typically implements the computation of a ccmatrix in independent blocks. These blocks can be handled separately by different cores, but you do NOT have to tune the number of blocks to the number of available cores. The number of blocks needs to be tuned to the memory of your system and will be generally higher than the number of cores, so that each core will process several blocks sequentially.

## Applications of the ccmatrix

A ccmatrix is most commonly used in the context of PCA classification.
They can be used for Hierarchical clustering (using for instance the GUI `dynamo_ccmatrix_analysis`), but this procedure is normally much weaker than PCA.