public class AdvancedPeakFinding
extends java.lang.Object
Constructor and Description |
---|
AdvancedPeakFinding()
No instances allowed; use the static methods or the SpectrumPeak
class.
|
Modifier and Type | Method and Description |
---|---|
void |
allocateBuffers(int numberOfPixels) |
static int |
getNextPeakIndex(double[] spectrum,
int startingIndex,
int minIndicesBetweenPeaks,
double baseline)
Finds the index of the next peak where the index is larger than the given
starting index.
|
int |
getNextPeakIndex(int startingIndex,
int minIndicesBetweenPeaks,
double baseline)
Call setBufferElements() to set the values in spectrumBuffer before calling this method!
|
static double |
getNextPeakWavelength(double[] wavelengths,
double[] spectrum,
double startingWavelength,
int minIndicesBetweenPeaks,
double baseline)
Finds the wavelength of the next peak where the wavelength is larger
than the given starting wavelength.
|
double |
getNextPeakWavelength(double startingWavelength,
int minIndicesBetweenPeaks,
double baseline)
Call setBufferElements() to set the values in spectrumBuffer and wavelengthBuffer before calling this method!
|
static int |
getPeakIndexClosestToIndex(double[] spectrum,
int targetIndex,
int minIndicesBetweenPeaks,
double baseline)
Finds the index (array subscript) of the peak that is closest to the
given starting index.
|
int |
getPeakIndexClosestToIndex(int targetIndex,
int minIndicesBetweenPeaks,
double baseline)
Call setBufferElements() to set the values in spectrumBuffer before calling this method!
|
static int |
getPeakIndexClosestToWavelength(double[] wavelengths,
double[] spectrum,
double targetWavelength,
int minIndicesBetweenPeaks,
double baseline)
Finds the index (array subscript) of the peak that is closest to the
given target wavelength.
|
int |
getPeakIndexClosestToWavelength(double targetWavelength,
int minIndicesBetweenPeaks,
double baseline)
Call setBufferElements() to set the values in spectrumBuffer and wavelengthBuffer before calling this method!
|
static int[] |
getPeakIndices(double[] spectrum,
int minIndicesBetweenPeaks,
double baseline)
Locates the peaks in the given spectrum and returns an array of their
indices.
|
int[] |
getPeakIndices(int minIndicesBetweenPeaks,
double baseline)
Call setBufferElements() to set the values in spectrumBuffer before calling this method!
|
static double |
getPeakWavelengthClosestToWavelength(double[] wavelengths,
double[] spectrum,
double targetWavelength,
int minIndicesBetweenPeaks,
double baseline)
Finds the wavelength of the peak that is closest to the given
target wavelength.
|
double |
getPeakWavelengthClosestToWavelength(double targetWavelength,
int minIndicesBetweenPeaks,
double baseline)
Call setBufferElements() to set the values in spectrumBuffer and wavelengthBuffer before calling this method!
|
static double[] |
getPeakWavelengths(double[] wavelengths,
double[] spectrum,
int minIndicesBetweenPeaks,
double baseline)
Finds the wavelengths at which peaks occur in the given spectrum.
|
double[] |
getPeakWavelengths(int minIndicesBetweenPeaks,
double baseline)
Call setBufferElements() to set the values in spectrumBuffer and wavelengthBuffer before calling this method!
|
static int |
getPreviousPeakIndex(double[] spectrum,
int startingIndex,
int minIndicesBetweenPeaks,
double baseline)
Finds the index of a peak where the index is the closest to, but smaller
than, the given starting index.
|
int |
getPreviousPeakIndex(int startingIndex,
int minIndicesBetweenPeaks,
double baseline)
Call setBufferElements() to set the values in spectrumBuffer before calling this method!
|
static double |
getPreviousPeakWavelength(double[] wavelengths,
double[] spectrum,
double startingWavelength,
int minIndicesBetweenPeaks,
double baseline)
Finds the wavelength of a peak where the wavelength is the closest to,
but smaller than, the given starting wavelength.
|
double |
getPreviousPeakWavelength(double startingWavelength,
int minIndicesBetweenPeaks,
double baseline)
Call setBufferElements() to set the values in spectrumBuffer and wavelengthBuffer before calling this method!
|
void |
setBufferElements(int index,
double spectrumPixel,
double wavelengthPixel) |
public AdvancedPeakFinding()
public void allocateBuffers(int numberOfPixels)
public void setBufferElements(int index, double spectrumPixel, double wavelengthPixel)
public static int[] getPeakIndices(double[] spectrum, int minIndicesBetweenPeaks, double baseline)
spectrum
- Array of valuesminIndicesBetweenPeaks
- Least number of values that must appear
between two reported peaks. A value of 1 allows peaks that have one
value between them to be found. A value of 10 will cause only the
largest of a window of 21 pixels to be reported, centered on the
largest peak. Values less than 1 will be treated as though it were
set to 1.baseline
- Minimum value that an element in the spectrum can be
and still be considered a peak.public int[] getPeakIndices(int minIndicesBetweenPeaks, double baseline)
minIndicesBetweenPeaks
- minimum indices between peaksbaseline
- lower baselinepublic static int getPeakIndexClosestToWavelength(double[] wavelengths, double[] spectrum, double targetWavelength, int minIndicesBetweenPeaks, double baseline) throws NoPeakFoundException
wavelengths
- Array of wavelengths for the spectrum.spectrum
- Array of spectrum values.targetWavelength
- Wavelength from which the closest peak will be
found.minIndicesBetweenPeaks
- Least distance, in pixels, between two
peaks.baseline
- Least value allowed for a peak.NoPeakFoundException
- thrown if the input spectrum has no peaks.public int getPeakIndexClosestToWavelength(double targetWavelength, int minIndicesBetweenPeaks, double baseline) throws NoPeakFoundException
targetWavelength
- target wavelengthminIndicesBetweenPeaks
- minimum indices between peaksbaseline
- lower baselineNoPeakFoundException
public static int getPeakIndexClosestToIndex(double[] spectrum, int targetIndex, int minIndicesBetweenPeaks, double baseline) throws NoPeakFoundException
spectrum
- Array of spectrum valuestargetIndex
- Index from which the closest peak will be foundminIndicesBetweenPeaks
- Least distance, in pixels, between two
peaksbaseline
- Least value allowed for a peakNoPeakFoundException
- thrown if the input spectrum has no peakspublic int getPeakIndexClosestToIndex(int targetIndex, int minIndicesBetweenPeaks, double baseline) throws NoPeakFoundException
NoPeakFoundException
public static double[] getPeakWavelengths(double[] wavelengths, double[] spectrum, int minIndicesBetweenPeaks, double baseline) throws NoPeakFoundException
wavelengths
- Array of wavelengths for the spectrumspectrum
- Array of spectrum valuesminIndicesBetweenPeaks
- Least distance, in pixels, between two
peaksbaseline
- Least value allowed for a peakNoPeakFoundException
- thrown if the input spectrum has no peakspublic double[] getPeakWavelengths(int minIndicesBetweenPeaks, double baseline) throws NoPeakFoundException
NoPeakFoundException
public static double getPeakWavelengthClosestToWavelength(double[] wavelengths, double[] spectrum, double targetWavelength, int minIndicesBetweenPeaks, double baseline) throws NoPeakFoundException
wavelengths
- Array of wavelengths for the spectrumspectrum
- Array of spectrum valuestargetWavelength
- Wavelength from which the closest peak will be
foundminIndicesBetweenPeaks
- Least distance, in pixels, between two
peaksbaseline
- Least value allowed for a peakNoPeakFoundException
- thrown if the input spectrum has no peakspublic double getPeakWavelengthClosestToWavelength(double targetWavelength, int minIndicesBetweenPeaks, double baseline) throws NoPeakFoundException
NoPeakFoundException
public static int getNextPeakIndex(double[] spectrum, int startingIndex, int minIndicesBetweenPeaks, double baseline) throws NoPeakFoundException
spectrum
- Array of spectrum valuesstartingIndex
- Index from which the next closest peak will be
foundminIndicesBetweenPeaks
- Least distance, in pixels, between two
peaksbaseline
- Least value allowed for a peakNoPeakFoundException
- thrown if the input spectrum has no peaks
or if no peaks have an index larger than the starting indexpublic int getNextPeakIndex(int startingIndex, int minIndicesBetweenPeaks, double baseline) throws NoPeakFoundException
NoPeakFoundException
public static int getPreviousPeakIndex(double[] spectrum, int startingIndex, int minIndicesBetweenPeaks, double baseline) throws NoPeakFoundException
spectrum
- Array of spectrum valuesstartingIndex
- Index from which the next closest peak will be foundminIndicesBetweenPeaks
- Least distance, in pixels, between two
peaksbaseline
- Least value allowed for a peakNoPeakFoundException
- thrown if the input spectrum has no peaks
or if no peaks have an index larger than the starting indexpublic int getPreviousPeakIndex(int startingIndex, int minIndicesBetweenPeaks, double baseline) throws NoPeakFoundException
NoPeakFoundException
public static double getNextPeakWavelength(double[] wavelengths, double[] spectrum, double startingWavelength, int minIndicesBetweenPeaks, double baseline) throws NoPeakFoundException
wavelengths
- Array of wavelengths for the spectrumspectrum
- Array of spectrum valuesstartingWavelength
- Wavelength from which the next closest peak
will be foundminIndicesBetweenPeaks
- Least distance, in pixels, between two peaksbaseline
- Least value allowed for a peakNoPeakFoundException
- thrown if the input spectrum has no peaks
or if no peaks have an wavelength larger than the starting wavelengthpublic double getNextPeakWavelength(double startingWavelength, int minIndicesBetweenPeaks, double baseline) throws NoPeakFoundException
NoPeakFoundException
public static double getPreviousPeakWavelength(double[] wavelengths, double[] spectrum, double startingWavelength, int minIndicesBetweenPeaks, double baseline) throws NoPeakFoundException
wavelengths
- Array of wavelengths for the spectrumspectrum
- Array of spectrum valuesstartingWavelength
- Wavelength from which the next closest peak
will be foundminIndicesBetweenPeaks
- Least distance, in pixels, between two
peaksbaseline
- Least value allowed for a peakNoPeakFoundException
- thrown if the input spectrum has no peaks
or if no peaks have an wavelength larger than the starting wavelengthpublic double getPreviousPeakWavelength(double startingWavelength, int minIndicesBetweenPeaks, double baseline) throws NoPeakFoundException
NoPeakFoundException
Copyright 2004-2006 Ocean Optics, Inc. All Rights Reserved.