public class SubpixelLocalization<P extends Localizable,T extends RealType<T>> extends Object
refinePeaks(List, RandomAccessible, Interval, boolean, int, boolean, float, boolean[], int)
method to do this, but this has a lot of parameters. Therefore, this class
can also be instantiated to encapsulate the parameter settings.
A List RefinedPeak
for the given list of Localizable
is
computed by, for each peak, fitting a quadratic function to the image and
computing the subpixel coordinates of the extremum. This is an iterative
procedure. If the extremum is shifted more than 0.5 in one or more the fit is
repeated at the corresponding integer coordinates. This is repeated to
convergence, for a maximum number of iterations, or until the integer
coordinates move out of the valid image.
Modifier and Type | Field and Description |
---|---|
protected boolean[] |
allowedToMoveInDim |
protected boolean |
allowMaximaTolerance |
protected boolean |
canMoveOutside |
protected float |
maximaTolerance |
protected int |
maxNumMoves |
protected int |
numThreads |
protected boolean |
returnInvalidPeaks |
Constructor and Description |
---|
SubpixelLocalization(int numDimensions) |
Modifier and Type | Method and Description |
---|---|
boolean[] |
getAllowedToMoveInDim() |
boolean |
getAllowMaximaTolerance() |
boolean |
getCanMoveOutside() |
float |
getMaximaTolerance() |
int |
getMaxNumMoves() |
int |
getNumThreads() |
boolean |
getReturnInvalidPeaks() |
ArrayList<RefinedPeak<P>> |
process(List<P> peaks,
RandomAccessible<T> img,
Interval validInterval)
Refine a set of peaks to subpixel coordinates.
|
protected static <T extends RealType<T>> |
quadraticFitOffset(Localizable p,
RandomAccess<T> access,
Matrix g,
Matrix H,
RealPositionable offset)
Estimate subpixel
offset of extremum of quadratic function
fitted at p . |
static <T extends RealType<T>,P extends Localizable> |
refinePeaks(List<P> peaks,
RandomAccessible<T> img,
Interval validInterval,
boolean returnInvalidPeaks,
int maxNumMoves,
boolean allowMaximaTolerance,
float maximaTolerance,
boolean[] allowedToMoveInDim)
Refine a set of peaks to subpixel coordinates.
|
static <T extends RealType<T>,P extends Localizable> |
refinePeaks(List<P> peaks,
RandomAccessible<T> img,
Interval validInterval,
boolean returnInvalidPeaks,
int maxNumMoves,
boolean allowMaximaTolerance,
float maximaTolerance,
boolean[] allowedToMoveInDim,
int numThreads)
Refine a set of peaks to subpixel coordinates.
|
void |
setAllowedToMoveInDim(boolean[] allowedToMoveInDim) |
void |
setAllowMaximaTolerance(boolean allowMaximaTolerance) |
void |
setCanMoveOutside(boolean canMoveOutside) |
void |
setMaximaTolerance(float maximaTolerance) |
void |
setMaxNumMoves(int maxNumMoves) |
void |
setNumThreads(int numThreads) |
void |
setReturnInvalidPeaks(boolean returnInvalidPeaks) |
protected int maxNumMoves
protected boolean allowMaximaTolerance
protected boolean canMoveOutside
protected float maximaTolerance
protected boolean[] allowedToMoveInDim
protected boolean returnInvalidPeaks
protected int numThreads
public void setAllowMaximaTolerance(boolean allowMaximaTolerance)
public void setCanMoveOutside(boolean canMoveOutside)
public void setMaximaTolerance(float maximaTolerance)
public void setMaxNumMoves(int maxNumMoves)
public void setAllowedToMoveInDim(boolean[] allowedToMoveInDim)
public void setReturnInvalidPeaks(boolean returnInvalidPeaks)
public void setNumThreads(int numThreads)
public boolean getAllowMaximaTolerance()
public boolean getCanMoveOutside()
public float getMaximaTolerance()
public int getMaxNumMoves()
public boolean[] getAllowedToMoveInDim()
public boolean getReturnInvalidPeaks()
public int getNumThreads()
public ArrayList<RefinedPeak<P>> process(List<P> peaks, RandomAccessible<T> img, Interval validInterval)
refinePeaks(List, RandomAccessible, Interval, boolean, int, boolean, float, boolean[], int)
with the parameters set to this object.peaks
- List of integer peaks.img
- Pixel values.validInterval
- In which interval the img
contains valid pixels.
If null, an infinite img
is assumed. Integer
peaks must lie within a 1-pixel border of this interval.public static <T extends RealType<T>,P extends Localizable> ArrayList<RefinedPeak<P>> refinePeaks(List<P> peaks, RandomAccessible<T> img, Interval validInterval, boolean returnInvalidPeaks, int maxNumMoves, boolean allowMaximaTolerance, float maximaTolerance, boolean[] allowedToMoveInDim, int numThreads)
A List RefinedPeak
for the given list of Localizable
is
computed by, for each peak, fitting a quadratic function to the image and
computing the subpixel coordinates of the extremum. This is an iterative
procedure. If the extremum is shifted more than 0.5 in one or more the
fit is repeated at the corresponding integer coordinates. This is
repeated to convergence, for a maximum number of iterations, or until the
integer coordinates move out of the valid image.
peaks
- List of integer peaks.img
- Pixel values.validInterval
- In which interval the img
contains valid pixels.
If null, an infinite img
is assumed. Integer
peaks must lie within a 1-pixel border of this interval.returnInvalidPeaks
- Whether (invalid) RefinedPeak
should be created for
peaks where the fitting procedure did not converge.maxNumMoves
- maximum number of iterations for each peak.allowMaximaTolerance
- If we allow an increasing maxima tolerance we will not change
the base position that easily. Sometimes it simply jumps from
left to right and back, because it is 4.51 (i.e. goto 5), then
4.49 (i.e. goto 4) Then we say, ok, lets keep the base
position even if the subpixel location is 0.6...maximaTolerance
- By how much to increase the tolerance per iteration.allowedToMoveInDim
- specifies, per dimension, whether the base location is allowed
to be moved in the iterative procedure.numThreads
- How many threads to use for the computation.public static <T extends RealType<T>,P extends Localizable> ArrayList<RefinedPeak<P>> refinePeaks(List<P> peaks, RandomAccessible<T> img, Interval validInterval, boolean returnInvalidPeaks, int maxNumMoves, boolean allowMaximaTolerance, float maximaTolerance, boolean[] allowedToMoveInDim)
A List RefinedPeak
for the given list of Localizable
is
computed by, for each peak, fitting a quadratic function to the image and
computing the subpixel coordinates of the extremum. This is an iterative
procedure. If the extremum is shifted more than 0.5 in one or more the
fit is repeated at the corresponding integer coordinates. This is
repeated to convergence, for a maximum number of iterations, or until the
integer coordinates move out of the valid image.
peaks
- List of integer peaks.img
- Pixel values.validInterval
- In which interval the img
contains valid pixels.
If null, an infinite img
is assumed. Integer
peaks must lie within a 1-pixel border of this interval.returnInvalidPeaks
- Whether (invalid) RefinedPeak
should be created for
peaks where the fitting procedure did not converge.maxNumMoves
- maximum number of iterations for each peak.allowMaximaTolerance
- If we allow an increasing maxima tolerance we will not change
the base position that easily. Sometimes it simply jumps from
left to right and back, because it is 4.51 (i.e. goto 5), then
4.49 (i.e. goto 4) Then we say, ok, lets keep the base
position even if the subpixel location is 0.6...maximaTolerance
- By how much to increase the tolerance per iteration.allowedToMoveInDim
- specifies, per dimension, whether the base location is allowed
to be moved in the iterative procedure.protected static <T extends RealType<T>> void quadraticFitOffset(Localizable p, RandomAccess<T> access, Matrix g, Matrix H, RealPositionable offset)
offset
of extremum of quadratic function
fitted at p
.p
- integer position at which to fit quadratic.access
- access to the image values.g
- a n vector where n is the dimensionality of
the image. (This is a temporary variable to store the
gradient).H
- a n × n matrix where n is the
dimensionality of the image. (This is a temporary variable to
store the Hessian).offset
- subpixel offset of extremum wrt. p
is stored
here.Copyright © 2015–2022 ImgLib2. All rights reserved.