Package detectionPlotFX.plots
Class FFTPlot<D extends PamDataUnit>
java.lang.Object
detectionPlotFX.plots.FFTPlot<D>
- Type Parameters:
D
- - the detection type.
- All Implemented Interfaces:
DetectionPlot<D>
- Direct Known Subclasses:
RawFFTPlot
,RawHolderFFTPlot
Plots the spectrogram of a detection which already has a calculated spectrgram, e.g. a a RawDataHolder.
Note that this is not particularly suitable for data that needs to load raw data from sound files. Use RawFFTPlot instead for this functionality.
- Author:
- Jamie Macaulay
-
Nested Class Summary
Nested Classes -
Field Summary
FieldsModifier and TypeFieldDescriptionprotected DetectionPlotDisplay
Reference to the detection plot display.protected FFTPlotParams
The FFT parameters.protected D
The last data unit which has been plotted.protected StandardPlot2DColours
The spectrogram coloursprotected RawFFTPlot.FreqTimeProjector
The time frequency projectorFields inherited from interface detectionPlotFX.layout.DetectionPlot
SCROLLPANE_DRAW, STANDARD_DRAW
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionCreate plot paramters for the FFT plot paramsprotected FFTSettingsPane
<?> Create the FFT settings pane.protected void
drawClipSpectrogram
(D pamDetection, int fftLength, int fftHop, int windowType, double clipLevel, javafx.scene.image.WritableImage writableImage) Draw a spectrogram of a detection onto a writeable image.void
enableTimeSpinner
(boolean enable) Enable the time buffer spinner.Get the FFT plot params.getName()
Get the name of the plot e.g.javafx.scene.layout.Pane
Get the settings pane for the particular plot.abstract double[][]
getSpectrogram
(D pamDetection, int fftSize, int fftHop, int windowType) Get the spectrogram image from the data unit.boolean
isUseKHz()
abstract void
paintDetections
(D detection, javafx.scene.canvas.GraphicsContext graphicsContext, javafx.scene.shape.Rectangle windowRect, DetectionPlotProjector projector) Paint the detection over the FFT.void
paintPlot
(D pamDetection, javafx.scene.canvas.GraphicsContext gc, javafx.scene.shape.Rectangle rectangle, DetectionPlotProjector projector, int flag) Plot the relevent data from a detection.void
Repaint the current data unit.void
setFFTParams
(FFTPlotParams fftPlotParams) Set the FFT params.void
settingsChanged
(FFTPlotParams fftPlotParams) Called whenever the settings are changed.void
setupAxis
(D pamDetection, double sR, DetectionPlotProjector projector) Setup the axis.void
setupFreqAxis
(double minFreq, double maxFreq, DetectionPlotProjector projector) Set up the frequency axisvoid
Setup the plot.void
setUpTimeAxis
(double millisDuration, DetectionPlotProjector plotProjector) Setup the time axis within the given duration.
-
Field Details
-
detectionPlotDisplay
Reference to the detection plot display. -
lastData
The last data unit which has been plotted. -
timeFreqProjector
The time frequency projector -
spectrogramColours
The spectrogram colours -
fftParams
The FFT parameters.
-
-
Constructor Details
-
FFTPlot
-
-
Method Details
-
getName
Description copied from interface:DetectionPlot
Get the name of the plot e.g. waveform, spectrum etc.- Specified by:
getName
in interfaceDetectionPlot<D extends PamDataUnit>
-
setupPlot
public void setupPlot()Description copied from interface:DetectionPlot
Setup the plot. This may, for example, involve changing axis etc.- Specified by:
setupPlot
in interfaceDetectionPlot<D extends PamDataUnit>
-
setupAxis
Description copied from interface:DetectionPlot
Setup the axis. This is called before paintPlot. Ensures axis are correct values- Specified by:
setupAxis
in interfaceDetectionPlot<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
Setup the time axis within the given duration.- Parameters:
millisDuration
-southAxis
-
-
setupFreqAxis
Set up the frequency axis- Parameters:
minFreq
-maxFreq
-freqAxis
-
-
paintPlot
public void paintPlot(D pamDetection, javafx.scene.canvas.GraphicsContext gc, javafx.scene.shape.Rectangle rectangle, DetectionPlotProjector projector, int flag) Description copied from interface:DetectionPlot
Plot the relevent data from a detection.- Specified by:
paintPlot
in interfaceDetectionPlot<D extends PamDataUnit>
- Parameters:
pamDetection
- - the data of every channel. e.g. might be a waveform with each point representing a sample.gc
- - the graphics handle to draw on.
-
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.- Parameters:
graphicsContext
- - the graphics handlewindowRect
- - the window rectangle in pixelspamAxis
- - the pamAxis whihc are being plotte on.
-
getSpectrogram
Get the spectrogram image from the data unit.- Parameters:
pamDetection
- - the spectrogram image.- Returns:
- the spectrogram image.
-
drawClipSpectrogram
protected void drawClipSpectrogram(D pamDetection, int fftLength, int fftHop, int windowType, double clipLevel, javafx.scene.image.WritableImage writableImage) Draw a spectrogram of a detection onto a writeable image.- Parameters:
g
- - the graphics handlespectrum
- - the click spectrum in FFT bins.tC
- -the time in pixelsthe
- clip level - add the clip level. Note that we add the clip level because it is one number that takes the voltage range into accounttdProjector
- - the projector
-
createSettingsPane
Create the FFT settings pane.- Returns:
- the FFT settings pane.
-
enableTimeSpinner
public void enableTimeSpinner(boolean enable) Enable the time buffer spinner.- Parameters:
enable
- - true to enable
-
settingsChanged
Called whenever the settings are changed. -
getSettingsPane
public javafx.scene.layout.Pane getSettingsPane()Description copied from interface:DetectionPlot
Get the settings pane for the particular plot. This sits on the right hand side of the display inside a hiding pane.- Specified by:
getSettingsPane
in interfaceDetectionPlot<D extends PamDataUnit>
- Returns:
- a pane with controls for changing settings in a node.
-
createPlotParams
Create plot paramters for the FFT plot params- Returns:
-
reDrawLastUnit
public void reDrawLastUnit()Repaint the current data unit. -
setFFTParams
Set the FFT params.- Parameters:
params
- - the params
-
getFFTParams
Get the FFT plot params.- Returns:
- the fft plot params.
-
isUseKHz
public boolean isUseKHz()
-