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

public abstract class RawFFTPlot<D extends PamDataUnit> extends FFTPlot<D>
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
  • 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>
      Overrides:
      getName in class FFTPlot<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: DetectionPlot
      Plot the relevent data from a detection.
      Specified by:
      paintPlot in interface DetectionPlot<D extends PamDataUnit>
      Overrides:
      paintPlot in class FFTPlot<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

      public void loadRawData(D dataUnit, double padding, int plotChannel)
      Load the raw data. This can be overridden if necessary.
      Parameters:
      dataUnit - - the data unit to load
      padding - - the padding.
      plotChannel - - the plot channel.
    • 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>
      Overrides:
      setupAxis in class FFTPlot<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)
      Description copied from class: FFTPlot
      Setup the time axis within the given duration.
      Overrides:
      setUpTimeAxis in class FFTPlot<D extends PamDataUnit>
    • repaintSpectrogram

      public void repaintSpectrogram(long dataStart)
      Repaint the spectrogram
      Parameters:
      dataStart -
    • 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:
      paintDetections in class FFTPlot<D extends PamDataUnit>
      Parameters:
      graphicsContext - - the graphics handle
      windowRect - - the window rectangle in pixels
      pamAxis - - the pamAxis whihc are being plotte on.
    • reDrawLastUnit

      public void reDrawLastUnit()
      Repaint the current data unit.
      Overrides:
      reDrawLastUnit in class FFTPlot<D extends PamDataUnit>
    • settingsChanged

      public void settingsChanged(FFTPlotParams fftPlotParams)
      Description copied from class: FFTPlot
      Called whenever the settings are changed.
      Overrides:
      settingsChanged in class FFTPlot<D extends PamDataUnit>
    • checkSettingsChange

      public void checkSettingsChange(FFTPlotParams fftPlotParams)
      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

      public void setFFTParams(FFTPlotParams fftPlotParams)
      Set the FFT params.
      Overrides:
      setFFTParams in class FFTPlot<D extends PamDataUnit>
      Parameters:
      params - - the params
    • getFFTDataBlock

      public RawFFTPlot<D>.SimpleFFTDataBlock getFFTDataBlock()
      A simple FFT data block
      Returns:
      the SimpleFFTDataBlock
    • getProjector

      public TimeProjectorFX getProjector()
      Get the projector
      Returns:
      the time projector
    • getScrollStart

      public long getScrollStart()
      Get scroll start
      Returns:
      the scroll start
    • getSpectrogram

      public Scrolling2DPlotDataFX getSpectrogram()
      Returns:
      the spectrogram
    • getRawDataOrder

      public RawDataOrder getRawDataOrder()
    • setRawDataOrder

      public void setRawDataOrder(RawDataOrder rawDataOrder)
    • getSpectrogram

      public double[][] getSpectrogram(D pamDetection, int fftLen, int fftHop, int windowType)
      Description copied from class: FFTPlot
      Get the spectrogram image from the data unit.
      Specified by:
      getSpectrogram in class FFTPlot<D extends PamDataUnit>
      Parameters:
      pamDetection - - the spectrogram image.
      Returns:
      the spectrogram image.