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

public abstract class FFTPlot<D extends PamDataUnit> extends Object implements DetectionPlot<D>
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
  • Constructor Details

  • Method Details

    • getName

      public String getName()
      Description copied from interface: DetectionPlot
      Get the name of the plot e.g. waveform, spectrum etc.
      Specified by:
      getName in interface DetectionPlot<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 interface DetectionPlot<D extends PamDataUnit>
    • setupAxis

      public void setupAxis(D pamDetection, double sR, DetectionPlotProjector projector)
      Description copied from interface: DetectionPlot
      Setup the axis. This is called before paintPlot. Ensures axis are correct values
      Specified by:
      setupAxis in interface DetectionPlot<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

      public void setUpTimeAxis(double millisDuration, DetectionPlotProjector plotProjector)
      Setup the time axis within the given duration.
      Parameters:
      millisDuration -
      southAxis -
    • setupFreqAxis

      public void setupFreqAxis(double minFreq, double maxFreq, DetectionPlotProjector projector)
      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 interface DetectionPlot<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 handle
      windowRect - - the window rectangle in pixels
      pamAxis - - the pamAxis whihc are being plotte on.
    • getSpectrogram

      public abstract double[][] getSpectrogram(D pamDetection, int fftSize, int fftHop, int windowType)
      Get the spectrogram image from the data unit.
      Parameters:
      pamDetection - - the spectrogram image.
      Returns:
      the spectrogram image.
    • enableTimeSpinner

      public void enableTimeSpinner(boolean enable)
      Enable the time buffer spinner.
      Parameters:
      enable - - true to enable
    • settingsChanged

      public void settingsChanged(FFTPlotParams fftPlotParams)
      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 interface DetectionPlot<D extends PamDataUnit>
      Returns:
      a pane with controls for changing settings in a node.
    • createPlotParams

      public FFTPlotParams createPlotParams()
      Create plot paramters for the FFT plot params
      Returns:
    • reDrawLastUnit

      public void reDrawLastUnit()
      Repaint the current data unit.
    • setFFTParams

      public void setFFTParams(FFTPlotParams fftPlotParams)
      Set the FFT params.
      Parameters:
      params - - the params
    • getFFTParams

      public FFTPlotParams getFFTParams()
      Get the FFT plot params.
      Returns:
      the fft plot params.
    • isUseKHz

      public boolean isUseKHz()