If the pixels are less than maxima, but greater than maxima minus the noise tolerance, mark as listed.If a greater maxima is met, ignore the active maxima.If the pixels are equal to the maxima, mark this as equal.Neighbouring pixels within a noise tolerance (notl) of the maxima are scanned until the region within tolerance is exhausted. Expand out (‘flood fill’) from each maxima location.Starting with the brightest maxima and working down the intensities: If a maxima is close to another then the maxima will be merged or removed based on the below criteria. In the case of algorithm a single parameter is used, the noise tolerance (Prominence).
Once filtered this image is compared back to the original, where the pixels are the same value represents the locations of the local maxima. Typically there are far too many local maxima to be meaningful so the goal is then to merge and prune this maxima using some kind of measure of quality. This involves processing the image with a 3x3 neighbourhood maximum filter. The first stage in the maxima finding algorithm is to find the local maxima. This script is simply to provide the functionality of the ImageJ find maxima algorithm to individuals writing pure python script.
The java version is faster but this could be alleviated by compiling c code for parts of the code. This implementation remains faithful to the original implementation but is not 100% optimised. The original java code source can be found in: This is a re-implementation of the java plugin written by Michael Schmid and Wayne Rasband for ImageJ. Maxima finding algorithm implemented in Python recreated from implementation in Fiji(ImageJ)