diff --git a/devices/CurrentCamera.properties b/devices/CurrentCamera.properties
index 790b660..10a5c50 100644
--- a/devices/CurrentCamera.properties
+++ b/devices/CurrentCamera.properties
@@ -1,16 +1,16 @@
-#Tue Jul 11 15:08:20 CEST 2017
-colormap=Flame
-colormapAutomatic=false
-colormapMax=280.0
-colormapMin=77.0
+#Fri Jul 14 10:44:20 CEST 2017
+colormap=Grayscale
+colormapAutomatic=true
+colormapMax=520.0
+colormapMin=204.0
flipHorizontally=false
flipVertically=false
grayscale=false
-imageHeight=1680
-imageWidth=1744
+imageHeight=2160
+imageWidth=2560
invert=false
-regionStartX=433
-regionStartY=241
+regionStartX=1
+regionStartY=1
rescaleFactor=1.0
rescaleOffset=0.0
roiHeight=-1
@@ -21,9 +21,9 @@ rotation=0.0
rotationCrop=false
scale=1.0
serverURL=localhost\:10000
-spatialCalOffsetX=-861.4939970777481
-spatialCalOffsetY=-820.4883730911062
-spatialCalScaleX=-18.90359092620482
-spatialCalScaleY=-19.37984500632817
+spatialCalOffsetX=-606.4867444313851
+spatialCalOffsetY=-602.502078032311
+spatialCalScaleX=-26.714158979668674
+spatialCalScaleY=-27.100271547904505
spatialCalUnits=mm
transpose=false
diff --git a/devices/DLAC motor.properties b/devices/DLAC motor.properties
new file mode 100644
index 0000000..d67d56b
--- /dev/null
+++ b/devices/DLAC motor.properties
@@ -0,0 +1,15 @@
+#Thu Jul 13 13:32:57 CEST 2017
+defaultSpeed=1.0
+estbilizationDelay=0
+hasEnable=false
+homingType=None
+maxSpeed=1.0
+maxValue=346.0
+minSpeed=0.05
+minValue=130.0
+offset=0.0
+precision=5
+resolution=8.0E-4
+rotation=false
+scale=1.0
+unit=mm
diff --git a/devices/DummyMotor.properties b/devices/DummyMotor.properties
new file mode 100644
index 0000000..20b49ce
--- /dev/null
+++ b/devices/DummyMotor.properties
@@ -0,0 +1,13 @@
+#Thu Jul 13 11:34:36 CEST 2017
+defaultSpeed=1.0
+estbilizationDelay=0
+maxSpeed=10.0
+maxValue=10.0
+minSpeed=0.1
+minValue=-10.0
+offset=0.0
+precision=2
+resolution=NaN
+rotation=false
+scale=1.0
+unit=mm
diff --git a/devices/Motor.properties b/devices/Motor.properties
new file mode 100644
index 0000000..af45da2
--- /dev/null
+++ b/devices/Motor.properties
@@ -0,0 +1,13 @@
+#Thu Jul 13 11:34:17 CEST 2017
+defaultSpeed=NaN
+estbilizationDelay=0
+maxSpeed=NaN
+maxValue=NaN
+minSpeed=NaN
+minValue=NaN
+offset=0.0
+precision=-1
+resolution=NaN
+rotation=false
+scale=1.0
+unit=null
diff --git a/devices/SimMotor.properties b/devices/SimMotor.properties
new file mode 100644
index 0000000..954fd2c
--- /dev/null
+++ b/devices/SimMotor.properties
@@ -0,0 +1,13 @@
+#Thu Jul 13 11:41:31 CEST 2017
+defaultSpeed=1.0
+estbilizationDelay=0
+maxSpeed=10.0
+maxValue=10.0
+minSpeed=0.1
+minValue=-10.0
+offset=0.0
+precision=2
+resolution=NaN
+rotation=false
+scale=1.0
+unit=mm
diff --git a/devices/Time.properties b/devices/Time.properties
index 32c010a..305bf0c 100644
--- a/devices/Time.properties
+++ b/devices/Time.properties
@@ -1,8 +1,9 @@
-#Tue Apr 11 10:12:57 CEST 2017
+#Thu Jul 13 12:56:15 CEST 2017
maxValue=NaN
minValue=NaN
offset=0.0
precision=-1
resolution=NaN
+rotation=false
scale=1.0
unit=null
diff --git a/devices/WireScanner motor.properties b/devices/WireScanner motor.properties
index 02d9bae..b054992 100644
--- a/devices/WireScanner motor.properties
+++ b/devices/WireScanner motor.properties
@@ -1,5 +1,5 @@
-#Wed Jun 07 14:12:02 CEST 2017
-defaultSpeed=282.842712474619
+#Thu Jul 13 13:13:16 CEST 2017
+defaultSpeed=6000.0
estbilizationDelay=0
hasEnable=false
homingType=None
@@ -10,5 +10,6 @@ minValue=-47600.0
offset=0.0
precision=1
resolution=0.1
+rotation=false
scale=1.0
unit=um
diff --git a/devices/camtool.properties b/devices/camtool.properties
index 2f8810e..c8459be 100644
--- a/devices/camtool.properties
+++ b/devices/camtool.properties
@@ -1,4 +1,4 @@
-#Tue Jul 11 14:06:09 CEST 2017
+#Thu Jul 13 15:35:44 CEST 2017
colormap=Flame
colormapAutomatic=true
colormapMax=578.797
@@ -18,9 +18,9 @@ roiY=0
rotation=0.0
rotationCrop=false
scale=1.0
-spatialCalOffsetX=-633.6028650396007
-spatialCalOffsetY=-375.4578643259528
-spatialCalScaleX=-14.14677269345238
-spatialCalScaleY=-12.708499074710012
+spatialCalOffsetX=542.4551282051282
+spatialCalOffsetY=422.17999999999995
+spatialCalScaleX=1.0
+spatialCalScaleY=1.0
spatialCalUnits=mm
transpose=false
diff --git a/devices/m1.properties b/devices/m1.properties
index 2823983..ed0cdb0 100755
--- a/devices/m1.properties
+++ b/devices/m1.properties
@@ -1,4 +1,4 @@
-#Wed Dec 09 13:57:47 CET 2015
+#Tue Jul 11 15:24:17 CEST 2017
defaultSpeed=1.0
estbilizationDelay=0
maxSpeed=10.0
@@ -8,5 +8,6 @@ minValue=-10.0
offset=0.0
precision=2
resolution=NaN
+rotation=false
scale=1.0
unit=mm
diff --git a/devices/m2.properties b/devices/m2.properties
index 2823983..ed0cdb0 100755
--- a/devices/m2.properties
+++ b/devices/m2.properties
@@ -1,4 +1,4 @@
-#Wed Dec 09 13:57:47 CET 2015
+#Tue Jul 11 15:24:17 CEST 2017
defaultSpeed=1.0
estbilizationDelay=0
maxSpeed=10.0
@@ -8,5 +8,6 @@ minValue=-10.0
offset=0.0
precision=2
resolution=NaN
+rotation=false
scale=1.0
unit=mm
diff --git a/devices/p1.properties b/devices/p1.properties
index fc08633..7b725f5 100755
--- a/devices/p1.properties
+++ b/devices/p1.properties
@@ -1,8 +1,9 @@
-#Wed Dec 09 13:57:47 CET 2015
+#Tue Jul 11 15:24:17 CEST 2017
maxValue=1000.0
minValue=0.0
offset=0.0
precision=-1
resolution=NaN
+rotation=false
scale=1.0
unit=mm
diff --git a/plugins/CameraConfigDialog.form b/plugins/CameraConfigDialog.form
new file mode 100644
index 0000000..73ac4fd
--- /dev/null
+++ b/plugins/CameraConfigDialog.form
@@ -0,0 +1,524 @@
+
+
+
diff --git a/plugins/CameraConfigDialog.java b/plugins/CameraConfigDialog.java
new file mode 100644
index 0000000..9c46b85
--- /dev/null
+++ b/plugins/CameraConfigDialog.java
@@ -0,0 +1,692 @@
+
+
+import ch.psi.utils.swing.StandardDialog;
+import ch.psi.utils.swing.SwingUtils;
+import ch.psi.pshell.bs.Camtool;
+import ch.psi.pshell.imaging.Overlay;
+import ch.psi.pshell.imaging.Overlays;
+import ch.psi.pshell.imaging.Pen;
+import ch.psi.pshell.imaging.Renderer;
+import ch.psi.pshell.imaging.RendererListener;
+import ch.psi.pshell.imaging.RendererMode;
+import ch.psi.utils.Convert;
+import java.awt.Color;
+import java.awt.Dimension;
+import java.awt.Frame;
+import java.awt.Point;
+import java.awt.Rectangle;
+import java.io.IOException;
+import java.lang.reflect.InvocationTargetException;
+import java.util.Arrays;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import javax.swing.JDialog;
+
+
+/*
+ */
+
+/**
+ *
+ */
+public class CameraConfigDialog extends StandardDialog {
+
+ Camtool camera;
+ Renderer renderer;
+ String cameraName;
+ Overlay[] calibrationOverlays;
+ Pen pen = new Pen(new Color(128, 0, 128), 1, Pen.LineStyle.solid);
+ Overlays.Crosshairs ovTop = new Overlays.Crosshairs(pen, new Dimension(-1, 1));
+ Overlays.Crosshairs ovBottom = new Overlays.Crosshairs(pen, new Dimension(-1, 1));
+ Overlays.Crosshairs ovLeft = new Overlays.Crosshairs(pen, new Dimension(1, -1));
+ Overlays.Crosshairs ovRight = new Overlays.Crosshairs(pen, new Dimension(1, -1));
+
+ /**
+ *
+ * {
+ * name=SINEG01-DSCR350,
+ * prefix=SINEG01-DSCR350,
+ * mirror_x=true,
+ * mirror_y=true,
+ * rotate=0,
+ * calibration={
+ * horizontal_camera_angle=0,
+ * vertical_camera_angle=0
+ * reference_marker_width=16000.0,
+ * reference_marker_height=16000.0,
+ * reference_marker=[120, 245, 1251, 1504],
+ * },
+ * }
+ */
+ public CameraConfigDialog(Frame parent, Camtool camera, Renderer renderer) throws IOException {
+ super(parent, camera.getCurrentCamera(), false);
+
+ initComponents();
+
+ this.camera = camera;
+ this.cameraName = camera.getCurrentCamera();
+ this.renderer = renderer;
+
+ Map config = camera.getConfig(cameraName);
+ Map calibration = (Map) config.get("calibration");
+ List refMarker = null;
+ System.out.println("Current config: " + config);
+ checkMirrorX.setSelected((config.get("mirror_x") ==null) ? Boolean.FALSE: (Boolean)config.get("mirror_x"));
+ checkMirrorY.setSelected((config.get("mirror_y") ==null) ? Boolean.FALSE: (Boolean)config.get("mirror_y"));
+ comboRotation.setSelectedIndex((config.get("rotate") == null) ? 0 :(Integer) (config.get("rotate")));
+ if (calibration!=null){
+ spinnerRefWidth.setValue(((Number)calibration.get("reference_marker_width")).doubleValue());
+ spinnerRefHeight.setValue(((Number)calibration.get("reference_marker_height")).doubleValue());
+ spinnerAngleHor.setValue(((Number)calibration.get("horizontal_camera_angle")).doubleValue());
+ spinnerAngleVer.setValue(((Number)calibration.get("vertical_camera_angle")).doubleValue());
+ refMarker = ((List)calibration.get("reference_marker"));
+ if (refMarker.size()==4){
+ spinnerLeft.setValue(refMarker.get(0));
+ spinnerTop.setValue(refMarker.get(1));
+ spinnerRight.setValue(refMarker.get(2));
+ spinnerBottom.setValue(refMarker.get(3));
+ }
+ }
+ updateResults();
+
+ camera.resetRoi();
+
+
+ renderer.setMode(RendererMode.Fit);
+ calibrationOverlays = new Overlay[]{ovTop, ovBottom, ovLeft, ovRight};
+ for (Overlay ov : calibrationOverlays){
+ ov.setMovable(true);
+ }
+ renderer.addOverlays(calibrationOverlays);
+
+ try{
+ Rectangle r = new Rectangle();
+ ovLeft.update(new Point(Math.max(refMarker.get(0), 0), 0));
+ ovTop.update(new Point(0, Math.max(refMarker.get(1), 0)));
+ ovRight.update(new Point(Math.max(refMarker.get(2), 0), 0));
+ ovBottom.update(new Point(0, Math.max(refMarker.get(3),0)));
+ } catch (Exception ex){
+ SwingUtils.invokeDelayed(() -> {
+ Dimension size = renderer.getImageSize();
+ ovTop.update(new Point(0, size.height/8));
+ ovBottom.update(new Point(0, 7*size.height/8));
+ ovLeft.update(new Point(size.width/8, 0));
+ ovRight.update(new Point(7*size.width/8, 0));
+ }, 500);
+ }
+ renderer.addListener(new RendererListener(){
+ @Override
+ public void onMoveFinished(Renderer renderer, Overlay overlay) {
+ if (overlay==ovTop){
+ spinnerTop.setValue(ovTop.getPosition().y);
+ } else if (overlay==ovBottom){
+ spinnerBottom.setValue(ovBottom.getPosition().y);
+ } else if (overlay==ovLeft){
+ spinnerLeft.setValue(ovLeft.getPosition().x);
+ } else if (overlay==ovRight){
+ spinnerRight.setValue(ovRight.getPosition().x);
+ }
+ }
+ });
+ setDefaultCloseOperation(JDialog.DISPOSE_ON_CLOSE);
+ pack();
+ }
+
+ @Override
+ protected void onClosed() {
+ renderer.removeOverlays(calibrationOverlays);
+ calibrationOverlays = null;
+ }
+
+
+ void updateResults(){
+ try{
+ int left = (Integer)spinnerLeft.getValue();
+ int right = (Integer)spinnerRight.getValue();
+ int top = (Integer)spinnerTop.getValue();
+ int bottom = (Integer)spinnerBottom.getValue();
+ double width = (Double)spinnerRefWidth.getValue();
+ double height = (Double)spinnerRefHeight.getValue();
+ textOriginX.setText(String.valueOf((left+right)/2));
+ textOriginY.setText(String.valueOf((top+bottom)/2));
+ textPixelSizeX.setText(String.valueOf(Convert.roundDouble(width/Math.abs(right-left),2)));
+ textPixelSizeY.setText(String.valueOf(Convert.roundDouble(height/Math.abs(bottom-top),2)));
+ ovLeft.update(new Point(Math.max(left, 0), 0));
+ ovTop.update(new Point(0, Math.max(top, 0)));
+ ovRight.update(new Point(Math.max(right, 0), 0));
+ ovBottom.update(new Point(0, Math.max(bottom,0)));
+ renderer.refresh();
+
+ } catch (Exception ex){
+ SwingUtils.showException(this, ex);
+ }
+ }
+
+
+ public static void main(String args[]) throws Exception {
+ //String cameraName = "SINEG01-DSCR190";
+ String cameraName = "SATSY02-DSCR220" ;
+ Camtool camtool = new Camtool("Camera", "localhost:10000");
+ camtool.start(cameraName);
+ //java.awt.EventQueue.invokeLater(() -> {
+ Renderer renderer = new Renderer();
+ camtool.addListener(renderer);
+ JDialog dlgRenderer = SwingUtils.showDialog(null, cameraName, new Dimension(600,400), renderer);
+ CameraConfigDialog dialog = new CameraConfigDialog(null, camtool, renderer);
+ dialog.addWindowListener(new java.awt.event.WindowAdapter() {
+ @Override
+ public void windowClosing(java.awt.event.WindowEvent e) {
+ dlgRenderer.setVisible(false);
+ camtool.close();
+ System.exit(0);
+ }
+ });
+ SwingUtils.centerComponent(null, dialog);
+ dialog.setVisible(true);
+ // });
+ }
+
+ /**
+ * This method is called from within the constructor to initialize the form.
+ * WARNING: Do NOT modify this code. The content of this method is always
+ * regenerated by the Form Editor.
+ */
+ @SuppressWarnings("unchecked")
+ // //GEN-BEGIN:initComponents
+ private void initComponents() {
+
+ jLabel1 = new javax.swing.JLabel();
+ jPanel1 = new javax.swing.JPanel();
+ jLabel4 = new javax.swing.JLabel();
+ jLabel5 = new javax.swing.JLabel();
+ jLabel6 = new javax.swing.JLabel();
+ jLabel3 = new javax.swing.JLabel();
+ jLabel2 = new javax.swing.JLabel();
+ jLabel8 = new javax.swing.JLabel();
+ jLabel9 = new javax.swing.JLabel();
+ jLabel10 = new javax.swing.JLabel();
+ spinnerAngleHor = new javax.swing.JSpinner();
+ spinnerAngleVer = new javax.swing.JSpinner();
+ spinnerRefWidth = new javax.swing.JSpinner();
+ spinnerRefHeight = new javax.swing.JSpinner();
+ spinnerTop = new javax.swing.JSpinner();
+ spinnerBottom = new javax.swing.JSpinner();
+ spinnerLeft = new javax.swing.JSpinner();
+ spinnerRight = new javax.swing.JSpinner();
+ buttonFetch = new javax.swing.JButton();
+ jPanel2 = new javax.swing.JPanel();
+ checkMirrorX = new javax.swing.JCheckBox();
+ checkMirrorY = new javax.swing.JCheckBox();
+ comboRotation = new javax.swing.JComboBox();
+ jLabel7 = new javax.swing.JLabel();
+ jPanel3 = new javax.swing.JPanel();
+ jLabel11 = new javax.swing.JLabel();
+ textOriginX = new javax.swing.JTextField();
+ jLabel12 = new javax.swing.JLabel();
+ textOriginY = new javax.swing.JTextField();
+ jLabel13 = new javax.swing.JLabel();
+ jLabel14 = new javax.swing.JLabel();
+ textPixelSizeX = new javax.swing.JTextField();
+ textPixelSizeY = new javax.swing.JTextField();
+ buttonOk = new javax.swing.JButton();
+ buttonCancel = new javax.swing.JButton();
+
+ jLabel1.setText("Calibrate the camera moving the line overlays to the reference marks.");
+
+ jPanel1.setBorder(javax.swing.BorderFactory.createTitledBorder("Calibration"));
+
+ jLabel4.setHorizontalAlignment(javax.swing.SwingConstants.TRAILING);
+ jLabel4.setText("Reference marker height (um):");
+
+ jLabel5.setHorizontalAlignment(javax.swing.SwingConstants.TRAILING);
+ jLabel5.setText("Horizontal camera angle (deg):");
+
+ jLabel6.setHorizontalAlignment(javax.swing.SwingConstants.TRAILING);
+ jLabel6.setText("Vertical camera angle (deg):");
+
+ jLabel3.setHorizontalAlignment(javax.swing.SwingConstants.TRAILING);
+ jLabel3.setText("Reference marker width (um):");
+
+ jLabel2.setHorizontalAlignment(javax.swing.SwingConstants.TRAILING);
+ jLabel2.setText("Top (px):");
+
+ jLabel8.setHorizontalAlignment(javax.swing.SwingConstants.TRAILING);
+ jLabel8.setText("Botton (px):");
+
+ jLabel9.setHorizontalAlignment(javax.swing.SwingConstants.TRAILING);
+ jLabel9.setText("Left (px):");
+
+ jLabel10.setHorizontalAlignment(javax.swing.SwingConstants.TRAILING);
+ jLabel10.setText("Right (px):");
+
+ spinnerAngleHor.setModel(new javax.swing.SpinnerNumberModel(0.0d, -360.0d, 360.0d, 1.0d));
+ spinnerAngleHor.addChangeListener(new javax.swing.event.ChangeListener() {
+ public void stateChanged(javax.swing.event.ChangeEvent evt) {
+ calibrationSpinnerChanged(evt);
+ }
+ });
+
+ spinnerAngleVer.setModel(new javax.swing.SpinnerNumberModel(0.0d, -360.0d, 360.0d, 1.0d));
+ spinnerAngleVer.addChangeListener(new javax.swing.event.ChangeListener() {
+ public void stateChanged(javax.swing.event.ChangeEvent evt) {
+ calibrationSpinnerChanged(evt);
+ }
+ });
+
+ spinnerRefWidth.setModel(new javax.swing.SpinnerNumberModel(30000.0d, 1.0d, 500000.0d, 1.0d));
+ spinnerRefWidth.addChangeListener(new javax.swing.event.ChangeListener() {
+ public void stateChanged(javax.swing.event.ChangeEvent evt) {
+ calibrationSpinnerChanged(evt);
+ }
+ });
+
+ spinnerRefHeight.setModel(new javax.swing.SpinnerNumberModel(30000.0d, 1.0d, 500000.0d, 1.0d));
+ spinnerRefHeight.addChangeListener(new javax.swing.event.ChangeListener() {
+ public void stateChanged(javax.swing.event.ChangeEvent evt) {
+ calibrationSpinnerChanged(evt);
+ }
+ });
+
+ spinnerTop.setModel(new javax.swing.SpinnerNumberModel(0, -10000, 10000, 1));
+ spinnerTop.addChangeListener(new javax.swing.event.ChangeListener() {
+ public void stateChanged(javax.swing.event.ChangeEvent evt) {
+ calibrationSpinnerChanged(evt);
+ }
+ });
+
+ spinnerBottom.setModel(new javax.swing.SpinnerNumberModel(0, -10000, 10000, 1));
+ spinnerBottom.addChangeListener(new javax.swing.event.ChangeListener() {
+ public void stateChanged(javax.swing.event.ChangeEvent evt) {
+ calibrationSpinnerChanged(evt);
+ }
+ });
+
+ spinnerLeft.setModel(new javax.swing.SpinnerNumberModel(0, -10000, 10000, 1));
+ spinnerLeft.addChangeListener(new javax.swing.event.ChangeListener() {
+ public void stateChanged(javax.swing.event.ChangeEvent evt) {
+ calibrationSpinnerChanged(evt);
+ }
+ });
+
+ spinnerRight.setModel(new javax.swing.SpinnerNumberModel(0, -10000, 10000, 1));
+ spinnerRight.addChangeListener(new javax.swing.event.ChangeListener() {
+ public void stateChanged(javax.swing.event.ChangeEvent evt) {
+ calibrationSpinnerChanged(evt);
+ }
+ });
+
+ buttonFetch.setText("Fetch from Inventory");
+ buttonFetch.addActionListener(new java.awt.event.ActionListener() {
+ public void actionPerformed(java.awt.event.ActionEvent evt) {
+ buttonFetchActionPerformed(evt);
+ }
+ });
+
+ javax.swing.GroupLayout jPanel1Layout = new javax.swing.GroupLayout(jPanel1);
+ jPanel1.setLayout(jPanel1Layout);
+ jPanel1Layout.setHorizontalGroup(
+ jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
+ .addGroup(jPanel1Layout.createSequentialGroup()
+ .addContainerGap()
+ .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
+ .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel1Layout.createSequentialGroup()
+ .addComponent(jLabel2)
+ .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
+ .addComponent(spinnerTop, javax.swing.GroupLayout.PREFERRED_SIZE, 80, javax.swing.GroupLayout.PREFERRED_SIZE)
+ .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
+ .addComponent(jLabel3)
+ .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
+ .addComponent(spinnerRefWidth, javax.swing.GroupLayout.PREFERRED_SIZE, 80, javax.swing.GroupLayout.PREFERRED_SIZE))
+ .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel1Layout.createSequentialGroup()
+ .addComponent(jLabel8)
+ .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
+ .addComponent(spinnerBottom, javax.swing.GroupLayout.PREFERRED_SIZE, 80, javax.swing.GroupLayout.PREFERRED_SIZE)
+ .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
+ .addComponent(jLabel4)
+ .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
+ .addComponent(spinnerRefHeight, javax.swing.GroupLayout.PREFERRED_SIZE, 80, javax.swing.GroupLayout.PREFERRED_SIZE))
+ .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel1Layout.createSequentialGroup()
+ .addComponent(jLabel10)
+ .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
+ .addComponent(spinnerRight, javax.swing.GroupLayout.PREFERRED_SIZE, 80, javax.swing.GroupLayout.PREFERRED_SIZE)
+ .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
+ .addComponent(jLabel6)
+ .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
+ .addComponent(spinnerAngleVer, javax.swing.GroupLayout.PREFERRED_SIZE, 80, javax.swing.GroupLayout.PREFERRED_SIZE))
+ .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel1Layout.createSequentialGroup()
+ .addComponent(jLabel9)
+ .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
+ .addComponent(spinnerLeft, javax.swing.GroupLayout.PREFERRED_SIZE, 80, javax.swing.GroupLayout.PREFERRED_SIZE)
+ .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
+ .addComponent(jLabel5)
+ .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
+ .addComponent(spinnerAngleHor, javax.swing.GroupLayout.PREFERRED_SIZE, 80, javax.swing.GroupLayout.PREFERRED_SIZE))
+ .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel1Layout.createSequentialGroup()
+ .addGap(0, 0, Short.MAX_VALUE)
+ .addComponent(buttonFetch)))
+ .addContainerGap())
+ );
+
+ jPanel1Layout.linkSize(javax.swing.SwingConstants.HORIZONTAL, new java.awt.Component[] {jLabel10, jLabel2, jLabel8, jLabel9});
+
+ jPanel1Layout.setVerticalGroup(
+ jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
+ .addGroup(jPanel1Layout.createSequentialGroup()
+ .addContainerGap()
+ .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
+ .addComponent(jLabel3)
+ .addComponent(jLabel2)
+ .addComponent(spinnerRefWidth, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
+ .addComponent(spinnerTop, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
+ .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
+ .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
+ .addComponent(jLabel4)
+ .addComponent(jLabel8)
+ .addComponent(spinnerRefHeight, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
+ .addComponent(spinnerBottom, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
+ .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
+ .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
+ .addComponent(jLabel5)
+ .addComponent(jLabel9)
+ .addComponent(spinnerAngleHor, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
+ .addComponent(spinnerLeft, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
+ .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
+ .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
+ .addComponent(jLabel6)
+ .addComponent(jLabel10)
+ .addComponent(spinnerAngleVer, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
+ .addComponent(spinnerRight, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
+ .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 12, Short.MAX_VALUE)
+ .addComponent(buttonFetch)
+ .addContainerGap())
+ );
+
+ jPanel2.setBorder(javax.swing.BorderFactory.createTitledBorder("Transformations"));
+
+ checkMirrorX.setText("Mirror X");
+
+ checkMirrorY.setText("Mirror Y");
+
+ comboRotation.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "0", "270", "180", "90" }));
+
+ jLabel7.setText("Rotation: ");
+
+ javax.swing.GroupLayout jPanel2Layout = new javax.swing.GroupLayout(jPanel2);
+ jPanel2.setLayout(jPanel2Layout);
+ jPanel2Layout.setHorizontalGroup(
+ jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
+ .addGroup(jPanel2Layout.createSequentialGroup()
+ .addContainerGap()
+ .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
+ .addGroup(jPanel2Layout.createSequentialGroup()
+ .addComponent(checkMirrorX)
+ .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
+ .addComponent(jLabel7)
+ .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
+ .addComponent(comboRotation, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
+ .addGroup(jPanel2Layout.createSequentialGroup()
+ .addComponent(checkMirrorY)
+ .addGap(0, 0, Short.MAX_VALUE)))
+ .addContainerGap())
+ );
+ jPanel2Layout.setVerticalGroup(
+ jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
+ .addGroup(jPanel2Layout.createSequentialGroup()
+ .addContainerGap()
+ .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
+ .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
+ .addComponent(comboRotation, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
+ .addComponent(jLabel7))
+ .addComponent(checkMirrorX))
+ .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
+ .addComponent(checkMirrorY)
+ .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
+ );
+
+ jPanel3.setBorder(javax.swing.BorderFactory.createTitledBorder("Results"));
+
+ jLabel11.setText("Origin X (px):");
+
+ textOriginX.setEditable(false);
+ textOriginX.setHorizontalAlignment(javax.swing.JTextField.CENTER);
+
+ jLabel12.setText("Origin Y (px):");
+
+ textOriginY.setEditable(false);
+ textOriginY.setHorizontalAlignment(javax.swing.JTextField.CENTER);
+
+ jLabel13.setText("Y pixel size (um/px):");
+
+ jLabel14.setText("X pixel size (um/px):");
+
+ textPixelSizeX.setEditable(false);
+ textPixelSizeX.setHorizontalAlignment(javax.swing.JTextField.CENTER);
+
+ textPixelSizeY.setEditable(false);
+ textPixelSizeY.setHorizontalAlignment(javax.swing.JTextField.CENTER);
+
+ javax.swing.GroupLayout jPanel3Layout = new javax.swing.GroupLayout(jPanel3);
+ jPanel3.setLayout(jPanel3Layout);
+ jPanel3Layout.setHorizontalGroup(
+ jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
+ .addGroup(jPanel3Layout.createSequentialGroup()
+ .addGap(21, 21, 21)
+ .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
+ .addGroup(jPanel3Layout.createSequentialGroup()
+ .addComponent(jLabel12)
+ .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
+ .addComponent(textOriginY, javax.swing.GroupLayout.PREFERRED_SIZE, 100, javax.swing.GroupLayout.PREFERRED_SIZE))
+ .addGroup(jPanel3Layout.createSequentialGroup()
+ .addComponent(jLabel11)
+ .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
+ .addComponent(textOriginX, javax.swing.GroupLayout.PREFERRED_SIZE, 100, javax.swing.GroupLayout.PREFERRED_SIZE)))
+ .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
+ .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
+ .addGroup(jPanel3Layout.createSequentialGroup()
+ .addComponent(jLabel13)
+ .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
+ .addComponent(textPixelSizeY, javax.swing.GroupLayout.PREFERRED_SIZE, 100, javax.swing.GroupLayout.PREFERRED_SIZE))
+ .addGroup(jPanel3Layout.createSequentialGroup()
+ .addComponent(jLabel14)
+ .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
+ .addComponent(textPixelSizeX, javax.swing.GroupLayout.PREFERRED_SIZE, 100, javax.swing.GroupLayout.PREFERRED_SIZE)))
+ .addContainerGap())
+ );
+
+ jPanel3Layout.linkSize(javax.swing.SwingConstants.HORIZONTAL, new java.awt.Component[] {jLabel11, jLabel12});
+
+ jPanel3Layout.linkSize(javax.swing.SwingConstants.HORIZONTAL, new java.awt.Component[] {jLabel13, jLabel14});
+
+ jPanel3Layout.setVerticalGroup(
+ jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
+ .addGroup(jPanel3Layout.createSequentialGroup()
+ .addContainerGap()
+ .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
+ .addGroup(jPanel3Layout.createSequentialGroup()
+ .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
+ .addComponent(jLabel14)
+ .addComponent(textPixelSizeX, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
+ .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
+ .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
+ .addComponent(jLabel13)
+ .addComponent(textPixelSizeY, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)))
+ .addGroup(jPanel3Layout.createSequentialGroup()
+ .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
+ .addComponent(jLabel11)
+ .addComponent(textOriginX, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
+ .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
+ .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
+ .addComponent(jLabel12)
+ .addComponent(textOriginY, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))))
+ .addContainerGap())
+ );
+
+ buttonOk.setText("Ok");
+ buttonOk.addActionListener(new java.awt.event.ActionListener() {
+ public void actionPerformed(java.awt.event.ActionEvent evt) {
+ buttonOkActionPerformed(evt);
+ }
+ });
+
+ buttonCancel.setText("Cancel");
+ buttonCancel.addActionListener(new java.awt.event.ActionListener() {
+ public void actionPerformed(java.awt.event.ActionEvent evt) {
+ buttonCancelActionPerformed(evt);
+ }
+ });
+
+ javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
+ getContentPane().setLayout(layout);
+ layout.setHorizontalGroup(
+ layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
+ .addGroup(layout.createSequentialGroup()
+ .addContainerGap()
+ .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
+ .addComponent(jLabel1, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
+ .addComponent(jPanel1, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
+ .addComponent(jPanel2, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
+ .addComponent(jPanel3, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
+ .addGroup(layout.createSequentialGroup()
+ .addGap(0, 0, Short.MAX_VALUE)
+ .addComponent(buttonOk)
+ .addGap(18, 18, 18)
+ .addComponent(buttonCancel)
+ .addGap(0, 0, Short.MAX_VALUE)))
+ .addContainerGap())
+ );
+
+ layout.linkSize(javax.swing.SwingConstants.HORIZONTAL, new java.awt.Component[] {buttonCancel, buttonOk});
+
+ layout.setVerticalGroup(
+ layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
+ .addGroup(layout.createSequentialGroup()
+ .addContainerGap()
+ .addComponent(jLabel1)
+ .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
+ .addComponent(jPanel2, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
+ .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
+ .addComponent(jPanel1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
+ .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
+ .addComponent(jPanel3, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
+ .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
+ .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
+ .addComponent(buttonOk)
+ .addComponent(buttonCancel))
+ .addContainerGap(16, Short.MAX_VALUE))
+ );
+ }// //GEN-END:initComponents
+
+ private void buttonOkActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_buttonOkActionPerformed
+
+ try {
+ //renderer.removeOverlays(calibrationOverlays);
+ //calibrationOverlays = null;
+ //calibrationDialolg = null;
+
+ int left = (Integer)spinnerLeft.getValue(); //left.getPosition().x
+ int right = (Integer)spinnerRight.getValue(); //right.getPosition().x
+ int top = (Integer)spinnerTop.getValue(); //top.getPosition().y
+ int bottom = (Integer)spinnerBottom.getValue(); //bottom.getPosition().y
+ double width = (Double)spinnerRefWidth.getValue();
+ double height = (Double)spinnerRefHeight.getValue();
+ double angleHor = (Double)spinnerAngleHor.getValue();
+ double angleVer = (Double)spinnerAngleVer.getValue();
+
+ int x1 = Math.min(left, right);
+ int x2 = Math.max(left, right);
+ int y1 = Math.min(top, bottom);
+ int y2 = Math.max(top, bottom);
+ if ((x1!=-1) && (x2!=-1) && (y1!=-1) && (y2!=-1)){
+ System.out.println("Updating " + cameraName + " configuration");
+ HashMap calibration = new HashMap();
+ calibration.put("reference_marker", Arrays.asList(new Integer[]{x1, y1, x2, y2}));
+ calibration.put("reference_marker_width", width);
+ calibration.put("reference_marker_height", height);
+ calibration.put("horizontal_camera_angle", angleHor);
+ calibration.put("vertical_camera_angle", angleVer);
+ //((Camtool) camera).setCalibration(cameraName, calibration);
+
+ HashMap config = new HashMap();
+ config.put("calibration", calibration);
+ config.put("mirror_x", checkMirrorX.isSelected());
+ config.put("mirror_y", checkMirrorY.isSelected());
+ config.put("rotate", comboRotation.getSelectedIndex());
+ ((Camtool) camera).setConfig(cameraName, config);
+
+ System.out.println("New config: " + config);
+ SwingUtils.showMessage(this, "Success", "Updated " + cameraName + " configuration");
+ }
+ } catch (Exception ex) {
+ SwingUtils.showException(this, ex);
+ }
+
+ accept();
+ }//GEN-LAST:event_buttonOkActionPerformed
+
+ private void buttonCancelActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_buttonCancelActionPerformed
+ cancel();
+ }//GEN-LAST:event_buttonCancelActionPerformed
+
+ private void buttonFetchActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_buttonFetchActionPerformed
+ try{
+ //List calib = Inventory.getCalibFromInventory(null, cameraName);
+ List calib = (List) Class.forName("Inventory").
+ getMethod("getCalibFromInventory",
+ new Class[]{String.class,String.class}).
+ invoke(null, new Object[]{(String)null, cameraName});
+ spinnerRefWidth.setValue(calib.get(0)*1000.0);
+ spinnerRefHeight.setValue(calib.get(1)*1000.0);
+ spinnerAngleHor.setValue(calib.get(2).intValue());
+ spinnerAngleVer.setValue(calib.get(3).intValue());
+ } catch (Exception ex){
+ if (ex instanceof InvocationTargetException){
+ ex = (Exception) ((InvocationTargetException)ex).getCause();
+ }
+ SwingUtils.showException(this, ex);
+ }
+ }//GEN-LAST:event_buttonFetchActionPerformed
+
+ private void calibrationSpinnerChanged(javax.swing.event.ChangeEvent evt) {//GEN-FIRST:event_calibrationSpinnerChanged
+ updateResults();
+ }//GEN-LAST:event_calibrationSpinnerChanged
+
+
+ // Variables declaration - do not modify//GEN-BEGIN:variables
+ private javax.swing.JButton buttonCancel;
+ private javax.swing.JButton buttonFetch;
+ private javax.swing.JButton buttonOk;
+ private javax.swing.JCheckBox checkMirrorX;
+ private javax.swing.JCheckBox checkMirrorY;
+ private javax.swing.JComboBox comboRotation;
+ private javax.swing.JLabel jLabel1;
+ private javax.swing.JLabel jLabel10;
+ private javax.swing.JLabel jLabel11;
+ private javax.swing.JLabel jLabel12;
+ private javax.swing.JLabel jLabel13;
+ private javax.swing.JLabel jLabel14;
+ private javax.swing.JLabel jLabel2;
+ private javax.swing.JLabel jLabel3;
+ private javax.swing.JLabel jLabel4;
+ private javax.swing.JLabel jLabel5;
+ private javax.swing.JLabel jLabel6;
+ private javax.swing.JLabel jLabel7;
+ private javax.swing.JLabel jLabel8;
+ private javax.swing.JLabel jLabel9;
+ private javax.swing.JPanel jPanel1;
+ private javax.swing.JPanel jPanel2;
+ private javax.swing.JPanel jPanel3;
+ private javax.swing.JSpinner spinnerAngleHor;
+ private javax.swing.JSpinner spinnerAngleVer;
+ private javax.swing.JSpinner spinnerBottom;
+ private javax.swing.JSpinner spinnerLeft;
+ private javax.swing.JSpinner spinnerRefHeight;
+ private javax.swing.JSpinner spinnerRefWidth;
+ private javax.swing.JSpinner spinnerRight;
+ private javax.swing.JSpinner spinnerTop;
+ private javax.swing.JTextField textOriginX;
+ private javax.swing.JTextField textOriginY;
+ private javax.swing.JTextField textPixelSizeX;
+ private javax.swing.JTextField textPixelSizeY;
+ // End of variables declaration//GEN-END:variables
+}
diff --git a/plugins/CameraConfigPanel.form b/plugins/CameraConfigPanel.form
deleted file mode 100644
index c638b68..0000000
--- a/plugins/CameraConfigPanel.form
+++ /dev/null
@@ -1,28 +0,0 @@
-
-
-
diff --git a/plugins/CameraConfigPanel.java b/plugins/CameraConfigPanel.java
deleted file mode 100644
index d1459e9..0000000
--- a/plugins/CameraConfigPanel.java
+++ /dev/null
@@ -1,44 +0,0 @@
-/*
- * To change this license header, choose License Headers in Project Properties.
- * To change this template file, choose Tools | Templates
- * and open the template in the editor.
- */
-
-/**
- *
- * @author gobbo_a
- */
-public class CameraConfigPanel extends javax.swing.JPanel {
-
- /**
- * Creates new form CameraConfigPanel
- */
- public CameraConfigPanel() {
- initComponents();
- }
-
- /**
- * This method is called from within the constructor to initialize the form.
- * WARNING: Do NOT modify this code. The content of this method is always
- * regenerated by the Form Editor.
- */
- @SuppressWarnings("unchecked")
- // //GEN-BEGIN:initComponents
- private void initComponents() {
-
- javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this);
- this.setLayout(layout);
- layout.setHorizontalGroup(
- layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
- .addGap(0, 400, Short.MAX_VALUE)
- );
- layout.setVerticalGroup(
- layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
- .addGap(0, 300, Short.MAX_VALUE)
- );
- }// //GEN-END:initComponents
-
-
- // Variables declaration - do not modify//GEN-BEGIN:variables
- // End of variables declaration//GEN-END:variables
-}
diff --git a/plugins/Cameras.java b/plugins/Cameras.java
index d3425c8..f2aa083 100644
--- a/plugins/Cameras.java
+++ b/plugins/Cameras.java
@@ -421,7 +421,7 @@ public class Cameras extends Panel {
int profileSize = Math.min(data.getWidth(), data.getHeight())/4;
try {
- double[] sum = (double[]) Convert.toDouble(data.integrateVertically());
+ double[] sum = (double[]) Convert.toDouble(data.integrateVertically(true));
int[] x = Arr.indexesInt(sum.length);
DescriptiveStatistics stats = new DescriptiveStatistics(sum);
double min = stats.getMin();
@@ -449,7 +449,7 @@ public class Cameras extends Panel {
}
try {
- double[] sum = (double[]) Convert.toDouble(data.integrateHorizontally());
+ double[] sum = (double[]) Convert.toDouble(data.integrateHorizontally(true));
int[] x = Arr.indexesInt(sum.length);
DescriptiveStatistics stats = new DescriptiveStatistics(sum);
double min = stats.getMin();
diff --git a/plugins/GunScan.form b/plugins/GunScan.form
index 1aa35fe..2b38801 100644
--- a/plugins/GunScan.form
+++ b/plugins/GunScan.form
@@ -32,7 +32,6 @@
-
@@ -162,7 +161,7 @@
-
+
@@ -177,7 +176,7 @@
-
+
@@ -192,7 +191,7 @@
-
+
@@ -217,7 +216,7 @@
-
+
diff --git a/plugins/GunScan.java b/plugins/GunScan.java
index 182aa00..00e4feb 100644
--- a/plugins/GunScan.java
+++ b/plugins/GunScan.java
@@ -2,6 +2,7 @@
* Copyright (c) 2014-2017 Paul Scherrer Institute. All rights reserved.
*/
+import ch.psi.pshell.plot.LinePlotJFree;
import ch.psi.pshell.ui.Panel;
import ch.psi.utils.State;
import ch.psi.utils.swing.SwingUtils;
@@ -16,6 +17,7 @@ public class GunScan extends Panel {
public GunScan() {
initComponents();
setPersistedComponents(SwingUtils.getComponentsByType(panelScanPars, JSpinner.class));
+ plot.setStyle(LinePlotJFree.Style.ErrorY);
}
//Overridable callbacks
@@ -32,6 +34,8 @@ public class GunScan extends Panel {
spinnerStep.setEnabled(buttonStart.isEnabled());
spinnerSamples.setEnabled(buttonStart.isEnabled());
spinnerLatency.setEnabled(buttonStart.isEnabled());
+ spinnerDispersion.setEnabled(buttonStart.isEnabled());
+ spinnerEnergy.setEnabled(buttonStart.isEnabled());
}
@Override
@@ -75,17 +79,17 @@ public class GunScan extends Panel {
labelStop.setText("Stop:");
- spinnerStep.setModel(new javax.swing.SpinnerNumberModel(5.0d, 1.0d, 90.0d, 1.0d));
+ spinnerStep.setModel(new javax.swing.SpinnerNumberModel(1.0d, 0.05d, 10.0d, 0.05d));
spinnerStep.setPreferredSize(new java.awt.Dimension(64, 20));
labelStep.setText("Step:");
- spinnerStart.setModel(new javax.swing.SpinnerNumberModel(0.0d, -180.0d, 360.0d, 1.0d));
+ spinnerStart.setModel(new javax.swing.SpinnerNumberModel(0.0d, -360.0d, 360.0d, 1.0d));
spinnerStart.setPreferredSize(new java.awt.Dimension(64, 20));
labelSamples.setText("Nb Samples:");
- spinnerSamples.setModel(new javax.swing.SpinnerNumberModel(1.0d, 1.0d, 50.0d, 1.0d));
+ spinnerSamples.setModel(new javax.swing.SpinnerNumberModel(1, 1, 50, 1));
spinnerSamples.setPreferredSize(new java.awt.Dimension(64, 20));
labelLatency.setText("Latency:");
@@ -93,7 +97,7 @@ public class GunScan extends Panel {
spinnerLatency.setModel(new javax.swing.SpinnerNumberModel(0.1d, 0.0d, 5.0d, 0.01d));
spinnerLatency.setPreferredSize(new java.awt.Dimension(64, 20));
- spinnerStop.setModel(new javax.swing.SpinnerNumberModel(180.0d, -180.0d, 360.0d, 1.0d));
+ spinnerStop.setModel(new javax.swing.SpinnerNumberModel(180.0d, -360.0d, 360.0d, 1.0d));
spinnerStop.setMinimumSize(new java.awt.Dimension(53, 20));
spinnerStop.setPreferredSize(new java.awt.Dimension(64, 20));
@@ -224,7 +228,6 @@ public class GunScan extends Panel {
.addComponent(panelBeamPars, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED))
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
- .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(buttonStart)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(buttonAbort)
diff --git a/plugins/Inventory.java b/plugins/Inventory.java
new file mode 100644
index 0000000..9e0104c
--- /dev/null
+++ b/plugins/Inventory.java
@@ -0,0 +1,148 @@
+/*
+ * Copyright (c) 2014 Paul Scherrer Institute. All rights reserved.
+ */
+
+
+import ch.psi.pshell.core.JsonSerializer;
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import javax.ws.rs.client.Client;
+import javax.ws.rs.client.ClientBuilder;
+import javax.ws.rs.client.Entity;
+import javax.ws.rs.client.WebTarget;
+import javax.ws.rs.core.MediaType;
+import javax.ws.rs.core.Response;
+import org.glassfish.jersey.client.ClientConfig;
+import org.glassfish.jersey.jackson.JacksonFeature;
+
+/**
+ *
+ */
+public class Inventory {
+
+ public static T inventoryRequest(String url, Map attributes, Class type) throws IOException {
+ String json = JsonSerializer.encode(attributes);
+ Client client = ClientBuilder.newClient(new ClientConfig().register(JacksonFeature.class));
+ try {
+ WebTarget resource = client.target(url);
+ Response r = resource.request().accept(MediaType.TEXT_HTML).post(Entity.json(json));
+ json = r.readEntity(String.class);
+ if (r.getStatus() != Response.Status.OK.getStatusCode()) {
+ throw new IOException("Inventory returned error: " + json);
+ }
+ Map ret = (Map) JsonSerializer.decode(json, Map.class);
+ return (T) ret.get("d");
+ } finally {
+ client.close();
+ }
+ }
+
+ public static String findPartidByHoly(String holy_name, String type) throws IOException {
+ if (type == null) {
+ type = "DSCR";
+ }
+ Map query = new HashMap();
+ Map qn = new HashMap();
+ Map qt = new HashMap();
+ qn.put("Field", "Holy List Name");
+ qn.put("Operator", "Is");
+ qn.put("Value", holy_name);
+ qt.put("Field", "Type");
+ qt.put("Operator", "Is");
+ qt.put("Value", type);
+ query.put("query", Arrays.asList(new Map[]{qn, qt}));
+ query.put("columns", Arrays.asList(new String[]{"Label"}));
+
+ Map attr = new HashMap();
+ attr.put("search", query);
+ Map ret = (Map) inventoryRequest("https://inventory.psi.ch/DataAccess.asmx/FindObjects", attr, Map.class);
+ try {
+ return (String) ((List) (((List) ret.get("Rows")).get(0))).get(0);
+ } catch (Exception ex) {
+ return null;
+ }
+ }
+
+ public static List findAllByType(String type, String column) throws IOException {
+ if (type == null) {
+ type = "DSCR";
+ }
+ if (column == null) {
+ column = "Holy List Name";
+ }
+
+ Map query = new HashMap();
+ Map q = new HashMap();
+ q.put("Field", "Type");
+ q.put("Operator", "Is");
+ q.put("Value", type);
+ query.put("query", Arrays.asList(new Map[]{q}));
+ query.put("columns", Arrays.asList(new String[]{"Label"}));
+
+ Map attr = new HashMap();
+ attr.put("search", query);
+ Map r = (Map) inventoryRequest("https://inventory.psi.ch/DataAccess.asmx/FindObjects", attr, Map.class);
+ List rows = (List) (r.get("Rows"));
+ List ret = new ArrayList();
+ for (Object list : rows) {
+ ret.add(((List) list).get(0));
+ }
+ return ret;
+ }
+
+ public static List