Updates to the PAMGuardFX launcher

This commit is contained in:
Jamie Mac 2024-08-12 17:01:36 +01:00
parent f5f448cb88
commit 984a37235e
4 changed files with 95 additions and 122 deletions

View File

@ -1,114 +0,0 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!-- Created with Inkscape (http://www.inkscape.org/) -->
<svg
width="150mm"
height="150mm"
viewBox="0 0 150 150"
version="1.1"
id="svg5"
inkscape:version="1.2.2 (732a01da63, 2022-12-09)"
sodipodi:docname="logo01.svg"
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
xmlns="http://www.w3.org/2000/svg"
xmlns:svg="http://www.w3.org/2000/svg">
<sodipodi:namedview
id="namedview7"
pagecolor="#ffffff"
bordercolor="#000000"
borderopacity="0.25"
inkscape:showpageshadow="2"
inkscape:pageopacity="0.0"
inkscape:pagecheckerboard="0"
inkscape:deskcolor="#d1d1d1"
inkscape:document-units="mm"
showgrid="false"
inkscape:zoom="0.74564394"
inkscape:cx="379.53772"
inkscape:cy="512.97943"
inkscape:window-width="1242"
inkscape:window-height="1008"
inkscape:window-x="649"
inkscape:window-y="0"
inkscape:window-maximized="0"
inkscape:current-layer="layer1" />
<defs
id="defs2">
<inkscape:path-effect
effect="bspline"
id="path-effect3117"
is_visible="true"
lpeversion="1"
weight="33.333333"
steps="2"
helper_size="0"
apply_no_weight="true"
apply_with_weight="true"
only_selected="false" />
<inkscape:path-effect
effect="bspline"
id="path-effect3117-7"
is_visible="true"
lpeversion="1"
weight="33.333333"
steps="2"
helper_size="0"
apply_no_weight="true"
apply_with_weight="true"
only_selected="false" />
<inkscape:path-effect
effect="bspline"
id="path-effect3117-6"
is_visible="true"
lpeversion="1"
weight="33.333333"
steps="2"
helper_size="0"
apply_no_weight="true"
apply_with_weight="true"
only_selected="false" />
</defs>
<g
inkscape:label="Layer 1"
inkscape:groupmode="layer"
id="layer1">
<text
xml:space="preserve"
style="font-size:3.175px;fill:#000000;stroke-width:0.264583"
x="11.709678"
y="81.967743"
id="text113"><tspan
sodipodi:role="line"
id="tspan111"
style="font-style:normal;font-variant:normal;font-weight:300;font-stretch:normal;font-size:25.4px;font-family:Calibri;-inkscape-font-specification:'Calibri, Light';font-variant-ligatures:normal;font-variant-caps:normal;font-variant-numeric:normal;font-variant-east-asian:normal;stroke-width:0.264583"
x="11.709678"
y="81.967743"><tspan
style="fill:#6f916f"
id="tspan167">delphin</tspan><tspan
style="font-style:normal;font-variant:normal;font-weight:bold;font-stretch:normal;font-size:25.4px;font-family:Calibri;-inkscape-font-specification:'Calibri, Bold';font-variant-ligatures:normal;font-variant-caps:normal;font-variant-numeric:normal;font-variant-east-asian:normal;fill:#0b2817"
id="tspan165">ID</tspan></tspan></text>
<path
style="fill:#6f916f;stroke-width:0.264583"
d="m 27.322579,38.322579 6.741938,2.838712"
id="path535" />
<path
style="fill:none;stroke:#000000;stroke-width:0.85;stroke-dasharray:none;stroke-opacity:1"
d="m 120.67435,61.080456 c 1.55411,1.367612 3.10801,2.735039 4.219,4.735608 1.11098,2.00057 1.77914,4.634082 1.8024,7.356282 0.0232,2.7222 -0.5983,5.53298 -1.65497,7.685367 -1.05667,2.152388 -2.5484,3.646416 -4.0401,5.140414"
id="path3115"
inkscape:path-effect="#path-effect3117"
inkscape:original-d="m 120.67435,61.080456 c 1.55406,1.367671 3.10796,2.735101 4.66173,4.102301 0.66832,2.63386 1.33649,5.26737 2.00453,7.90072 -0.62143,2.81111 -1.24298,5.62189 -1.86469,8.43252 -1.49163,1.49428 -2.98336,2.98831 -4.47524,4.48213" />
<path
style="fill:none;stroke:#000000;stroke-width:0.85;stroke-dasharray:none;stroke-opacity:1"
d="m 115.99401,66.369877 c 0.93292,0.812059 1.86573,1.624027 2.53264,2.81193 0.66692,1.187903 1.06802,2.751664 1.08197,4.368074 0.014,1.61641 -0.35915,3.285393 -0.99347,4.563459 -0.63431,1.278066 -1.52976,2.165182 -2.42524,3.052317"
id="path3115-4"
inkscape:path-effect="#path-effect3117-6"
inkscape:original-d="m 115.99401,66.369877 c 0.93289,0.81209 1.8657,1.62406 2.79841,2.43588 0.4012,1.56394 0.8023,3.1277 1.20331,4.69134 -0.37304,1.66922 -0.74616,3.3382 -1.11936,5.00712 -0.89543,0.88729 -1.79089,1.7744 -2.68646,2.66144" />
<path
style="fill:none;stroke:#000000;stroke-width:0.85;stroke-dasharray:none;stroke-opacity:1"
d="m 125.65039,55.168033 c 2.46165,2.066818 4.923,4.133391 6.68278,7.156798 1.75977,3.023407 2.81814,7.003389 2.85497,11.117374 0.0368,4.113986 -0.9477,8.361845 -2.62144,11.614689 -1.67374,3.252844 -4.03659,5.51072 -6.39943,7.768583"
id="path3115-8"
inkscape:path-effect="#path-effect3117-7"
inkscape:original-d="m 125.65039,55.168033 c 2.46157,2.06691 4.92292,4.133487 7.38405,6.199707 1.05862,3.980467 2.11699,7.960447 3.17515,11.940157 -0.98434,4.24836 -1.96886,8.49622 -2.95363,12.74383 -2.36272,2.2583 -4.72558,4.51617 -7.08869,6.77375" />
</g>
</svg>

Before

Width:  |  Height:  |  Size: 5.2 KiB

View File

@ -1,26 +1,102 @@
package pamViewFX;
import java.net.MalformedURLException;
import java.net.URL;
import java.nio.file.Path;
import java.nio.file.Paths;
import atlantafx.base.controls.ToggleSwitch;
import atlantafx.base.theme.PrimerDark;
import atlantafx.base.theme.PrimerLight;
import javafx.application.Application;
import javafx.application.Platform;
import javafx.geometry.Insets;
import javafx.geometry.Pos;
import javafx.scene.control.ContentDisplay;
import javafx.scene.image.Image;
import javafx.scene.image.ImageView;
import javafx.scene.layout.BorderPane;
import javafx.scene.layout.HBox;
import pamViewFX.fxNodes.PamBorderPane;
import pamViewFX.fxNodes.PamButton;
import pamViewFX.fxNodes.utilityPanes.PamToggleSwitch;
import pamViewFX.fxStyles.PamAtlantaStyle;
import pamViewFX.fxStyles.PamDefaultStyle;
import pamViewFX.fxStyles.PamStylesManagerFX;
/**
* Shows a launcher pane which allows a user to open a real time or viewer configuration.
*/
public class PamLauncherPane extends PamBorderPane {
public static final double BUTTON_SIZE = 120;
public PamLauncherPane() {
PamButton buttonNormal = new PamButton("Real time");
buttonNormal.setGraphic(buttonNormal);
buttonNormal.setPrefSize(BUTTON_SIZE, BUTTON_SIZE);
PamButton buttonViewer = new PamButton("Post processing");
buttonViewer.setPrefSize(BUTTON_SIZE, BUTTON_SIZE);
Image img = new Image("./src/Resources/pamguardIcon.png");
Path pathNormal = Paths.get("./src/Resources/pamguardIcon.png");
Path pathViewer = Paths.get("./src/Resources/pamguardIconV.png");
Image img;
//create the normal mode button
try {
img = new Image(pathNormal.toUri().toURL().toExternalForm());
ImageView view = new ImageView(img);
buttonNormal.setGraphic(view);
} catch (MalformedURLException e) {
e.printStackTrace();
}
buttonNormal.setContentDisplay(ContentDisplay.TOP);
//create the viewer mode button
try {
img = new Image(pathViewer.toUri().toURL().toExternalForm());
ImageView view = new ImageView(img);
buttonViewer.setGraphic(view);
} catch (MalformedURLException e) {
e.printStackTrace();
}
buttonViewer.setContentDisplay(ContentDisplay.TOP);
HBox butttonBox = new HBox();
butttonBox.setSpacing(40);
butttonBox.setPadding(new Insets(40,40,40,40));
butttonBox.getChildren().addAll(buttonNormal, buttonViewer);
PamToggleSwitch newVersionSwitch = new PamToggleSwitch("PAMGuardFX");
newVersionSwitch.selectedProperty().addListener((obsVal, oldVal, newVal)->{
this.getStylesheets().clear();
if (newVal) {
//this.getStylesheets().add(new PrimerDark().getUserAgentStylesheet());
// Platform.runLater(()->{
// Application.setUserAgentStylesheet(new PrimerDark().getUserAgentStylesheet());
// });
PamStylesManagerFX.getPamStylesManagerFX().setCurStyle(new PamAtlantaStyle());
this.getStylesheets().addAll(PamStylesManagerFX.getPamStylesManagerFX().getCurStyle().getDialogCSS());
this.setStyle("-fx-background-color: -fx-darkbackground");
}
});
BorderPane.setAlignment(newVersionSwitch, Pos.CENTER_RIGHT);
newVersionSwitch.setAlignment(Pos.CENTER_RIGHT);
this.setTop(newVersionSwitch);
this.setCenter(butttonBox);
this.setPadding(new Insets(5,5,5,5));
// Application.setUserAgentStylesheet(new PrimerDark().getUserAgentStylesheet());
// this.getStylesheets().add(getClass().getResource(primerPAMGuard).toExternalForm());
// this.getStylesheets().add(getClass().getResource(new PrimerDark().getUserAgentStylesheet()).toExternalForm());
PamStylesManagerFX.getPamStylesManagerFX().setCurStyle(new PamDefaultStyle());
this.setLeft(buttonNormal);
}

View File

@ -129,7 +129,7 @@ public class DLDataSelector extends AnnotationDataSelector<DLAnnotation> {
@Override
public double scoreData(PamDataUnit pamDataUnit) {
int score = dataFilters.get(dlDataSelectParams.dataSelectorIndex).scoreDLData(pamDataUnit);
return score>=0 ? 1 : 0;
return score;
}
@Override

View File

@ -41,6 +41,17 @@ public class DLPredictionFilter implements DLDataFilter {
@Override
public int scoreDLData(PamDataUnit dataUnit) {
int maxIndex = getHighestIndex( dataUnit);
return maxIndex>=0 ? 1 : 0;
}
/**
* Get the index of the class with the highest score and which passes a minimum prediction value.
* @param dataUnit - the data unit to find the highest class for.
* @return the index of the class with the highest score that is greater than the min class prediction. -1 if there is no class that passes prediction.
*/
private int getHighestIndex(PamDataUnit dataUnit) {
DLAnnotation annotation = (DLAnnotation) dataUnit. findDataAnnotation(DLAnnotation.class) ;