T
 public class RegionalExtremaFinder3D<T extends RealType<T>> extends AbstractRegionalExtremaFinder<T>
This class finds the regional extrema of a 3 dimensional image. A regional maxima is defined as follows:
"A regional maximum M of a grayscale image I is a connected components of pixels such that every pixel in the neighborhood of M has a strictly lower value."
The definition of a regional minimum is simply the opposite; the neighboring pixels must be strictly brighter.
This class does not stipulate how much brighter a regional extreme must be from the neighboring pixels, but only requires that it is brighter or dimmer. So a connected component of pixels that is 1 higher in intensity from its neighbors is treated the same as a connected component that is 100 higher in intensity than it's neighbors.
The getRegionalExtrema()
method returns an ArrayList of ArrayLists, where each inner ArrayLists represents
a regional extreme and contains the coordinates of the pixels comprising that regional extreme.
Notably, this implementation does not allow for the identification of hdomes, as mentioned by Luc Vincent in his paper, "Morphological Grayscale Reconstruction in Image Analysis: Applications and Efficient Algorithms."
Modifier and Type  Field and Description 

protected int 
sign
Causes the algorithm to find regional maxima by default (1 = maxima, 1 = minima).

allowEdgeMax, doInterpolate, image, maxima, outOfBoundsFactory, threshold
Constructor and Description 

RegionalExtremaFinder3D(Image<T> image)
Constructor for the RegionalMaximaFinder3D class, returning a maxima finder.

RegionalExtremaFinder3D(Image<T> image,
boolean findMaxima)
Constructor for the RegionalMaximaFinder3D class.

Modifier and Type  Method and Description 

boolean 
checkInput()
Checks various fields to ensure they have been instantiated before executing the main functionality.

String 
getErrorMessage()
Returns any error messages.

protected static int 
getIndexOfPosition(int[] pos,
int width,
int numPixelsInXYPlane)
Given an array of a pixels position, the width of the image, and the number of pixels in a plane,
returns the index of the position in a linear array as calculated by x + width * y + numPixInPlane * z.

long 
getProcessingTime()
Returns the time necessary to execute the process() method, or in other words how long it takes to find the maxima of the input image.

ArrayList<ArrayList<int[]>> 
getRegionalExtrema()
Returns the ArrayList containing the coordinates of the regional maxima found.

protected boolean 
isEdgeMax(int[] coords)
Determines whether the input coordinates are on the edge of the image or not.

protected boolean 
isWithinImageBounds(int[] pos)
Given a position array, returns whether or not the position is within the bounds of the image, or out of bounds.

boolean 
process()
Finds the regional extrema of the input image.

allowEdgeExtrema, findAveragePosition, getRegionalExtremaCenters, setOutOfBoundsStrategyFactory, setThreshold
protected int sign
public RegionalExtremaFinder3D(Image<T> image, boolean findMaxima)
By default, the OutOfBoundsStrategyFactory
is a constant value strategy, sets to 0,
so as to avoid nasty mirroring of periodic maxima effects. Edge maxima will be discarded by
default, and there will be no maxima interpolation.
image
 the image to find the maxima offindMaxima
 if true, will return a maxima finder, and a minima finder otherwisepublic RegionalExtremaFinder3D(Image<T> image)
By default, the OutOfBoundsStrategyFactory
is a constant value strategy, sets to 0,
so as to avoid nasty mirroring of periodic maxima effects. Edge maxima will be discarded by
default, and there will be no maxima interpolation.
image
 the image to find the maxima ofpublic long getProcessingTime()
public String getErrorMessage()
public boolean checkInput()
public boolean process()
Finds the regional extrema of the input image.
Algorithm: Step 2.1 iterates through all of the pixels in the image with an outer cursor. For each pixel, if we have not processed the pixel previously, we then declare isExtrema to be true since the pixel could potentially be a regional extreme ('innocent until proven guilty' approach). We then add this pixel's coordinates to an ArrayList. The reason for the ArrayList is the following (example is for regional maxima): imagine a pixel which has a value of 255 (it's very bright, if 255 is white in an 8bit image), and that 25 of his direct 3D neighbors are strictly less bright than him (<255), but that one of his neighbors is also 255. Therefore, our pixel is not a regional maximum, but this pixel and his bright neighbor COULD be. Remember, a regional max is a connected component of pixels where all neighboring pixels have strictly less intensity. The ArrayList is therefore used to hold the coordinates of the pixels comprising regional extrema.
So, step 2.2 is the iteration through the pixels in the ArrayList. If a neighboring pixel is found to be strictly brighter (or lower), we mark isExtreme false, but continue iterating through the connected component because we know that the connected component cannot be a regional extreme, but we can save time by marking the pixels in this connected component as visited while we are here. If a neighboring pixel is found to have the same intensity value, that pixel is added to the ArrayList and subsequently searched. We stop this iteration once nothing more is added to the ArrayList (we've searched the entire connected component of our initial pixel from step 2.1).
Step 2.3 is the actual iteration through the neighbors of our current pixel from step 2.2.
Once the connected component is completely searched, if isExtreme == true, then we never found a brighter (or dimmer) pixel, so the whole connected component is a regional extreme, and an ArrayList of the coordinates of the pixels making up the connected component is stored in another ArrayList. If however isExtreme == false, we encountered a brighter (or dimmer) pixel on the border of the connected component, so the connected components pixels are not regional extrema and are just ignored, but marked as processed so we don't visit again.
public ArrayList<ArrayList<int[]>> getRegionalExtrema()
getRegionalExtrema
in interface RegionalExtremaFinder<T extends RealType<T>>
getRegionalExtrema
in class AbstractRegionalExtremaFinder<T extends RealType<T>>
protected final boolean isEdgeMax(int[] coords)
coords
 protected final boolean isWithinImageBounds(int[] pos)
pos
 protected static final int getIndexOfPosition(int[] pos, int width, int numPixelsInXYPlane)
pos
 width
 numPixelsInXYPlane
 Copyright © 2015–2017 Fiji. All rights reserved.