zscore_metric
Locates peaks in the scaled mip from a match template result.
extract_peaks_and_statistics_zscore(mip, scaled_mip, best_psi, best_theta, best_phi, best_defocus, correlation_average, correlation_variance, total_correlation_positions, false_positives=1.0, z_score_cutoff=None, mask_radius=5.0)
Returns peak locations, heights, and pose stats from match template results.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
mip
|
Tensor
|
Maximum intensity projection of the match template results. |
required |
scaled_mip
|
Tensor
|
Scaled maximum intensity projection of the match template results. |
required |
best_psi
|
Tensor
|
Best psi angles for each pixel. |
required |
best_theta
|
Tensor
|
Best theta angles for each pixel. |
required |
best_phi
|
Tensor
|
Best phi angles for each pixel. |
required |
best_defocus
|
Tensor
|
Best relative defocus values for each pixel. |
required |
correlation_average
|
Tensor
|
Average correlation value for each pixel. |
required |
correlation_variance
|
Tensor
|
Variance of the correlation values for each pixel. |
required |
total_correlation_positions
|
int
|
Total number of correlation positions calculated during template matching. Must
be provided if |
required |
false_positives
|
float
|
Number of false positives to allow in the image (over all pixels). Default is 1.0 which corresponds to a single false-positive. |
1.0
|
z_score_cutoff
|
float
|
Z-score cutoff value for peak detection. If not provided, it is calculated using the Gaussian noise model. Default is None. |
None
|
mask_radius
|
float
|
Radius of the mask to apply around the peak, in units of pixels. Default is 5.0. |
5.0
|
Returns:
Type | Description |
---|---|
MatchTemplatePeaks
|
Named tuple containing the peak locations, heights, and pose statistics. |
Source code in src/leopard_em/analysis/zscore_metric.py
89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 |
|
find_peaks_from_zscore(zscore_map, zscore_cutoff, mask_radius=5.0)
Find peaks in a z-score map above a cutoff threshold using torch.
The function returns a tensor of peak indices sorted in descending order by their z-score values. Peaks closer than mask_radius to an already picked peak are suppressed.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
zscore_map
|
Tensor
|
Input tensor containing z-score values. |
required |
zscore_cutoff
|
float
|
Minimum z-score value to consider as a peak. |
required |
mask_radius
|
float
|
Minimum allowed distance between peaks, default is 5.0. |
5.0
|
Returns:
Type | Description |
---|---|
tuple[Tensor, Tensor]
|
Two tensors containing the y and x coordinates of the peaks. |
Source code in src/leopard_em/analysis/zscore_metric.py
42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 |
|
gaussian_noise_zscore_cutoff(num_ccg, false_positives=1.0)
Determines the z-score cutoff based on Gaussian noise model and number of pixels.
NOTE: This procedure assumes that the z-scores (normalized maximum intensity projections) are distributed according to a standard normal distribution. Here, this model is used to find the cutoff value such that there is at most 'false_positives' number of false positives in all of the pixels.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
num_ccg
|
int
|
Total number of cross-correlograms calculated during template matching. Product of the number of pixels, number of defocus values, and number of orientations. |
required |
false_positives
|
float
|
Number of false positives to allow in the image (over all pixels). Default is 1.0 which corresponds to a single false-positive. |
1.0
|
Returns:
Type | Description |
---|---|
float
|
Z-score cutoff. |
Source code in src/leopard_em/analysis/zscore_metric.py
14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 |
|