A peak-finding routine in Matlab for static and time-resolved (electron) diffraction images
- No need to consider the symmetry group
- Not based on gradients (robust to noise)
- Have trouble distinguishing highly overlapping peaks
- May not find all peaks for complex low-symmetry diffraction patterns, especially if certain diffraction peaks exhibit nonconvex shapes (e.g. due to crystallite shape, the level of orientational disorder/mosaicity)
General steps (see example)
- Load diffraction image
- Apply median filter to the image to remove salt-and-pepper noise (
medfilt2
) - Center-blocking (
centerblock
) - Disection of image matrix into small blocks of the same size (
matsect
) - Find the region with potential peaks (peak candidates) according to ranking of summed intensity (
findPeakCandidates
) - Apply distance filter to the peak candidates (
distanceFilter
) - Apply Gaussian filter to the peak candidates 1-2 times (
GaussfitFilter
) - Calculate the averaged intensity of a number of pixels around the peak (
avgnearest
)
Major free parameters (see example)
- Center position (
rcent, ccent
) and radii (rrad, crad
) incenterblock
- Disected block image matrix dimensions in
matsect
along the row and column directions (runit, cunit
). - Distance limit in
distanceFilter
(dist
): depends on the density/sparsity of peaks in the diffraction pattern (easily estimated by eye). A sound choice can reduce computation cost for the following steps. - Intensity ranking cutoff in
findPeakCandidates
(ntop
): usually in the hundreds or more (0 <ntop
< total number of block matrices aftermatsect
).
Visualization of results (see example below)
N.B. the intensity at the peak locations are set to zero for better illustration in the visualization functions
- Peak-location-annotated images (
peakLocationPlot
) - Panel plot of all found peaks (
peakPanelPlot
)