Package detectionPlotFX.plots
Class WaveformPlot<D extends PamDataUnit>
java.lang.Object
detectionPlotFX.plots.WaveformPlot<D>
- All Implemented Interfaces:
DetectionPlot<D>
- Direct Known Subclasses:
CTWaveformPlot
,MTClassifierPane.RawDataPlot
,RawWaveformPlot
public abstract class WaveformPlot<D extends PamDataUnit>
extends Object
implements DetectionPlot<D>
Functions to plot a waveform on a plot panel.
- Author:
- Jamie Macaulay
-
Field Summary
Fields inherited from interface detectionPlotFX.layout.DetectionPlot
SCROLLPANE_DRAW, STANDARD_DRAW
-
Constructor Summary
ConstructorDescriptionWaveformPlot
(DetectionPlotDisplay detectionPlotDisplay) Constructor for the waveform plot. -
Method Summary
Modifier and TypeMethodDescriptionabstract double[][]
getEnvelope
(D pamDetection) Get the hilbert transform for each click from a PamDetectiondouble
Get the sample rate in samples per second of the last data unit.Get the scale infojavafx.scene.layout.Pane
Get the settings pane for the particular plot.abstract double[][]
getWaveform
(D pamDetection) Get the waveforms from a PamDetectionGet the waveform plot params.Get the waveform settings pane.static int
getYScale
(double[][] waveform) Get the yscale for plotting the waveform.void
paintPlot
(D pamDetection, javafx.scene.canvas.GraphicsContext gc, javafx.scene.shape.Rectangle rectangle, DetectionPlotProjector plotProjector, int flag) Paint the waveform on the canvas.static void
paintWaveform
(double[][] waveform, int channelBitMap, javafx.scene.canvas.GraphicsContext g, javafx.scene.shape.Rectangle clipRect, int minbin, int maxbin, double yScaleInfo, javafx.scene.paint.Color color, boolean singlePlot, boolean invert) Paint the waveform onto a graphics handle.void
paintWaveform
(double[][] waveform, javafx.scene.canvas.GraphicsContext g, javafx.scene.shape.Rectangle clipRect, DetectionPlotProjector projector, javafx.scene.paint.Color color) Paint the waveform.void
Repaint the current data unit.void
setShowChannels
(boolean show) Set the plot to show channels.void
setupAxis
(D pamDetection, double sR, DetectionPlotProjector plotProjector) Called to set up the axis correctly before the plot is createdvoid
Setup the plot.Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface detectionPlotFX.layout.DetectionPlot
getName
-
Constructor Details
-
WaveformPlot
Constructor for the waveform plot.
-
-
Method Details
-
getDetectionPlotDisplay
-
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
Called to set up the axis correctly before the plot is created- 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.waveform
- - the waveforms of every channel. Each point represents one sample.pamAxis
- - all the axis of the graph. this is in order TOP, RIGHT, BOTTOM, LEFT.
-
paintPlot
public void paintPlot(D pamDetection, javafx.scene.canvas.GraphicsContext gc, javafx.scene.shape.Rectangle rectangle, DetectionPlotProjector plotProjector, int flag) Paint the waveform on the canvas.- 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.waveform
- - the waveforms of every channel. Each point represents one sample.graphicsContext
- - the graphics handle to draw on.pamAxis
- - the PamAxis for the plot, x and y axis (time and some measure of amplitude. )
-
getYScale
public static int getYScale(double[][] waveform) Get the yscale for plotting the waveform.- Parameters:
waveform
-- Returns:
-
getWaveform
Get the waveforms from a PamDetection- Parameters:
pamDetection
- the detection- Returns:
- the waveform for each channel
-
getEnvelope
Get the hilbert transform for each click from a PamDetection- Parameters:
pamDetection
- the detection- Returns:
- the waveform for each channel
-
paintWaveform
public void paintWaveform(double[][] waveform, javafx.scene.canvas.GraphicsContext g, javafx.scene.shape.Rectangle clipRect, DetectionPlotProjector projector, javafx.scene.paint.Color color) Paint the waveform.- Parameters:
waveform
- - the waveformg
- - the graphics context.clipRect
-projector
-color
-
-
paintWaveform
public static void paintWaveform(double[][] waveform, int channelBitMap, javafx.scene.canvas.GraphicsContext g, javafx.scene.shape.Rectangle clipRect, int minbin, int maxbin, double yScaleInfo, javafx.scene.paint.Color color, boolean singlePlot, boolean invert) Paint the waveform onto a graphics handle. The plot projector should be in samples.- Parameters:
waveform
- - the waveform to paint.g
- - the graphics handleclipRect
- - the clip rminbin
- - the minimum waveform bin to paintmaxbin
- - the maximum waveform bin to paintcolor
- - the colour to pain as. If null then painted in standard PAM colours.invert
- - true to invert the waveform. i.e. paint upside downcurrentDetection
- - the current data unit.
-
getScaleInfo
Get the scale info- Returns:
- the scale info.
-
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.
-
getWaveformSettingsPane
Get the waveform settings pane.- Returns:
- - the waveform settings pane.
-
getWaveformPlotParams
Get the waveform plot params.- Returns:
- the waveform plot.
-
reDrawLastUnit
public void reDrawLastUnit()Repaint the current data unit. -
getSampleRate
public double getSampleRate()Get the sample rate in samples per second of the last data unit.- Returns:
- the sample rate in samples per second.
-
setShowChannels
public void setShowChannels(boolean show) Set the plot to show channels.- Parameters:
show
- - true to show channels
-