diff --git a/.classpath b/.classpath index 6ad8f1d7..576b210a 100644 --- a/.classpath +++ b/.classpath @@ -6,7 +6,7 @@ - + diff --git a/src/rawDeepLearningClassifier/layoutFX/dlTransfroms/DataTransformPaneFactory.java b/src/rawDeepLearningClassifier/layoutFX/dlTransfroms/DataTransformPaneFactory.java index bfc9f559..78b3a937 100644 --- a/src/rawDeepLearningClassifier/layoutFX/dlTransfroms/DataTransformPaneFactory.java +++ b/src/rawDeepLearningClassifier/layoutFX/dlTransfroms/DataTransformPaneFactory.java @@ -66,6 +66,10 @@ public class DataTransformPaneFactory { settingsPane = new FilterTransformPane(dlTransfrom); settingsPane.setParams(dlTransfrom); break; + case PEAK_TRIM: + settingsPane = new PeakTrimTransformPane(dlTransfrom); + settingsPane.setParams(dlTransfrom); + break; case SPEC2DB: // settingsPane = new LabelTransfromPane(dlTransfrom, DLTransformType.SPEC2DB.toString()); // settingsPane.setPadding(new Insets(0,0,0,20)); diff --git a/src/rawDeepLearningClassifier/layoutFX/dlTransfroms/PeakTrimTransformPane.java b/src/rawDeepLearningClassifier/layoutFX/dlTransfroms/PeakTrimTransformPane.java new file mode 100644 index 00000000..5a7bdcef --- /dev/null +++ b/src/rawDeepLearningClassifier/layoutFX/dlTransfroms/PeakTrimTransformPane.java @@ -0,0 +1,115 @@ +package rawDeepLearningClassifier.layoutFX.dlTransfroms; + +import org.jamdev.jdl4pam.transforms.DLTransform; +import org.jamdev.jdl4pam.transforms.SimpleTransform; +import org.jamdev.jpamutils.wavFiles.AudioData; +import javafx.geometry.Pos; +import javafx.scene.Node; +import javafx.scene.control.ComboBox; +import javafx.scene.control.Label; +import javafx.scene.control.Spinner; +import javafx.scene.control.TitledPane; +import pamViewFX.fxNodes.PamHBox; +import pamViewFX.fxNodes.utilityPanes.SimpleFilterPaneFX; + +/** + * Pane for a peak search trim transform. + * + * @author Jamie Macaulay + * + */ +public class PeakTrimTransformPane extends DLTransformPane { + + /** + * The transform associated with the settings pane. + */ + private DLTransform simpleTransfrom; + + /** + * Controls for changing peak search settings. + */ + private SimpleFilterPaneFX filterPane; + + /** + * Choice box for changing the type of peak search algorithm + */ + private ComboBox peakSelectionBox; + + /** + * Spinner for changing the target length + */ + private Spinner targetLenSpinner; + + + public PeakTrimTransformPane(DLTransform dlTransfrom) { + super(); + this.simpleTransfrom= dlTransfrom; + this.setCenter(createFilterPane()); +// this.setStyle("-fx-background-color:orangered;"); + + } + + private Node createFilterPane() { + + peakSelectionBox = new ComboBox(); + peakSelectionBox.getItems().add(AudioData.PEAK_MAX, "Max. Peak"); + + peakSelectionBox.valueProperty().addListener((obsVal, oldVal, newVal)->{ + this.notifySettingsListeners(); + }); + + //spinner for changing filter order. + targetLenSpinner = new Spinner(1,50,4,1); + targetLenSpinner.valueProperty().addListener((obsVal, oldVal, newVal)->{ + this.notifySettingsListeners(); + }); + targetLenSpinner.getStyleClass().add(Spinner.STYLE_CLASS_SPLIT_ARROWS_HORIZONTAL); + + PamHBox filterTypeHolder = new PamHBox(); + filterTypeHolder.setSpacing(5); + filterTypeHolder.setAlignment(Pos.CENTER_LEFT); + filterTypeHolder.getChildren().addAll(peakSelectionBox, new Label("Target length"), targetLenSpinner); + + TitledPane titledPane = new TitledPane(simpleTransfrom.getDLTransformType().toString(), filterTypeHolder); + + // PamBorderPane borderPane = new PamBorderPane(); + // borderPane.setTop(new Label(simpleTransfrom.getDLTransformType().toString())); + // borderPane.setCenter(hBox); + + titledPane.setExpanded(false); + + return titledPane; + } + + + @Override + public DLTransform getDLTransform() { + return this.getParams(simpleTransfrom) ; + } + + @Override + public DLTransform getParams(DLTransform dlTransform) { + +// System.out.println("GET PARAMS: FILTER"); + + SimpleTransform simpleTransform = (SimpleTransform) dlTransform; + + simpleTransform.setParams(new Number[]{targetLenSpinner.getValue(), peakSelectionBox.getSelectionModel().getSelectedIndex()}); + + return simpleTransform; + } + + @Override + public void setParams(DLTransform dlTransform) { + +// System.out.println("SET PARAMS: FILTER"); + + SimpleTransform simpleTransform = (SimpleTransform) dlTransform; + + //get the selection model. + peakSelectionBox.getSelectionModel().select(simpleTransform.getParams()[1].intValue()); + targetLenSpinner.getValueFactory().setValue(simpleTransform.getParams()[0].intValue()); + + } + +} diff --git a/src/test/resources/rawDeepLearningClassifier/Generic/risso_click/click_transformed.mat b/src/test/resources/rawDeepLearningClassifier/Generic/risso_click/click_transformed.mat deleted file mode 100644 index 06f2439b..00000000 Binary files a/src/test/resources/rawDeepLearningClassifier/Generic/risso_click/click_transformed.mat and /dev/null differ diff --git a/src/test/resources/rawDeepLearningClassifier/Generic/risso_click/clicks_transformed.mat b/src/test/resources/rawDeepLearningClassifier/Generic/risso_click/clicks_transformed.mat new file mode 100644 index 00000000..852165d5 Binary files /dev/null and b/src/test/resources/rawDeepLearningClassifier/Generic/risso_click/clicks_transformed.mat differ diff --git a/src/test/resources/rawDeepLearningClassifier/Generic/risso_click/clickwave.wav b/src/test/resources/rawDeepLearningClassifier/Generic/risso_click/clickwave_1.wav similarity index 100% rename from src/test/resources/rawDeepLearningClassifier/Generic/risso_click/clickwave.wav rename to src/test/resources/rawDeepLearningClassifier/Generic/risso_click/clickwave_1.wav diff --git a/src/test/resources/rawDeepLearningClassifier/Generic/risso_click/clickwave_4205.wav b/src/test/resources/rawDeepLearningClassifier/Generic/risso_click/clickwave_4205.wav new file mode 100644 index 00000000..779ba074 Binary files /dev/null and b/src/test/resources/rawDeepLearningClassifier/Generic/risso_click/clickwave_4205.wav differ