public class Wave
extends java.lang.Object
implements java.io.Serializable
Modifier and Type | Field and Description |
---|---|
static int |
BURST_TYPE |
protected Comments |
comments |
protected ResizableDoubleArray |
contents |
static int |
CROSSCORRELATION_TYPE |
static int |
ELECTROPHYS_TYPE |
static int |
EPISODIC_TYPE |
static int |
IMAGING_TYPE |
protected java.util.Vector |
listeners |
protected static Max |
max |
protected static Mean |
mean |
protected static Median |
median |
protected static Min |
min |
protected Roi |
roi |
protected double |
samplingRate_Hz |
protected static StandardDeviation |
stdev |
protected int |
type |
protected java.lang.String |
units |
static int |
UNKNOWN_TYPE |
protected java.lang.String |
waveName |
protected int |
xStartOffset |
protected Wave |
xwave |
Constructor and Description |
---|
Wave() |
Wave(double[] waveValues) |
Wave(int initialCapacity) |
Wave(java.lang.String filename) |
Wave(Wave wave) |
Modifier and Type | Method and Description |
---|---|
Wave |
__add__(java.lang.Double other) |
Wave |
__add__(Wave other) |
void |
__delitem__(int i) |
Wave |
__div__(java.lang.Double other) |
java.lang.Double |
__getitem__(double d) |
java.lang.Double |
__getitem__(int i) |
int |
__len__() |
Wave |
__mul__(java.lang.Double other) |
void |
__setitem__(int i,
double value) |
Wave |
__sub__(java.lang.Double other) |
Wave |
__sub__(Wave other) |
void |
abs() |
void |
add(double value)
Adds each element within this Wave by the value passed as argument and fires a waveChanged event.
|
void |
addElement(double value)
Appends a value to the end of this array and fires a waveChanged event.
|
void |
addElement(double value,
boolean fireWaveChanged)
Appends a value to this array with the option of firing a waveChanged event.
|
void |
addWave(Wave wave2)
Adds the contents of the Wave passed as argument, to this Wave instance index-by-index.
|
void |
addWaveListener(WaveListener listener) |
void |
append(Wave wave2)
Appends the contents of the Wave passed as argument to the end of this Wave instance.
|
void |
applyWindowFunction() |
protected double |
averageWindow(double[] values,
int index,
int length) |
double |
calculateArea()
Duplicates the Wave, integrates it, and returns the sum between the time values passed as argument.
|
double |
calculateArea(double startTime_s,
double endTime_s)
Duplicates the Wave, integrates it, and returns the sum between the time values passed as argument.
|
double |
calculateResiduals(Wave modelWave) |
void |
centerAboutZero()
Centers the amplitudes of this Wave about zero and fires a waveChanged event.
|
void |
clear()
Removes all elements from this Wave.
|
Wave |
clone() |
protected void |
cloneMetadata(Wave wave2) |
void |
convolve(double[] fir) |
void |
convolve(Wave firWave) |
protected void |
createContentsBufferIfNecessary() |
ij.measure.CurveFitter |
curveFit(int fitType,
boolean showOptions) |
FitWave |
curveFitExponential() |
void |
decimate(int decimateFactor) |
void |
differentiate()
Replaces the values at each index with the delta y compared to the previous index but does not scale based on the sampling rate.
|
void |
divide(double value)
Divides each element within this Wave by the value passed as argument and fires a waveChanged event.
|
void |
exponentialFit()
Applies an exponential fit to the contents of this Wave, subtracts it, and fires a waveChanged event.
|
double |
findNextTimeAbove(double startTime_s,
double threshold) |
double |
findNextTimeBelow(double startTime_s,
double threshold) |
double |
get(int i) |
Bursts |
getBursts(double absThreshold)
Identifies bursts based on an absolute threshold crossing algorithm.
|
Bursts |
getBursts(double absThreshold,
boolean showBurstCycleIndices)
Identifies bursts based on an absolute threshold crossing algorithm.
|
Bursts |
getBursts(java.lang.String prefix,
double absThreshold,
double thresholdMax,
double tailingOffset,
double tailingOffsetMax,
boolean showBurstCycleIndices)
Identifies bursts based on an absolute threshold crossing algorithm.
|
Bursts |
getBursts(java.lang.String prefix,
java.util.Vector indiceVectors) |
Bursts |
getBurstsFromLocalMaxima(double minimumBurstDur_s,
double ampThresholdFactor,
Wave amplitudeWave)
Uses the median value of the amplitudeWave as the zero-reference amplitude and assumes 'this' wave is a central finite difference of the amplitude wave to find the relative peak amplitude constrained by the other parameters.
|
Bursts |
getBurstsFromLocalMinima(double minimumBurstDur_s,
double ampThresholdFactor,
Wave amplitudeWave)
Uses the median value of the amplitudeWave as the zero-reference amplitude and assumes 'this' wave is a central finite difference of the amplitude wave to find the relative trough amplitude constrained by the other parameters.
|
Bursts |
getBurstsFromPeakDetector(double smoothDegree_s,
double minimumBurstDur_s,
double ampThresholdFactor) |
Wave |
getCleanZscore() |
Wave |
getCleanZscore(double smooth_s)
This reduces low-frequency oscillations in the truncated zscore -- this can take a while.
|
Wave |
getCleanZscoredWave() |
Wave |
getCleanZscoredWave(double smooth_s)
This reduces low-frequency oscillations in the truncated zscore -- this can take a while.
|
Comments |
getComments() |
double |
getCorrelationTime() |
double |
getCorrelationValue() |
Waves |
getDifferenceWavesExcludingBursts(Bursts bursts)
Returns a list of Waves that are not represented by the Bursts passed as argument; this assumes the Bursts are arrayed in the order they appear in this wave.
|
double |
getEndTime() |
protected Wave |
getExponentialWave(double[] paramVals,
double samplingRate_Hz,
int length) |
int |
getIndex(double time_s)
Returns the index in the list of values for the time passed as argument.
|
java.lang.String |
getInfo() |
double |
getLength_s()
Returns the length of this Wave in seconds.
|
int |
getLength()
Returns the number of elements in this Wave.
|
double |
getMaxValue() |
double |
getMaxValue(double startTime,
double endTime) |
double |
getMaxValue(int startIndex,
int length) |
double |
getMaxValueTime() |
double |
getMaxValueTime(double startTime,
double endTime)
Returns the time that the max value of the Wave is achieved (in seconds).
|
double |
getMaxValueTime(int startIndex,
int endIndex) |
double |
getMeanValue() |
double |
getMeanValue(double startTime,
double endTime) |
double |
getMedianValue() |
double |
getMedianValue(double startTime,
double endTime) |
double |
getMinValue() |
double |
getMinValue(double startTime,
double endTime) |
double |
getMinValue(int startIndex,
int length) |
double |
getMinValueTime() |
double |
getMinValueTime(double startTime,
double endTime)
Returns the time that the min value of the Wave is achieved (in seconds).
|
double |
getMinValueTime(int startIndex,
int endIndex) |
java.lang.String |
getName()
Sets the name of this wave
|
Roi |
getRoi()
Returns an Roi associated with this Wave.
|
static Wave |
getRoiWave(ImagePlus imp,
Roi roi)
Creates a new Wave from Roi passed as argument the ImagePlus passed as argument.
|
static Wave |
getRoiWave(ImagePlus imp,
Roi[] rois) |
double |
getSamplingRateHz()
Returns the sampling rate of this wave in Hz
|
Wave |
getScrambledWave()
Returns the same Wave but with an new start location within the waveform depending on the value of a uniformly random number -- the new Wave wraps to maintain the same length as the original instance.
|
Wave |
getSpikeUnits()
Returns the spike units as a new wave -- this is defined as an absolute (value-median) > thresholdFactor*stdev where the
stdevFactorAsThreshold defaults to 3.0.
|
Wave |
getSpikeUnits(double thresholdFactor)
Returns the spike units as a new wave -- this is defined as an absolute (value-median) > thresholdFactor*stdev.
|
double |
getStartTime() |
double |
getStdevValue() |
double |
getStdevValue(double startTime,
double endTime) |
Wave |
getTemporalHistogram(double binSize_s) |
Wave |
getTruncatedZscoredWave() |
Wave |
getTruncatedZscoredWave(boolean clone)
This returns the wave from "getZscoredWave" truncated below 0.0 and clones the wave if specified by the argument, otherwise replaces the current Wave.
|
int |
getType() |
java.lang.String |
getTypeAsString() |
java.lang.String |
getUnits() |
double |
getValueAt(double time_s)
Returns the value of the wave at the specified time (in seconds).
|
double[] |
getValues()
Returns the values of this Wave.
|
double[] |
getValues(double startTime_s,
double endTime_s)
Returns just the values of the current Wave between the times passed as argument.
|
double[] |
getValues(int subsampleReduction)
Returns a decimated array corresponding to the waveform and picks out the max/min values for the decimation.
|
double[] |
getValues(int startIndex,
int endIndex) |
Wave |
getWaveForBurstAnalysisFromLocalMaxima(double smoothDegree_s)
Returns a new Wave that has a moving average filter applied to it and then a central finite difference applied.
|
Wave |
getWaveRange(double startTime_s,
double endTime_s)
Returns a duplicate Wave from the startTime_s up to endTime_s.
|
Wave |
getWaveRange(int startIndex,
int length)
Returns a duplicate Wave from the startIndex to the startIndex+length index.
|
int |
getXStartOffset()
An offset for the first element in the wave.
|
double[] |
getXValues()
Returns the time (i.e., 'x') values associated with this Wave.
|
Wave |
getXWave() |
double[] |
getYValues()
Returns the same values as the getValues function.
|
Wave |
getZscoredWave() |
Wave |
getZscoredWave(boolean clone)
Returns a clone copy of this wave
but where each value in the series has the z-scored value (i.e., the mean of the Wave will be 0 and the stdev=1).
|
void |
integrate()
Converts the current Wave to an integrated Wave by approximating the Rectangle Method (http://en.wikipedia.org/wiki/Rectangle_method).
|
void |
invert()
Inverts the sign of the wave.
|
boolean |
isElectrophysType() |
boolean |
isImagingType() |
boolean |
isProxy()
Returns false unless a class extends WaveProxy.
|
boolean |
isUnknownType() |
void |
linearFit()
Applies a linear fit to the contents of this Wave, subtracts it, and fires a waveChanged event.
|
void |
load(java.lang.String filename) |
void |
loadFromText(java.lang.String filename,
int iterateBy) |
void |
movingAverageFilter(double time_s) |
void |
movingAverageFilter2(double time_s) |
void |
multiply(double value)
Multiplies each element within this Wave by the value passed as argument and fires a waveChanged event.
|
void |
normalize()
Normalize the waveform to the range [-1, 1]
|
void |
normalize(double newMinValue,
double newMaxValue)
according to this: http://en.wikipedia.org/wiki/Normalization_%28image_processing%29
|
static Wave |
open(java.lang.String filename)
Returns a new Wave instance loaded from the .wave binary file passed as input.
|
ChartPlugIn |
plot2D() |
void |
readObject(java.io.ObjectInputStream in) |
static void |
recalcExponentialWave(Wave expWave,
double[] paramVals) |
void |
removeWaveListener(WaveListener listener) |
void |
save(java.lang.String filename) |
void |
saveAsText(java.lang.String filename)
Saves the waveform to the text file with a default of 3 decimal places.
|
void |
saveAsText(java.lang.String filename,
int decimalPlaces)
Saves the waveform to the text file with the number of decimal places passed as argument.
|
void |
set(int i,
double value) |
void |
setBlankValues(double blankValue,
java.lang.String choice,
double thresholdValue) |
void |
setComments(Comments newComments) |
void |
setCorrelationTime(double newTime) |
void |
setCorrelationValue(double newCorr) |
void |
setName(java.lang.String name)
Returns the name of this wave
|
void |
setRoi(Roi newRoi)
Sets an Roi associated with this Wave.
|
void |
setSamplingRateHz(double newSamplingRate_Hz)
Sets the sampling rate of this wave in Hz
|
void |
setType(int waveType) |
void |
setUnits(java.lang.String units) |
void |
setValues(double[] values)
Sets the contents of this Wave to the values passed as argument.
|
void |
setXStartOffset(int newValue)
An offset for the first element in the wave.
|
void |
setXStartOffsetTime(double newValue)
An offset for the first element in the wave.
|
void |
setXWave(Wave xwave) |
Waves |
split(double timeToSplit)
Splits the Wave instance into two Waves at the time passed as argument (in seconds).
|
void |
subtract(double value)
Subtracts each element within this Wave by the value passed as argument and fires a waveChanged event.
|
void |
subtractWave(Wave wave2)
Subtracts the contents of the Wave passed as argument, to this Wave instance index-by-index.
|
double |
sum(double startTime_s,
double endTime_s)
Sums all the values within the Wave inclusively between the times passed as argument.
|
void |
waveChanged() |
void |
writeAudioFile(java.lang.String outputFilename)
Writes the amplitude-scaled waveform to a .wav audio file passed as argument.
|
void |
writeObject(java.io.ObjectOutputStream out) |
protected ResizableDoubleArray contents
protected static Max max
protected static Min min
protected static Mean mean
protected static Median median
protected static StandardDeviation stdev
protected Comments comments
protected java.lang.String units
protected java.lang.String waveName
protected double samplingRate_Hz
protected java.util.Vector listeners
protected int xStartOffset
public static final int UNKNOWN_TYPE
public static final int IMAGING_TYPE
public static final int ELECTROPHYS_TYPE
public static final int EPISODIC_TYPE
public static final int CROSSCORRELATION_TYPE
public static final int BURST_TYPE
protected int type
protected Roi roi
protected Wave xwave
public Wave()
public Wave(double[] waveValues)
public Wave(java.lang.String filename) throws java.io.IOException, java.lang.ClassNotFoundException
java.io.IOException
java.lang.ClassNotFoundException
public Wave(Wave wave)
public Wave(int initialCapacity)
public Comments getComments()
public void setComments(Comments newComments)
public double getStartTime()
public double getEndTime()
public java.lang.String getInfo()
public static Wave open(java.lang.String filename) throws java.io.IOException, java.lang.ClassNotFoundException
java.io.IOException
java.lang.ClassNotFoundException
public void load(java.lang.String filename) throws java.io.IOException, java.lang.ClassNotFoundException
java.io.IOException
java.lang.ClassNotFoundException
public void setName(java.lang.String name)
public java.lang.String getName()
public void setUnits(java.lang.String units)
public java.lang.String getUnits()
public double getSamplingRateHz()
public void setSamplingRateHz(double newSamplingRate_Hz)
public void setRoi(Roi newRoi)
public Roi getRoi()
public double findNextTimeAbove(double startTime_s, double threshold)
public double findNextTimeBelow(double startTime_s, double threshold)
public void decimate(int decimateFactor)
public void setBlankValues(double blankValue, java.lang.String choice, double thresholdValue)
public void add(double value)
public void addWave(Wave wave2)
public void subtractWave(Wave wave2)
public void invert()
public void subtract(double value)
public void multiply(double value)
public void divide(double value)
public double getMaxValue()
public double getMaxValue(double startTime, double endTime)
public double getMaxValue(int startIndex, int length)
public double getMinValue()
public double getMinValue(double startTime, double endTime)
public double getMinValue(int startIndex, int length)
public double getMinValueTime()
public double getMinValueTime(double startTime, double endTime)
public double getMinValueTime(int startIndex, int endIndex)
public double getMaxValueTime()
public double getMaxValueTime(double startTime, double endTime)
public double getMaxValueTime(int startIndex, int endIndex)
public Wave getTemporalHistogram(double binSize_s)
public Wave getSpikeUnits()
public Wave getSpikeUnits(double thresholdFactor)
public Wave getScrambledWave()
public double getMeanValue(double startTime, double endTime)
public double getMeanValue()
public double getMedianValue(double startTime, double endTime)
public double getMedianValue()
public double getStdevValue(double startTime, double endTime)
public double getStdevValue()
public void normalize()
public void normalize(double newMinValue, double newMaxValue)
public double getValueAt(double time_s)
public void setXWave(Wave xwave)
public Wave getXWave()
public double[] getXValues()
public double[] getYValues()
public double[] getValues()
public int getLength()
public double getLength_s()
public void setValues(double[] values)
public void centerAboutZero()
public void applyWindowFunction()
protected Wave getExponentialWave(double[] paramVals, double samplingRate_Hz, int length)
public static void recalcExponentialWave(Wave expWave, double[] paramVals)
public ij.measure.CurveFitter curveFit(int fitType, boolean showOptions)
public FitWave curveFitExponential()
public double calculateResiduals(Wave modelWave)
public void exponentialFit()
public void linearFit()
public double[] getValues(int subsampleReduction)
public void setCorrelationTime(double newTime)
public double getCorrelationTime()
public void setCorrelationValue(double newCorr)
public double getCorrelationValue()
public Bursts getBursts(double absThreshold)
public Bursts getBursts(double absThreshold, boolean showBurstCycleIndices)
public Bursts getBursts(java.lang.String prefix, double absThreshold, double thresholdMax, double tailingOffset, double tailingOffsetMax, boolean showBurstCycleIndices)
public Wave getWaveForBurstAnalysisFromLocalMaxima(double smoothDegree_s)
public Bursts getBurstsFromPeakDetector(double smoothDegree_s, double minimumBurstDur_s, double ampThresholdFactor)
public Bursts getBurstsFromLocalMaxima(double minimumBurstDur_s, double ampThresholdFactor, Wave amplitudeWave)
public Bursts getBurstsFromLocalMinima(double minimumBurstDur_s, double ampThresholdFactor, Wave amplitudeWave)
public Waves getDifferenceWavesExcludingBursts(Bursts bursts)
public Bursts getBursts(java.lang.String prefix, java.util.Vector indiceVectors)
public void writeAudioFile(java.lang.String outputFilename) throws java.io.IOException
java.io.IOException
public void save(java.lang.String filename) throws java.io.IOException
java.io.IOException
public void saveAsText(java.lang.String filename) throws java.io.IOException
java.io.IOException
public void saveAsText(java.lang.String filename, int decimalPlaces) throws java.io.IOException
java.io.IOException
public void setType(int waveType)
public int getType()
public java.lang.String getTypeAsString()
public boolean isImagingType()
public boolean isElectrophysType()
public boolean isUnknownType()
public static Wave getRoiWave(ImagePlus imp, Roi roi)
protected void createContentsBufferIfNecessary()
public void clear()
public void addElement(double value)
public void addElement(double value, boolean fireWaveChanged)
public void setXStartOffset(int newValue)
public void setXStartOffsetTime(double newValue)
public int getXStartOffset()
public void loadFromText(java.lang.String filename, int iterateBy) throws java.io.IOException
java.io.IOException
public Wave __add__(java.lang.Double other)
public Wave __sub__(java.lang.Double other)
public Wave __mul__(java.lang.Double other)
public Wave __div__(java.lang.Double other)
public double get(int i)
public java.lang.Double __getitem__(int i)
public java.lang.Double __getitem__(double d)
public void __setitem__(int i, double value)
public void set(int i, double value)
public void __delitem__(int i)
public int __len__()
public void differentiate()
public double calculateArea(double startTime_s, double endTime_s)
public double calculateArea()
public double sum(double startTime_s, double endTime_s)
public int getIndex(double time_s)
public double[] getValues(int startIndex, int endIndex)
public double[] getValues(double startTime_s, double endTime_s)
public void integrate()
protected double averageWindow(double[] values, int index, int length)
public Wave getCleanZscoredWave()
public Wave getCleanZscore()
public Wave getCleanZscoredWave(double smooth_s)
public Wave getCleanZscore(double smooth_s)
public void movingAverageFilter2(double time_s)
public void movingAverageFilter(double time_s)
public void convolve(Wave firWave)
public void convolve(double[] fir)
public void abs()
public Wave clone()
clone
in class java.lang.Object
public void waveChanged()
public void addWaveListener(WaveListener listener)
public void removeWaveListener(WaveListener listener)
public void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException
java.io.IOException
public void readObject(java.io.ObjectInputStream in) throws java.io.IOException, java.lang.ClassNotFoundException
java.io.IOException
java.lang.ClassNotFoundException
public boolean isProxy()
public void append(Wave wave2)
protected void cloneMetadata(Wave wave2)
public Wave getZscoredWave(boolean clone)
public Wave getZscoredWave()
public Wave getTruncatedZscoredWave(boolean clone)
public Wave getTruncatedZscoredWave()
public Wave getWaveRange(int startIndex, int length)
public Wave getWaveRange(double startTime_s, double endTime_s)
public Waves split(double timeToSplit)
public ChartPlugIn plot2D()