backend
Submodule for computationally intensive backend functions.
cross_correlate_particle_stack(particle_stack_dft, template_dft, rotation_matrices, projective_filters, mode='valid', batch_size=1024)
Cross-correlate a stack of particle images against a template.
Here, the argument 'particle_stack_dft' is a set of RFFT-ed particle images with necessary filtering already applied. The zeroth dimension corresponds to unique particles.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
particle_stack_dft
|
Tensor
|
The stack of particle real-Fourier transformed and un-fftshifted images. Shape of (N, H, W). |
required |
template_dft
|
Tensor
|
The template volume to extract central slices from. Real-Fourier transformed and fftshifted. |
required |
rotation_matrices
|
Tensor
|
The orientations of the particles to take the Fourier slices of, as a long list of rotation matrices. Shape of (N, 3, 3). |
required |
projective_filters
|
Tensor
|
Projective filters to apply to each Fourier slice particle. Shape of (N, h, w). |
required |
mode
|
Literal['valid', 'same']
|
Correlation mode to use, by default "valid". If "valid", the output will be the valid cross-correlation of the inputs. If "same", the output will be the same shape as the input particle stack. |
'valid'
|
batch_size
|
int
|
The number of particle images to cross-correlate at once. Default is 1024. Larger sizes will consume more memory. If -1, then the entire stack will be cross-correlated at once. |
1024
|
Returns:
Type | Description |
---|---|
Tensor
|
The cross-correlation of the particle stack with the template. Shape will depend on the mode used. If "valid", the output will be (N, H-h+1, W-w+1). If "same", the output will be (N, H, W). |
Raises:
Type | Description |
---|---|
ValueError
|
If the mode is not "valid" or "same". |
Source code in src/leopard_em/backend/core_refine_template.py
705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 |
|