Class RoccaSpecPopUp
- All Implemented Interfaces:
ImageObserver
,MenuContainer
,Serializable
,Accessible
- Author:
- Michael Oswald
- See Also:
-
Nested Class Summary
Nested classes/interfaces inherited from class javax.swing.JComponent
JComponent.AccessibleJComponent
Nested classes/interfaces inherited from class java.awt.Component
Component.BaselineResizeBehavior
-
Field Summary
Modifier and TypeFieldDescriptionstatic final int
static final boolean
constant indicating the contour should be turned offstatic final boolean
constant indicating the contour should be turned onstatic final boolean
constant indicating the getXPosition or getYPosition method should return a floatstatic final boolean
constant indicating the getXPosition or getYPosition method should return an intFields inherited from class javax.swing.JComponent
TOOL_TIP_TEXT_KEY, UNDEFINED_CONDITION, WHEN_ANCESTOR_OF_FOCUSED_COMPONENT, WHEN_FOCUSED, WHEN_IN_FOCUSED_WINDOW
Fields inherited from class java.awt.Component
BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT
Fields inherited from interface java.awt.image.ImageObserver
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH
-
Constructor Summary
ConstructorDescriptionRoccaSpecPopUp
(double[][] d, String title) Dummy constructor - only used to test displayRoccaSpecPopUp
(RoccaProcess roccaProcess, FFTDataBlock fftDataBlock, double boxBotFreq, double boxTopFreq, PamRawDataBlock rawData, SpectrogramDisplay display, int channel) -
Method Summary
Modifier and TypeMethodDescriptionPoint[]
boolean
double[][]
getData()
getDataBlockFilename
(RoccaContourDataBlock rcdb, String ext) Generates a filename for the wav clip and the csv file containing the contour points, based on the filename template stored in RoccaParametersdouble[]
double
double
static int
long[]
static void
static void
Method for testing RoccaSpecPopUpvoid
run()
Launch this RoccaSpecPopUp in its own JFrame.boolean
Saves the contour points in the datablock in a csv file.boolean
Saves all contour stats to the contour stats summary file, as defined in the Rocca Parameters.void
Sets the initial position of the vertical scrollbar to center the user- selected area in the display windowstatic void
setNumDetections
(int numDetections) boolean
boolean
Methods inherited from class javax.swing.JPanel
getAccessibleContext, getUI, getUIClassID, setUI, updateUI
Methods inherited from class javax.swing.JComponent
addAncestorListener, addNotify, addVetoableChangeListener, computeVisibleRect, contains, createToolTip, disable, enable, firePropertyChange, firePropertyChange, firePropertyChange, getActionForKeyStroke, getActionMap, getAlignmentX, getAlignmentY, getAncestorListeners, getAutoscrolls, getBaseline, getBaselineResizeBehavior, getBorder, getBounds, getClientProperty, getComponentPopupMenu, getConditionForKeyStroke, getDebugGraphicsOptions, getDefaultLocale, getFontMetrics, getGraphics, getHeight, getInheritsPopupMenu, getInputMap, getInputMap, getInputVerifier, getInsets, getInsets, getListeners, getLocation, getMaximumSize, getMinimumSize, getNextFocusableComponent, getPopupLocation, getPreferredSize, getRegisteredKeyStrokes, getRootPane, getSize, getToolTipLocation, getToolTipText, getToolTipText, getTopLevelAncestor, getTransferHandler, getVerifyInputWhenFocusTarget, getVetoableChangeListeners, getVisibleRect, getWidth, getX, getY, grabFocus, hide, isDoubleBuffered, isLightweightComponent, isManagingFocus, isOpaque, isOptimizedDrawingEnabled, isPaintingForPrint, isPaintingTile, isRequestFocusEnabled, isValidateRoot, paint, paintImmediately, paintImmediately, print, printAll, putClientProperty, registerKeyboardAction, registerKeyboardAction, removeAncestorListener, removeNotify, removeVetoableChangeListener, repaint, repaint, requestDefaultFocus, requestFocus, requestFocus, requestFocusInWindow, resetKeyboardActions, reshape, revalidate, scrollRectToVisible, setActionMap, setAlignmentX, setAlignmentY, setAutoscrolls, setBackground, setBorder, setComponentPopupMenu, setDebugGraphicsOptions, setDefaultLocale, setDoubleBuffered, setEnabled, setFocusTraversalKeys, setFont, setForeground, setInheritsPopupMenu, setInputMap, setInputVerifier, setMaximumSize, setMinimumSize, setNextFocusableComponent, setOpaque, setPreferredSize, setRequestFocusEnabled, setToolTipText, setTransferHandler, setVerifyInputWhenFocusTarget, setVisible, unregisterKeyboardAction, update
Methods inherited from class java.awt.Container
add, add, add, add, add, addContainerListener, addPropertyChangeListener, addPropertyChangeListener, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getComponentZOrder, getContainerListeners, getFocusTraversalKeys, getFocusTraversalPolicy, getLayout, getMousePosition, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusCycleRoot, isFocusTraversalPolicyProvider, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paintComponents, preferredSize, printComponents, remove, remove, removeAll, removeContainerListener, setComponentZOrder, setFocusCycleRoot, setFocusTraversalPolicy, setFocusTraversalPolicyProvider, setLayout, transferFocusDownCycle, validate
Methods inherited from class java.awt.Component
action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, bounds, checkImage, checkImage, contains, createImage, createImage, createVolatileImage, createVolatileImage, dispatchEvent, enable, enableInputMethods, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getBackground, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusCycleRootAncestor, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getForeground, getGraphicsConfiguration, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputContext, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocale, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMousePosition, getMouseWheelListeners, getName, getParent, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getToolkit, getTreeLock, gotFocus, handleEvent, hasFocus, imageUpdate, inside, isBackgroundSet, isCursorSet, isDisplayable, isEnabled, isFocusable, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isMaximumSizeSet, isMinimumSizeSet, isPreferredSizeSet, isShowing, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, postEvent, prepareImage, prepareImage, remove, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, requestFocus, requestFocusInWindow, resize, resize, setBounds, setBounds, setComponentOrientation, setCursor, setDropTarget, setFocusable, setFocusTraversalKeysEnabled, setIgnoreRepaint, setLocale, setLocation, setLocation, setMixingCutoutShape, setName, setSize, setSize, show, show, size, toString, transferFocus, transferFocusBackward, transferFocusUpCycle
-
Field Details
-
AXIS_SIZE
public static final int AXIS_SIZE- See Also:
-
CONTOUROFF
public static final boolean CONTOUROFFconstant indicating the contour should be turned off- See Also:
-
CONTOURON
public static final boolean CONTOURONconstant indicating the contour should be turned on- See Also:
-
RETURNINT
public static final boolean RETURNINTconstant indicating the getXPosition or getYPosition method should return an int- See Also:
-
RETURNFLOAT
public static final boolean RETURNFLOATconstant indicating the getXPosition or getYPosition method should return a float- See Also:
-
-
Constructor Details
-
RoccaSpecPopUp
Dummy constructor - only used to test display- Parameters:
d
-title
-
-
RoccaSpecPopUp
public RoccaSpecPopUp(RoccaProcess roccaProcess, FFTDataBlock fftDataBlock, double boxBotFreq, double boxTopFreq, PamRawDataBlock rawData, SpectrogramDisplay display, int channel) - Parameters:
roccaProcess
-fftDataBlock
-boxBotFreq
-boxTopFreq
-rawData
-display
- the SpectrogramDisplay object that the user drew a box in, or null if it's from a TD Displaychannel
-
-
-
Method Details
-
saveContourPoints
public boolean saveContourPoints()Saves the contour points in the datablock in a csv file. Saves the time and peak frequency of each point, along with the duty cycle, energy, and windows RMSNote that this method has now (as of 2012/08/12) been duplicated in RoccaProcess in order to accommodate data from the Whistle and Moan detector. It should be deleted from RoccaSpecPopUp at some point in the future
- Returns:
- saveContourPoints boolean indicating success or failure
-
getDataBlockFilename
Generates a filename for the wav clip and the csv file containing the contour points, based on the filename template stored in RoccaParameters- Parameters:
rcdb
- The RoccaContourDataBlock containing the data to saveext
- The filename extension (wav or csv)- Returns:
- A File
-
saveContourStats
public boolean saveContourStats()Saves all contour stats to the contour stats summary file, as defined in the Rocca Parameters. If the file does not exist, it is created and a header line is written. If it does exist, data is appended to the end. Each contour is 1 row. Note that the last few columns contain the random forest votes, and so the number of columns depends on how many species are in the classifier. This won't be a problem if the same classifier is always used, but if a different classifier with a different number of species is tried out the number of columns from one row to the next will not match. More importantly, the order of the species from one row to the next might not match and you would never know unless you remember. For this reason, instead of saving the species names as the column headers (which would only be accurate for the classifier selected when the file had been created), the species names are written in the row AFTER the tree votes. The classifier name is also saved, for reference. While this is awkward, at least results from different classifiers can be interpreted properly without having to guess which vote is for which speciesNote that this method has now (as of 2012/08/12) been duplicated in RoccaProcess in order to accommodate data from the Whistle and Moan detector. It should be deleted from RoccaSpecPopUp at some point in the future
- Returns:
- boolean indicating whether or not the save was successful
-
run
public void run()Launch this RoccaSpecPopUp in its own JFrame. -
setInitialPosition
public void setInitialPosition()Sets the initial position of the vertical scrollbar to center the user- selected area in the display window -
showPeaks
public boolean showPeaks() -
getContour
-
getData
public double[][] getData() -
getDragPoint
-
tracingNow
public boolean tracingNow() -
getUserPoints
- Returns:
- the userPoints
-
getContourState
public boolean getContourState() -
getNumDetections
public static int getNumDetections() -
setNumDetections
public static void setNumDetections(int numDetections) -
incNumDetections
public static void incNumDetections() -
getFreqBins
public double[] getFreqBins() -
getTimeBins
public long[] getTimeBins() -
getDataPanel
-
getFreqAxis
-
getHighPassFreq
public double getHighPassFreq() -
getLowPassFreq
public double getLowPassFreq() -
main
Method for testing RoccaSpecPopUpRequires a csv file containing the FFT data to be displayed, with no header. Size of file is hard-coded in the specData variable. Note that this is commented out, along with the Csvreader import, because it was throwing an error when compiled. To use this test, uncomment the reader section and the csvreader import at the top.
-