From 62b4c67e22522932e2afcfd5bc3ccbff530d2ec5 Mon Sep 17 00:00:00 2001 From: voulot_d Date: Tue, 4 Apr 2017 09:26:39 +0200 Subject: [PATCH] Closedown --- devices/CurrentCamera.properties | 6 ++-- plugins/GunScan.form | 33 ++++++++++++++---- plugins/GunScan.java | 19 ++++++---- plugins/SchottkyScan.form | 14 ++++---- plugins/SchottkyScan.java | 14 ++++---- plugins/ScreenPanel.java | 59 +++++++++++++++++++++++++++++--- 6 files changed, 111 insertions(+), 34 deletions(-) diff --git a/devices/CurrentCamera.properties b/devices/CurrentCamera.properties index 5bd091c..80efadb 100644 --- a/devices/CurrentCamera.properties +++ b/devices/CurrentCamera.properties @@ -1,10 +1,10 @@ -#Tue Apr 04 08:55:11 CEST 2017 +#Tue Apr 04 09:20:39 CEST 2017 colormap=Flame colormapAutomatic=false colormapMax=1000.0 colormapMin=10.0 -flipHorizontally=true -flipVertically=true +flipHorizontally=false +flipVertically=false grayscale=false imageHeight=2160 imageWidth=2560 diff --git a/plugins/GunScan.form b/plugins/GunScan.form index 1622638..e67067b 100644 --- a/plugins/GunScan.form +++ b/plugins/GunScan.form @@ -32,7 +32,7 @@ - + @@ -105,7 +105,7 @@ - + @@ -137,7 +137,7 @@ - + @@ -155,6 +155,9 @@ + + + @@ -167,6 +170,9 @@ + + + @@ -179,6 +185,9 @@ + + + @@ -191,6 +200,9 @@ + + + @@ -198,6 +210,9 @@ + + + @@ -225,12 +240,12 @@ - + - + @@ -251,7 +266,7 @@ - + @@ -259,6 +274,9 @@ + + + @@ -271,6 +289,9 @@ + + + diff --git a/plugins/GunScan.java b/plugins/GunScan.java index f67e3fc..9025192 100644 --- a/plugins/GunScan.java +++ b/plugins/GunScan.java @@ -115,20 +115,25 @@ public class GunScan extends Panel { stopLabel.setText("Stop:"); + spinnerStep.setModel(new javax.swing.SpinnerNumberModel(5.0d, 1.0d, 90.0d, 1.0d)); spinnerStep.setPreferredSize(new java.awt.Dimension(53, 20)); stepLabel.setText("Step:"); + spinnerStart.setModel(new javax.swing.SpinnerNumberModel(0.0d, -180.0d, 360.0d, 1.0d)); spinnerStart.setPreferredSize(new java.awt.Dimension(53, 20)); samplesLabel.setText("Nb Samples:"); + spinnerSamples.setModel(new javax.swing.SpinnerNumberModel(1.0d, 1.0d, 50.0d, 1.0d)); spinnerSamples.setPreferredSize(new java.awt.Dimension(53, 20)); latencyLabel.setText("Latency:"); + spinnerLatency.setModel(new javax.swing.SpinnerNumberModel(0.1d, 0.0d, 5.0d, 0.01d)); spinnerLatency.setPreferredSize(new java.awt.Dimension(53, 20)); + spinnerStop.setModel(new javax.swing.SpinnerNumberModel(360.0d, -180.0d, 360.0d, 1.0d)); spinnerStop.setMinimumSize(new java.awt.Dimension(53, 20)); spinnerStop.setPreferredSize(new java.awt.Dimension(53, 20)); @@ -159,7 +164,7 @@ public class GunScan extends Panel { .addComponent(stepLabel) .addGap(2, 2, 2) .addComponent(spinnerStep, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))) - .addContainerGap()) + .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) ); jPanel1Layout.setVerticalGroup( jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) @@ -184,15 +189,17 @@ public class GunScan extends Panel { .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(spinnerLatency, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(latencyLabel)) - .addContainerGap()) + .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) ); jPanel2.setBorder(javax.swing.BorderFactory.createTitledBorder("Beam Parameters")); + spinnerDispersion.setModel(new javax.swing.SpinnerNumberModel(1.0d, 0.0d, 10.0d, 0.01d)); spinnerDispersion.setPreferredSize(new java.awt.Dimension(53, 20)); energyLabel.setText("Energy:"); + spinnerEnergy.setModel(new javax.swing.SpinnerNumberModel(0.0d, 0.0d, 10000.0d, 0.1d)); spinnerEnergy.setPreferredSize(new java.awt.Dimension(53, 20)); dispersionLabel.setText("Dispersion:"); @@ -206,11 +213,11 @@ public class GunScan extends Panel { .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING) .addGroup(jPanel2Layout.createSequentialGroup() .addComponent(energyLabel) - .addGap(2, 2, 2) + .addGap(0, 0, 0) .addComponent(spinnerEnergy, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) .addGroup(jPanel2Layout.createSequentialGroup() .addComponent(dispersionLabel) - .addGap(2, 2, 2) + .addGap(0, 0, 0) .addComponent(spinnerDispersion, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))) .addGap(20, 20, 20)) ); @@ -225,7 +232,7 @@ public class GunScan extends Panel { .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(spinnerEnergy, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(energyLabel)) - .addContainerGap()) + .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) ); plot.setTitle(""); @@ -247,7 +254,7 @@ public class GunScan extends Panel { .addComponent(buttonStart) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addComponent(buttonAbort))) - .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) .addComponent(plot, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addContainerGap()) ); diff --git a/plugins/SchottkyScan.form b/plugins/SchottkyScan.form index 9970d66..bac7a43 100644 --- a/plugins/SchottkyScan.form +++ b/plugins/SchottkyScan.form @@ -24,11 +24,11 @@ - + - + @@ -42,7 +42,7 @@ - + @@ -155,7 +155,7 @@ - + @@ -174,7 +174,7 @@ - + @@ -193,7 +193,7 @@ - + @@ -213,7 +213,7 @@ - + diff --git a/plugins/SchottkyScan.java b/plugins/SchottkyScan.java index 6ad8aa4..5e9ca63 100644 --- a/plugins/SchottkyScan.java +++ b/plugins/SchottkyScan.java @@ -128,7 +128,7 @@ public class SchottkyScan extends Panel { jPanel1.setBorder(javax.swing.BorderFactory.createTitledBorder("Parameters")); - spinnerStep.setModel(new javax.swing.SpinnerNumberModel(5.0d, 0.1d, 90.0d, 1.0d)); + spinnerStep.setModel(new javax.swing.SpinnerNumberModel(5.0d, 1.0d, 90.0d, 1.0d)); jLabel5.setHorizontalAlignment(javax.swing.SwingConstants.TRAILING); jLabel5.setText("Latency:"); @@ -136,7 +136,7 @@ public class SchottkyScan extends Panel { jLabel1.setHorizontalAlignment(javax.swing.SwingConstants.TRAILING); jLabel1.setText("Start:"); - spinnerStop.setModel(new javax.swing.SpinnerNumberModel(360.0d, -45.0d, 360.0d, 1.0d)); + spinnerStop.setModel(new javax.swing.SpinnerNumberModel(180.0d, -180.0d, 360.0d, 1.0d)); jLabel3.setHorizontalAlignment(javax.swing.SwingConstants.TRAILING); jLabel3.setText("Step:"); @@ -144,14 +144,14 @@ public class SchottkyScan extends Panel { jLabel2.setHorizontalAlignment(javax.swing.SwingConstants.TRAILING); jLabel2.setText("Stop:"); - spinnerLatency.setModel(new javax.swing.SpinnerNumberModel(0.1d, 0.0d, 1.0d, 0.01d)); + spinnerLatency.setModel(new javax.swing.SpinnerNumberModel(0.1d, 0.0d, 5.0d, 0.01d)); spinnerSamples.setModel(new javax.swing.SpinnerNumberModel(1, 1, 50, 1)); jLabel4.setHorizontalAlignment(javax.swing.SwingConstants.TRAILING); jLabel4.setText("Nb Samples:"); - spinnerStart.setModel(new javax.swing.SpinnerNumberModel(0.0d, -45.0d, 360.0d, 1.0d)); + spinnerStart.setModel(new javax.swing.SpinnerNumberModel(0.0d, -180.0d, 360.0d, 1.0d)); javax.swing.GroupLayout jPanel1Layout = new javax.swing.GroupLayout(jPanel1); jPanel1.setLayout(jPanel1Layout); @@ -274,10 +274,10 @@ public class SchottkyScan extends Panel { .addComponent(buttonStart) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addComponent(buttonAbort)) - .addComponent(jPanel1, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) + .addComponent(jPanel1, javax.swing.GroupLayout.DEFAULT_SIZE, 179, Short.MAX_VALUE) .addComponent(jPanel2, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) - .addComponent(plot, javax.swing.GroupLayout.DEFAULT_SIZE, 523, Short.MAX_VALUE) + .addComponent(plot, javax.swing.GroupLayout.DEFAULT_SIZE, 522, Short.MAX_VALUE) .addContainerGap()) ); @@ -292,7 +292,7 @@ public class SchottkyScan extends Panel { .addComponent(jPanel1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addComponent(jPanel2, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) - .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 45, Short.MAX_VALUE) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(buttonStart) .addComponent(buttonAbort))) diff --git a/plugins/ScreenPanel.java b/plugins/ScreenPanel.java index 5c9485a..a06d058 100644 --- a/plugins/ScreenPanel.java +++ b/plugins/ScreenPanel.java @@ -626,6 +626,37 @@ public class ScreenPanel extends Panel { return (Boolean) camera.get("roi_enable"); } } + + public static class CameraPars { + + public HashMap parameter; + + public Boolean getBackgroundSubtraction() { + if (parameter.get("background_subtration") == null){ + return false; + } + return (Boolean) parameter.get("background_subtration"); + } + + public ArrayList getRoi() { + return (ArrayList) parameter.get("region_of_interest"); + } + + public Boolean getRoiEnable() { + ArrayList roi = getRoi(); + return ((roi != null) && (roi.size()>=4)); + } + + public HashMap getGoodRegion() { + return (HashMap) parameter.get("good_region"); + } + + public Double getThresholde() { + return (Double) parameter.get("threshold"); + } + + + } Thread devicesInitTask; @@ -694,9 +725,27 @@ public class ScreenPanel extends Panel { if ((cameraConfigJson == null) && (buttonDirect.isSelected())) { throw new Exception("Cannot open camera config file: " + configFile.toFile()); } - + camera = new PsiCamera(CAMERA_DEVICE_NAME, cameraName); config = (CameraConfig) JsonSerializer.decode(cameraConfigJson, CameraConfig.class); + + CameraPars cameraPars = null; + try{ + Path parsFile = Paths.get(CONFIG_FOLDER, cameraName + "_parameters.json"); + if (parsFile.toFile().exists()){ + String cameraParsJson = new String(Files.readAllBytes(parsFile)); + cameraPars = (CameraPars) JsonSerializer.decode(cameraParsJson, CameraPars.class); + boolean roi = cameraPars.getRoiEnable(); + camera.getConfig().roiX = roi ? cameraPars.getRoi().get(0) : 0; + camera.getConfig().roiY = roi ? cameraPars.getRoi().get(2) : 0; + camera.getConfig().roiWidth = roi ? cameraPars.getRoi().get(1) : -1; + camera.getConfig().roiHeight =roi ? cameraPars.getRoi().get(3) : -1; + + } + } catch (Exception ex){ + ex.printStackTrace(); + } + camera.getConfig().flipHorizontally = config.getMirrorX(); camera.getConfig().flipVertically = config.getMirrorY(); //camera.getConfig().rotation = config.getRotate(); @@ -713,10 +762,10 @@ public class ScreenPanel extends Panel { break; } camera.getConfig().rotationCrop = false; - camera.getConfig().roiX = config.getRoiEnable() ? config.getRoi().get(0) : 0; - camera.getConfig().roiY = config.getRoiEnable() ? config.getRoi().get(1) : 0; - camera.getConfig().roiWidth = config.getRoiEnable() ? config.getRoi().get(2) : -1; - camera.getConfig().roiHeight = config.getRoiEnable() ? config.getRoi().get(3) : -1; + //camera.getConfig().roiX = config.getRoiEnable() ? config.getRoi().get(0) : 0; + //camera.getConfig().roiY = config.getRoiEnable() ? config.getRoi().get(1) : 0; + //camera.getConfig().roiWidth = config.getRoiEnable() ? config.getRoi().get(2) : -1; + //camera.getConfig().roiHeight = config.getRoiEnable() ? config.getRoi().get(3) : -1; try { camera.getConfig().spatialCalOffsetX = config.getCalOffsetX(); camera.getConfig().spatialCalOffsetY = config.getCalOffsetY();