Package detectionPlotFX.plots
Class RawFFTPlot<D extends PamDataUnit>
java.lang.Object
detectionPlotFX.plots.FFTPlot<D>
detectionPlotFX.plots.RawFFTPlot<D>
- Type Parameters:
 D- - the data unit.
- All Implemented Interfaces:
 DetectionPlot<D>
- Direct Known Subclasses:
 IshFFTPlot,OverlayGroupDisplay.RawWaveFFTPlot,WaterfallSpecPlot,WhistleFFTPlot
Plots FFT data as  background if raw data is available. Data units can be drawn over the spectrogram image. 
 
Specifically, this handles the calualtion of spectrograms from raw data and can handle large chunks of raw data. Data are ordered on a thred, an image is then created and loaded on another thread.
For detections whihc may already have a small saved spectrogram, e.g. anything that implements RawDataHolder, then use FFTPlot instead.
- Author:
 - Jamie Macaulay
 
- 
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionclassSimple wrapper class for to make the DetectionPlotProjector into a TimeProjectorFX.classData block for holding FFT Valuesclass - 
Field Summary
FieldsModifier and TypeFieldDescriptionprotected DThe last data unit whihc has been plotted.protected booleanTrue if the image needs recalculatedprotected booleanTrue if the raw data needs to be loaded againprotected RawFFTPlot<D>.SimpleFFTDataBlockThe FFT data block.protected ThreadFields inherited from class detectionPlotFX.plots.FFTPlot
detectionPlotDisplay, fftParams, spectrogramColours, timeFreqProjectorFields inherited from interface detectionPlotFX.layout.DetectionPlot
SCROLLPANE_DRAW, STANDARD_DRAW - 
Constructor Summary
ConstructorsConstructorDescriptionRawFFTPlot(DetectionPlotDisplay displayPlot, DetectionPlotProjector projector)  - 
Method Summary
Modifier and TypeMethodDescriptionvoidcheckSettingsChange(FFTPlotParams fftPlotParams) Check new settings against old settings to see what might need recalculated.A simple FFT data blockgetName()Get the name of the plot e.g.Get the projectorlongGet scroll startdouble[][]getSpectrogram(D pamDetection, int fftLen, int fftHop, int windowType) Get the spectrogram image from the data unit.protected voidloadDataUnitImage(double[] rawData, float sR, int channel, long dataStart, javafx.concurrent.Task task) Create the image of the spectrogram from FFT data units.voidloadRawData(D dataUnit, double padding, int plotChannel) Load the raw data.abstract voidpaintDetections(D detection, javafx.scene.canvas.GraphicsContext graphicsContext, javafx.scene.shape.Rectangle windowRect, DetectionPlotProjector projector) Paint the detection over the FFT.voidpaintPlot(D dataUnit, javafx.scene.canvas.GraphicsContext graphicsContext, javafx.scene.shape.Rectangle rectangle, DetectionPlotProjector projector, int flag) Plot the relevent data from a detection.protected voidpaintSpecImage(javafx.scene.canvas.GraphicsContext graphicsContext, javafx.scene.shape.Rectangle windowRect, DetectionPlotProjector projector) Paint the image.voidRepaint the current data unit.voidrepaintSpectrogram(long dataStart) Repaint the spectrogramvoidsetFFTParams(FFTPlotParams fftPlotParams) Set the FFT params.voidsetRawDataOrder(RawDataOrder rawDataOrder) voidsettingsChanged(FFTPlotParams fftPlotParams) Called whenever the settings are changed.voidsetupAxis(D pamDetection, double sR, DetectionPlotProjector projector) Setup the axis.voidsetUpTimeAxis(double millisDuration, DetectionPlotProjector plotProjector) Setup the time axis within the given duration.Methods inherited from class detectionPlotFX.plots.FFTPlot
createPlotParams, createSettingsPane, drawClipSpectrogram, enableTimeSpinner, getFFTParams, getSettingsPane, isUseKHz, setupFreqAxis, setupPlot 
- 
Field Details
- 
lastData
The last data unit whihc has been plotted. - 
reloadRaw
protected boolean reloadRawTrue if the raw data needs to be loaded again - 
reloadImage
protected boolean reloadImageTrue if the image needs recalculated - 
simpleFFTBlock
The FFT data block. - 
th
 
 - 
 - 
Constructor Details
- 
RawFFTPlot
 
 - 
 - 
Method Details
- 
getName
Description copied from interface:DetectionPlotGet the name of the plot e.g. waveform, spectrum etc.- Specified by:
 getNamein interfaceDetectionPlot<D extends PamDataUnit>- Overrides:
 getNamein classFFTPlot<D extends PamDataUnit>
 - 
paintPlot
public void paintPlot(D dataUnit, javafx.scene.canvas.GraphicsContext graphicsContext, javafx.scene.shape.Rectangle rectangle, DetectionPlotProjector projector, int flag) Description copied from interface:DetectionPlotPlot the relevent data from a detection.- Specified by:
 paintPlotin interfaceDetectionPlot<D extends PamDataUnit>- Overrides:
 paintPlotin classFFTPlot<D extends PamDataUnit>- Parameters:
 dataUnit- - the data of every channel. e.g. might be a waveform with each point representing a sample.graphicsContext- - the graphics handle to draw on.
 - 
loadRawData
Load the raw data. This can be overridden if necessary.- Parameters:
 dataUnit- - the data unit to loadpadding- - the padding.plotChannel- - the plot channel.
 - 
setupAxis
Description copied from interface:DetectionPlotSetup the axis. This is called before paintPlot. Ensures axis are correct values- Specified by:
 setupAxisin interfaceDetectionPlot<D extends PamDataUnit>- Overrides:
 setupAxisin classFFTPlot<D extends PamDataUnit>- Parameters:
 pamDetection- - the data of every channel. e.g. might be a waveform with each point representing a sample.sR- - the sample rate. Primarily used to convert bins into time values.
 - 
setUpTimeAxis
Description copied from class:FFTPlotSetup the time axis within the given duration.- Overrides:
 setUpTimeAxisin classFFTPlot<D extends PamDataUnit>- Parameters:
 millisDuration-
 - 
repaintSpectrogram
public void repaintSpectrogram(long dataStart) Repaint the spectrogram- Parameters:
 dataStart-
 - 
paintSpecImage
protected void paintSpecImage(javafx.scene.canvas.GraphicsContext graphicsContext, javafx.scene.shape.Rectangle windowRect, DetectionPlotProjector projector) Paint the image.- Parameters:
 graphicsContext- - the graphicsContextrectangle- - the rectanglepamAxis- - the PamAxis[]
 - 
paintDetections
public abstract void paintDetections(D detection, javafx.scene.canvas.GraphicsContext graphicsContext, javafx.scene.shape.Rectangle windowRect, DetectionPlotProjector projector) Paint the detection over the FFT.- Specified by:
 paintDetectionsin classFFTPlot<D extends PamDataUnit>- Parameters:
 graphicsContext- - the graphics handlewindowRect- - the window rectangle in pixelspamAxis- - the pamAxis whihc are being plotte on.
 - 
loadDataUnitImage
protected void loadDataUnitImage(double[] rawData, float sR, int channel, long dataStart, javafx.concurrent.Task task) Create the image of the spectrogram from FFT data units.- Parameters:
 rawData- - the raw data to calculate spectrogram from.sR- - the sample rate in samples per second.channel- - the channel.dataStart- - the start time of the data in millis.task- - reference to that task loading the image.
 - 
reDrawLastUnit
public void reDrawLastUnit()Repaint the current data unit.- Overrides:
 reDrawLastUnitin classFFTPlot<D extends PamDataUnit>
 - 
settingsChanged
Description copied from class:FFTPlotCalled whenever the settings are changed.- Overrides:
 settingsChangedin classFFTPlot<D extends PamDataUnit>
 - 
checkSettingsChange
Check new settings against old settings to see what might need recalculated. Because the spectrogram is quite processor intensive we want to recalculate as little as possible.- Parameters:
 fftPlotParams- - the new settings which will be set.
 - 
setFFTParams
Set the FFT params.- Overrides:
 setFFTParamsin classFFTPlot<D extends PamDataUnit>- Parameters:
 params- - the params
 - 
getFFTDataBlock
A simple FFT data block- Returns:
 - the SimpleFFTDataBlock
 
 - 
getProjector
Get the projector- Returns:
 - the time projector
 
 - 
getScrollStart
public long getScrollStart()Get scroll start- Returns:
 - the scroll start
 
 - 
getSpectrogram
- Returns:
 - the spectrogram
 
 - 
getRawDataOrder
 - 
setRawDataOrder
 - 
getSpectrogram
Description copied from class:FFTPlotGet the spectrogram image from the data unit.- Specified by:
 getSpectrogramin classFFTPlot<D extends PamDataUnit>- Parameters:
 pamDetection- - the spectrogram image.- Returns:
 - the spectrogram image.
 
 
 -