diff --git a/config/config.properties b/config/config.properties
index 0d93163..0148555 100755
--- a/config/config.properties
+++ b/config/config.properties
@@ -1,90 +1,87 @@
-#Tue Oct 28 16:49:26 CET 2025
+#Wed Jan 14 14:03:24 CET 2026
autoSaveScanData=true
-simulation=false
-dataScanAutoSave=true
-xscanCrlogicChannel=null
-dataScanSaveOutput=false
-scanPreserveTypes=false
-userAuthenticator=
-dataScanStrategy=default
-dataScanSaveScript=false
-notifiedTasks=null
-parallelInitialization=false
-fdaSerialization=false
-consoleJournal=false
-scanDataRelease=false
-dataTransferPath=null
-scanStreamingPort=-1
-saveConsoleSessionFiles=false
-xscanAppendSuffix=true
-devicePoolFile={config}/devices.properties
-hostName=
-disableEmbeddedAttributes=false
-scanSaveTimestamps=false
-commandTimeToLive=600000
-serverPort=8090
-versionTrackingEnabled=true
-dataPath={data}/{year}/{month}/{day}/{date}_{time}_{name}
-serverEnabled=false
-depthDimension=0
-logLevel=Fine
-dataLayout=sf
-disableDataFileLogs=false
-dataScanSaveTimestamps=false
-sessionHandling=Off
-deviceUpdateStrategyFile={config}/update.properties
-terminalEnabled=false
-notificationLevel=Off
-terminalPort=3579
-commandQueueSize=-1
-dataTransferUser=null
-xscanContinuousUpdate=false
-scanLazyTableCreation=false
-versionTrackingLogin=
-noBytecodeFiles=false
-scanSaveMeta=true
-versionTrackingRemote=https\://gitea.psi.ch/pshell_config/sf-op.git
-scanAutoSave=true
-dataScanLazyTableCreation=false
-pythonHome=
-xscanMoveTimeout=600
-commandStatistics=false
-serverHostName=null
commandExecutionEvents=false
-logDaysToLive=30
-xscanCrlogicSimulated=false
-dataDepthDimension=0
-logLevelConsole=Off
-filePermissionsConfig=Default
-scanStreamerPort=-1
-dataEmbeddedAttributes=false
-dataScanSaveSetpoints=false
-scanSaveLogs=true
-serverCommandsHidden=false
-versionTrackingManual=true
-dataTransferMode=Off
-userManagement=false
-instanceName=OP
-dataServerPort=-1
-notificationTasks=
-hideServerMessages=false
-scanReleaseRecords=false
-scanDefaultTag=null
-dataScanReleaseRecords=false
-dataScanPreserveTypes=false
-dataScanFlushRecords=false
-filePermissionsLogs=Public
-logPath={logs}/{date}_{time}
-filePermissionsScripts=Public
-xscanCrlogicPrefix=null
-dataFormat=null
-dataScanSaveLogs=true
-tasksFile={config}/tasks.properties
-filePermissionsData=Default
-xscanCrlogicAbortable=true
+commandQueueSize=-1
+commandStatistics=false
+commandTimeToLive=600000
+consoleJournal=false
createSessionFiles=false
-dataScanStreamerPort=-1
-scanFlushRecords=false
-dataProvider=default
-xscanCrlogicIoc=null
+dataDepthDimension=0
+dataEmbeddedAttributes=false
+dataFormat=default
+dataLayout=sf
+dataPath={data}/{year}/{month}/{day}/{date}_{time}_{name}
+dataProvider=null
+dataScanFlushRecords=false
+dataScanLazyTableCreation=false
+dataScanPreserveTypes=false
+dataScanReleaseRecords=false
+dataScanSaveOutput=false
+dataScanSaveScript=false
+dataScanSaveSetpoints=false
+dataScanSaveTimestamps=false
+dataServerPort=-1
+dataTransferMode=Off
+dataTransferPath=null
+dataTransferUser=null
+dataTruncate=true
+depthDimension=0
+devicePoolFile={config}/devices.properties
+deviceUpdateStrategyFile={config}/update.properties
+disableDataFileLogs=false
+disableEmbeddedAttributes=false
+fdaSerialization=false
+filePermissionsConfig=Default
+filePermissionsData=Default
+filePermissionsLogs=Public
+filePermissionsScripts=Public
+hideServerMessages=false
+hostName=null
+instanceName=OP
+logDaysToLive=30
+logLevel=Fine
+logLevelConsole=Off
+logPath={logs}/{date}_{time}.{mode}
+noBytecodeFiles=false
+notificationLevel=Off
+notificationTasks=
+notifiedTasks=
+parallelInitialization=false
+pythonHome=
+pythonNoBytecodeFiles=false
saveCommandStatistics=false
+saveConsoleSessionFiles=false
+scanAutoSave=true
+scanDefaultTag="scan_{index}%d"
+scanFlushRecords=false
+scanLazyTableCreation=false
+scanPreserveTypes=false
+scanReleaseRecords=false
+scanSaveLogs=true
+scanSaveMeta=true
+scanSaveTimestamps=false
+scanStreamerPort=-1
+serverCommandsHidden=false
+serverEnabled=false
+serverHostName=
+serverHttps=false
+serverPort=8090
+sessionHandling=Off
+simulation=false
+tasksFile={config}/tasks.properties
+terminalEnabled=false
+terminalPort=3579
+userAuthenticator=
+userManagement=false
+versionTrackingEnabled=true
+versionTrackingLogin=
+versionTrackingManual=true
+versionTrackingRemote=https\://gitea.psi.ch/pshell_config/sf-op.git
+xscanAppendSuffix=true
+xscanContinuousUpdate=false
+xscanCrlogicAbortable=true
+xscanCrlogicChannel=null
+xscanCrlogicIoc=null
+xscanCrlogicPrefix=null
+xscanCrlogicSimulated=false
+xscanMoveTimeout=600
diff --git a/config/devices.properties b/config/devices.properties
index 3c9b088..3bdcfc4 100755
--- a/config/devices.properties
+++ b/config/devices.properties
@@ -1,5 +1,5 @@
dispatcher=ch.psi.pshell.bs.Dispatcher|https://dispatcher-api.psi.ch/sf|||
-cam_server=ch.psi.pshell.bs.PipelineServer|sf-daqsync-01:8889|||
+cam_server=ch.psi.pshell.camserver.PipelineSource|sf-daqsync-01:8889|||
charge=ch.psi.pshell.epics.ProcessVariable|SINEG01-DICT215:B1_CHARGE_AVERAGE-OP|||
rep_rate_bunch_1=ch.psi.pshell.epics.ProcessVariable|SIN-TIMAST-TMA:Bunch-1-Appl-Freq-RB|||
rep_rate_bunch_2=ch.psi.pshell.epics.ProcessVariable|SIN-TIMAST-TMA:Bunch-2-Appl-Freq-RB|||
diff --git a/config/preferences.json b/config/preferences.json
index 184eae7..559990a 100644
--- a/config/preferences.json
+++ b/config/preferences.json
@@ -56,8 +56,7 @@
"scanPlotDisabled" : false,
"scanTableDisabled" : false,
"cachedDataPanel" : false,
- "dataExtensions" : "",
- "dataSubFiles" : "",
+ "dataVisibleFiles" : "",
"hideFileName" : false,
"showEmergencyStop" : false,
"showHomingButtons" : false,
diff --git a/config/sounds/KDE_Beep_Honk.wav b/config/sounds/KDE_Beep_Honk.wav
new file mode 100755
index 0000000..9faf34c
Binary files /dev/null and b/config/sounds/KDE_Beep_Honk.wav differ
diff --git a/config/variables.properties b/config/variables.properties
index d5c8971..08bffa8 100755
--- a/config/variables.properties
+++ b/config/variables.properties
@@ -1,4 +1,4 @@
-#Thu Dec 11 15:41:25 CET 2025
-LastRunDate=251211
-FileSequentialNumber=16000
-DaySequentialNumber=17
+#Mon Feb 09 14:27:51 CET 2026
+DaySequentialNumber=13
+FileSequentialNumber=16297
+LastRunDate=260209
diff --git a/devices/Beam phase.properties b/devices/Beam phase.properties
index d84280e..ae34c7a 100755
--- a/devices/Beam phase.properties
+++ b/devices/Beam phase.properties
@@ -8,4 +8,4 @@ rotation=true
sign_bit=0
scale=1.0
description=null
-resolution=0.5
+deadband=0.5
diff --git a/devices/CurrentCamera.properties b/devices/CurrentCamera.properties
index 1996b76..9d2c8fe 100755
--- a/devices/CurrentCamera.properties
+++ b/devices/CurrentCamera.properties
@@ -1,47 +1,47 @@
-#Mon Dec 15 10:58:09 CET 2025
-\u0000\u0000\u0000=
-\u0000\u0000=
-\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000=
+#Mon Feb 09 12:41:25 CET 2026
\u0000=
+\u0000\u0000=
+\u0000\u0000\u0000=
\u0000\u0000\u0000\u0000=
+\u0000\u0000\u0000\u0000\u0000=
\u0000\u0000\u0000\u0000\u0000\u0000=
\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000=
\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000=
+\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000=
\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000=
\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000=
-\u0000\u0000\u0000\u0000\u0000=
-colormapLogarithmic=false
-spatialCalScaleX=-6.67596435546875
-spatialCalScaleY=-6.5573768833705355
-serverURL=null
-rescaleOffset=0.0
-roiWidth=-1
+1=
colormap=Flame
+colormapAutomatic=false
+colormapLogarithmic=false
+colormapMax=4000.0
+colormapMin=80.0
+flipHorizontally=false
+flipVertically=false
+grayscale=false
+imageHeight=1680
imageWidth=1744
invert=false
-colormapMin=100.0
-rotationCrop=false
-1=
-roiHeight=-1
-colormapAutomatic=true
-roiY=0
-roiX=0
-spatialCalOffsetY=-312.00000361676905
-spatialCalOffsetX=298.0
-scale=1.0
-regionStart=
-grayscale=false
-rtY=1
-colormapMax=30000.0
-spat=
-rotation=0.0
-rescaleFactor=1.0
-imageHeight=1680
-spatialCalUnits=null
-flipVertically=false
r=
-t=
-flipHorizontally=false
-transpose=false
+regionStart=
regionStartX=433
regionStartY=241
+rescaleFactor=1.0
+rescaleOffset=0.0
+roiHeight=-1
+roiWidth=-1
+roiX=0
+roiY=0
+rotation=0.0
+rotationCrop=false
+rtY=1
+scale=1.0
+serverURL=null
+spat=
+spatialCalOffsetX=-393.0000004567311
+spatialCalOffsetY=-1023.999980257793
+spatialCalScaleX=-8.737659395658053
+spatialCalScaleY=-8.834898165327527
+spatialCalUnits=null
+t=
+transpose=false
diff --git a/devices/DLAC motor.properties b/devices/DLAC motor.properties
index c5ebf94..046b830 100755
--- a/devices/DLAC motor.properties
+++ b/devices/DLAC motor.properties
@@ -7,7 +7,7 @@ scale=1.0
description=null
estbilizationDelay=0
maxSpeed=1.0
-resolution=8.0E-4
+deadband=8.0E-4
homingType=None
startRetries=1
minValue=130.0
diff --git a/devices/DummyMotor.properties b/devices/DummyMotor.properties
index 20b49ce..4f0cca4 100755
--- a/devices/DummyMotor.properties
+++ b/devices/DummyMotor.properties
@@ -7,7 +7,7 @@ minSpeed=0.1
minValue=-10.0
offset=0.0
precision=2
-resolution=NaN
+deadband=NaN
rotation=false
scale=1.0
unit=mm
diff --git a/devices/Gain.properties b/devices/Gain.properties
index 8b047f9..cb0816e 100755
--- a/devices/Gain.properties
+++ b/devices/Gain.properties
@@ -3,6 +3,6 @@ maxValue=NaN
minValue=NaN
offset=0.0
precision=-1
-resolution=NaN
+deadband=NaN
scale=1.0
unit=null
diff --git a/devices/Gun Phase.properties b/devices/Gun Phase.properties
index 97d7944..f93b5a1 100755
--- a/devices/Gun Phase.properties
+++ b/devices/Gun Phase.properties
@@ -8,4 +8,4 @@ rotation=true
sign_bit=0
scale=1.0
description=null
-resolution=0.5
+deadband=0.5
diff --git a/devices/Motor.properties b/devices/Motor.properties
index af45da2..b5544b7 100755
--- a/devices/Motor.properties
+++ b/devices/Motor.properties
@@ -7,7 +7,7 @@ minSpeed=NaN
minValue=NaN
offset=0.0
precision=-1
-resolution=NaN
+deadband=NaN
rotation=false
scale=1.0
unit=null
diff --git a/devices/Phase.properties b/devices/Phase.properties
index de11d60..ca85595 100755
--- a/devices/Phase.properties
+++ b/devices/Phase.properties
@@ -8,4 +8,4 @@ rotation=false
sign_bit=0
scale=1.0
description=null
-resolution=0.01
+deadband=0.01
diff --git a/devices/S10BC01-MQUA100.properties b/devices/S10BC01-MQUA100.properties
index c0bc743..5d22421 100755
--- a/devices/S10BC01-MQUA100.properties
+++ b/devices/S10BC01-MQUA100.properties
@@ -3,6 +3,6 @@ maxValue=10.0
minValue=-10.0
offset=0.0
precision=3
-resolution=0.007
+deadband=0.007
scale=1.0
unit=A
diff --git a/devices/S10CB01-MQUA430.properties b/devices/S10CB01-MQUA430.properties
index 49af40f..d4a1279 100755
--- a/devices/S10CB01-MQUA430.properties
+++ b/devices/S10CB01-MQUA430.properties
@@ -3,6 +3,6 @@ maxValue=10.0
minValue=-10.0
offset=0.0
precision=3
-resolution=0.007
+deadband=0.007
scale=1.0
unit=A
diff --git a/devices/S10CB02-MQUA230.properties b/devices/S10CB02-MQUA230.properties
index 54a61e1..a2d3fd0 100755
--- a/devices/S10CB02-MQUA230.properties
+++ b/devices/S10CB02-MQUA230.properties
@@ -3,6 +3,6 @@ maxValue=10.0
minValue=-10.0
offset=0.0
precision=3
-resolution=0.007
+deadband=0.007
scale=1.0
unit=A
diff --git a/devices/S10CB06-RMOD:FIL-I-SET.properties b/devices/S10CB06-RMOD:FIL-I-SET.properties
index c83dac2..18d7a72 100644
--- a/devices/S10CB06-RMOD:FIL-I-SET.properties
+++ b/devices/S10CB06-RMOD:FIL-I-SET.properties
@@ -7,4 +7,4 @@ rotation=false
precision=-1
sign_bit=0
scale=1.0
-resolution=NaN
+deadband=NaN
diff --git a/devices/S10CB09-RSYS:SET-VSUM-PHASE.properties b/devices/S10CB09-RSYS:SET-VSUM-PHASE.properties
index bc4ad79..abc92f9 100755
--- a/devices/S10CB09-RSYS:SET-VSUM-PHASE.properties
+++ b/devices/S10CB09-RSYS:SET-VSUM-PHASE.properties
@@ -3,7 +3,7 @@ maxValue=0.0
minValue=0.0
offset=0.0
precision=4
-resolution=0.1
+deadband=0.1
rotation=true
scale=1.0
unit=deg
diff --git a/devices/S20SY01-MQUA080.properties b/devices/S20SY01-MQUA080.properties
index c52e4b8..934588f 100755
--- a/devices/S20SY01-MQUA080.properties
+++ b/devices/S20SY01-MQUA080.properties
@@ -3,6 +3,6 @@ maxValue=10.0
minValue=-10.0
offset=0.0
precision=3
-resolution=0.007
+deadband=0.007
scale=1.0
unit=A
diff --git a/devices/S20SY01.MQUA080.properties b/devices/S20SY01.MQUA080.properties
index d8077de..43f2ac1 100755
--- a/devices/S20SY01.MQUA080.properties
+++ b/devices/S20SY01.MQUA080.properties
@@ -3,6 +3,6 @@ maxValue=10.0
minValue=-10.0
offset=0.0
precision=3
-resolution=0.007
+deadband=0.007
scale=1.0
unit=null
diff --git a/devices/SARMA01-MQUA010.properties b/devices/SARMA01-MQUA010.properties
index ecc76cd..2c90739 100755
--- a/devices/SARMA01-MQUA010.properties
+++ b/devices/SARMA01-MQUA010.properties
@@ -3,6 +3,6 @@ maxValue=10.0
minValue=-10.0
offset=0.0
precision=3
-resolution=0.007
+deadband=0.007
scale=1.0
unit=A
diff --git a/devices/SARMA01-MQUA10.properties b/devices/SARMA01-MQUA10.properties
index 0a8b9d7..fb6bc68 100755
--- a/devices/SARMA01-MQUA10.properties
+++ b/devices/SARMA01-MQUA10.properties
@@ -3,6 +3,6 @@ maxValue=10.0
minValue=-10.0
offset=0.0
precision=3
-resolution=0.007
+deadband=0.007
scale=1.0
unit=null
diff --git a/devices/SARUN02-MCRX080.properties b/devices/SARUN02-MCRX080.properties
index 2c5d4b7..b19666f 100755
--- a/devices/SARUN02-MCRX080.properties
+++ b/devices/SARUN02-MCRX080.properties
@@ -3,6 +3,6 @@ maxValue=5.0
minValue=-5.0
offset=0.0
precision=3
-resolution=NaN
+deadband=NaN
scale=1.0
unit=A
diff --git a/devices/SARUN02-MCRY080.properties b/devices/SARUN02-MCRY080.properties
index 427a68a..8986aa3 100755
--- a/devices/SARUN02-MCRY080.properties
+++ b/devices/SARUN02-MCRY080.properties
@@ -3,6 +3,6 @@ maxValue=5.0
minValue=-5.0
offset=0.0
precision=3
-resolution=NaN
+deadband=NaN
scale=1.0
unit=A
diff --git a/devices/SARUN02_MCRX080.properties b/devices/SARUN02_MCRX080.properties
index 671c895..a3bdf71 100755
--- a/devices/SARUN02_MCRX080.properties
+++ b/devices/SARUN02_MCRX080.properties
@@ -3,6 +3,6 @@ maxValue=5.0
minValue=-5.0
offset=0.0
precision=3
-resolution=NaN
+deadband=NaN
scale=1.0
unit=A
diff --git a/devices/SARUN02_MCRY080.properties b/devices/SARUN02_MCRY080.properties
index 22e4997..0bbc3fc 100755
--- a/devices/SARUN02_MCRY080.properties
+++ b/devices/SARUN02_MCRY080.properties
@@ -3,6 +3,6 @@ maxValue=5.0
minValue=-5.0
offset=0.0
precision=3
-resolution=NaN
+deadband=NaN
scale=1.0
unit=A
diff --git a/devices/SINEG01-DBPM340.properties b/devices/SINEG01-DBPM340.properties
index fcf8756..ad4ff20 100755
--- a/devices/SINEG01-DBPM340.properties
+++ b/devices/SINEG01-DBPM340.properties
@@ -3,6 +3,6 @@ maxValue=NaN
minValue=NaN
offset=0.0
precision=-1
-resolution=NaN
+deadband=NaN
scale=1.0
unit=null
diff --git a/devices/SINEG01-RSYS:SET-BEAM-PHASE-SIM.properties b/devices/SINEG01-RSYS:SET-BEAM-PHASE-SIM.properties
index 79fc5eb..4f817d3 100755
--- a/devices/SINEG01-RSYS:SET-BEAM-PHASE-SIM.properties
+++ b/devices/SINEG01-RSYS:SET-BEAM-PHASE-SIM.properties
@@ -3,7 +3,7 @@ maxValue=360.0
minValue=-360.0
offset=0.0
precision=3
-resolution=0.1
+deadband=0.1
rotation=false
scale=1.0
unit=deg
diff --git a/devices/SINEG01-RSYS:SET-BEAM-PHASE.properties b/devices/SINEG01-RSYS:SET-BEAM-PHASE.properties
index 9ebc166..d56e183 100755
--- a/devices/SINEG01-RSYS:SET-BEAM-PHASE.properties
+++ b/devices/SINEG01-RSYS:SET-BEAM-PHASE.properties
@@ -3,7 +3,7 @@ maxValue=360.0
minValue=-360.0
offset=0.0
precision=3
-resolution=0.1
+deadband=0.1
rotation=false
scale=1.0
unit=deg
diff --git a/devices/SINSB01_phase.properties b/devices/SINSB01_phase.properties
index 3367de0..3ba0e43 100755
--- a/devices/SINSB01_phase.properties
+++ b/devices/SINSB01_phase.properties
@@ -3,7 +3,7 @@ maxValue=360.0
minValue=0.0
offset=0.0
precision=3
-resolution=NaN
+deadband=NaN
rotation=false
scale=1.0
unit=Degree
diff --git a/devices/STEST01-RSYS:SET-VSUM-PHASE.properties b/devices/STEST01-RSYS:SET-VSUM-PHASE.properties
index a3ae393..dafc8fb 100755
--- a/devices/STEST01-RSYS:SET-VSUM-PHASE.properties
+++ b/devices/STEST01-RSYS:SET-VSUM-PHASE.properties
@@ -3,7 +3,7 @@ maxValue=360.0
minValue=-90.0
offset=0.0
precision=3
-resolution=0.1
+deadband=0.1
rotation=true
scale=1.0
unit=deg
diff --git a/devices/SimMotor.properties b/devices/SimMotor.properties
index 954fd2c..9abc432 100755
--- a/devices/SimMotor.properties
+++ b/devices/SimMotor.properties
@@ -7,7 +7,7 @@ minSpeed=0.1
minValue=-10.0
offset=0.0
precision=2
-resolution=NaN
+deadband=NaN
rotation=false
scale=1.0
unit=mm
diff --git a/devices/TDS Phase.properties b/devices/TDS Phase.properties
index 2e0e77a..8aef414 100644
--- a/devices/TDS Phase.properties
+++ b/devices/TDS Phase.properties
@@ -8,4 +8,4 @@ precision=4
sign_bit=0
scale=1.0
description=Dest. beam phase
-resolution=0.05
+deadband=0.05
diff --git a/devices/Test.properties b/devices/Test.properties
index 012ef8a..d5c408f 100755
--- a/devices/Test.properties
+++ b/devices/Test.properties
@@ -3,7 +3,7 @@ maxValue=NaN
minValue=NaN
offset=0.0
precision=-1
-resolution=NaN
+deadband=NaN
rotation=false
scale=1.0
unit=null
diff --git a/devices/TestCV.properties b/devices/TestCV.properties
index 431eb41..f8541db 100644
--- a/devices/TestCV.properties
+++ b/devices/TestCV.properties
@@ -3,7 +3,7 @@ offset=0.0
maxValue=210.0
precision=1
scale=1.0
-resolution=NaN
+deadband=NaN
minValue=0.0
unit=A
sign_bit=0
diff --git a/devices/TestP.properties b/devices/TestP.properties
index 74c7845..040dc79 100644
--- a/devices/TestP.properties
+++ b/devices/TestP.properties
@@ -4,7 +4,7 @@ maxValue=210.0
rotation=false
precision=1
scale=1.0
-resolution=NaN
+deadband=NaN
minValue=0.0
unit=A
sign_bit=0
diff --git a/devices/Time.properties b/devices/Time.properties
index 29e5cb0..d2a214d 100755
--- a/devices/Time.properties
+++ b/devices/Time.properties
@@ -8,4 +8,4 @@ rotation=false
sign_bit=0
scale=1.0
description=null
-resolution=NaN
+deadband=NaN
diff --git a/devices/WireScanner motor.properties b/devices/WireScanner motor.properties
index ebeacfc..b1d55d1 100755
--- a/devices/WireScanner motor.properties
+++ b/devices/WireScanner motor.properties
@@ -1,19 +1,19 @@
-#Thu Dec 11 15:41:25 CET 2025
+#Sat Feb 07 18:10:03 CET 2026
+deadband=0.1
+defaultSpeed=2000.0
+description=PPMAC motor record
+estbilizationDelay=0
+hasEnable=false
+homingType=None
+maxSpeed=2000.0
+maxValue=51500.0
+minSpeed=5.0
+minValue=-66903.0
+monitorByPosition=false
offset=0.0
-maxValue=68500.0
precision=1
rotation=false
scale=1.0
-description=PPMAC motor record
-estbilizationDelay=0
-maxSpeed=2000.0
-resolution=0.1
-homingType=None
-startRetries=1
-minValue=-70000.0
-unit=um
-defaultSpeed=2000.0
-hasEnable=false
sign_bit=0
-monitorByPosition=false
-minSpeed=5.0
+startRetries=1
+unit=um
diff --git a/devices/beam_phase.properties b/devices/beam_phase.properties
index 149090e..d5ba3a1 100755
--- a/devices/beam_phase.properties
+++ b/devices/beam_phase.properties
@@ -3,6 +3,6 @@ maxValue=360.0
minValue=0.0
offset=0.0
precision=3
-resolution=NaN
+deadband=NaN
scale=1.0
unit=Degree
diff --git a/devices/bpm_1_down_gun.properties b/devices/bpm_1_down_gun.properties
index 9ba674a..a9dc564 100755
--- a/devices/bpm_1_down_gun.properties
+++ b/devices/bpm_1_down_gun.properties
@@ -3,6 +3,6 @@ maxValue=NaN
minValue=NaN
offset=0.0
precision=-1
-resolution=NaN
+deadband=NaN
scale=1.0
unit=null
diff --git a/devices/cam_server.properties b/devices/cam_server.properties
index fb33f42..83dc127 100755
--- a/devices/cam_server.properties
+++ b/devices/cam_server.properties
@@ -1,25 +1,26 @@
-#Fri Oct 03 16:35:45 CEST 2025
-spatialCalOffsetY=-795.999998704586
-spatialCalOffsetX=-873.9999719532899
-colormapLogarithmic=false
-scale=1.0
-grayscale=false
-spatialCalScaleX=-20.775623700157773
-spatialCalScaleY=-21.55172349612865
-colormapMax=NaN
-rescaleOffset=0.0
-roiWidth=-1
+#Sun Feb 08 08:34:51 CET 2026
colormap=Flame
-invert=false
+colormapAutomatic=true
+colormapLogarithmic=false
+colormapMax=NaN
colormapMin=NaN
+flipHorizontally=false
+flipVertically=false
+grayscale=false
+invert=false
+rescaleFactor=1.0
+rescaleOffset=0.0
+roiHeight=-1
+roiWidth=-1
+roiX=0
+roiY=0
rotation=0.0
rotationCrop=false
-rescaleFactor=1.0
+scale=1.0
+serverURL=null
+spatialCalOffsetX=-861.0000211619925
+spatialCalOffsetY=-829.0000262816876
+spatialCalScaleX=-18.90359092620482
+spatialCalScaleY=-19.607842977590828
spatialCalUnits=mm
-flipVertically=false
-roiHeight=-1
-flipHorizontally=false
-colormapAutomatic=true
-roiY=0
-roiX=0
transpose=false
diff --git a/devices/charge.properties b/devices/charge.properties
index dd3b894..124eedf 100755
--- a/devices/charge.properties
+++ b/devices/charge.properties
@@ -1,4 +1,4 @@
-#Tue Aug 16 16:27:15 CEST 2022
+#Wed Jan 07 13:30:45 CET 2026
minValue=NaN
unit=pC
offset=0.0
@@ -7,4 +7,5 @@ precision=1
sign_bit=0
scale=1.0
description=null
+deadband=NaN
resolution=NaN
diff --git a/devices/cv.properties b/devices/cv.properties
index 813be07..45ac602 100755
--- a/devices/cv.properties
+++ b/devices/cv.properties
@@ -3,6 +3,6 @@ maxValue=360.0
minValue=0.0
offset=0.0
precision=3
-resolution=NaN
+deadband=NaN
scale=1.0
unit=Degree
diff --git a/devices/energy_AR.properties b/devices/energy_AR.properties
index e7fbe47..c6556b9 100755
--- a/devices/energy_AR.properties
+++ b/devices/energy_AR.properties
@@ -1,4 +1,4 @@
-#Tue Aug 16 16:27:15 CEST 2022
+#Wed Jan 07 13:30:45 CET 2026
minValue=NaN
unit=MeV
offset=0.0
@@ -7,4 +7,5 @@ precision=3
sign_bit=0
scale=1.0
description=null
+deadband=NaN
resolution=NaN
diff --git a/devices/energy_B1.properties b/devices/energy_B1.properties
index 223ff7c..fc3ab74 100755
--- a/devices/energy_B1.properties
+++ b/devices/energy_B1.properties
@@ -3,7 +3,7 @@ maxValue=NaN
minValue=NaN
offset=0.0
precision=3
-resolution=NaN
+deadband=NaN
scale=1.0
sign_bit=0
unit=MeV
diff --git a/devices/gain 1.properties b/devices/gain 1.properties
index 0835d7b..cf5f96e 100755
--- a/devices/gain 1.properties
+++ b/devices/gain 1.properties
@@ -3,6 +3,6 @@ maxValue=NaN
minValue=NaN
offset=0.0
precision=-1
-resolution=NaN
+deadband=NaN
scale=1.0
unit=null
diff --git a/devices/gain 2.properties b/devices/gain 2.properties
index c3fb410..fa33708 100755
--- a/devices/gain 2.properties
+++ b/devices/gain 2.properties
@@ -3,6 +3,6 @@ maxValue=NaN
minValue=NaN
offset=0.0
precision=-1
-resolution=NaN
+deadband=NaN
scale=1.0
unit=null
diff --git a/devices/gain.properties b/devices/gain.properties
index 2233327..cf6b08b 100755
--- a/devices/gain.properties
+++ b/devices/gain.properties
@@ -3,6 +3,6 @@ maxValue=NaN
minValue=NaN
offset=0.0
precision=-1
-resolution=NaN
+deadband=NaN
scale=1.0
unit=null
diff --git a/devices/gsrx.properties b/devices/gsrx.properties
index 102f6f0..358c49e 100755
--- a/devices/gsrx.properties
+++ b/devices/gsrx.properties
@@ -8,4 +8,4 @@ rotation=false
sign_bit=0
scale=1.0
description=null
-resolution=NaN
+deadband=NaN
diff --git a/devices/gsry.properties b/devices/gsry.properties
index 102f6f0..358c49e 100755
--- a/devices/gsry.properties
+++ b/devices/gsry.properties
@@ -8,4 +8,4 @@ rotation=false
sign_bit=0
scale=1.0
description=null
-resolution=NaN
+deadband=NaN
diff --git a/devices/gsx.properties b/devices/gsx.properties
index 53f20f9..038b710 100755
--- a/devices/gsx.properties
+++ b/devices/gsx.properties
@@ -8,4 +8,4 @@ rotation=false
sign_bit=0
scale=1.0
description=null
-resolution=NaN
+deadband=NaN
diff --git a/devices/gsy.properties b/devices/gsy.properties
index 53f20f9..038b710 100755
--- a/devices/gsy.properties
+++ b/devices/gsy.properties
@@ -8,4 +8,4 @@ rotation=false
sign_bit=0
scale=1.0
description=null
-resolution=NaN
+deadband=NaN
diff --git a/devices/gun_phase.properties b/devices/gun_phase.properties
index d630282..5ccf027 100755
--- a/devices/gun_phase.properties
+++ b/devices/gun_phase.properties
@@ -1,4 +1,4 @@
-#Tue Aug 16 16:27:15 CEST 2022
+#Wed Jan 07 13:30:45 CET 2026
minValue=-179.99
unit=DEG
offset=0.0
@@ -8,4 +8,5 @@ rotation=false
sign_bit=0
scale=1.0
description=null
-resolution=1.0
+deadband=1.0
+resolution=NaN
diff --git a/devices/gun_sol_current.properties b/devices/gun_sol_current.properties
index c443463..cf14120 100755
--- a/devices/gun_sol_current.properties
+++ b/devices/gun_sol_current.properties
@@ -3,6 +3,6 @@ maxValue=210.0
minValue=0.0
offset=0.0
precision=3
-resolution=NaN
+deadband=NaN
scale=1.0
unit=A
diff --git a/devices/gun_solenoid.properties b/devices/gun_solenoid.properties
index d9c7081..1b41728 100755
--- a/devices/gun_solenoid.properties
+++ b/devices/gun_solenoid.properties
@@ -1,4 +1,4 @@
-#Tue Aug 16 16:27:15 CEST 2022
+#Wed Jan 07 13:30:45 CET 2026
minValue=0.0
unit=A
offset=0.0
@@ -8,4 +8,5 @@ rotation=false
sign_bit=0
scale=1.0
description=null
-resolution=0.02
+deadband=0.02
+resolution=NaN
diff --git a/devices/kick.properties b/devices/kick.properties
index 4ff8701..3df957b 100755
--- a/devices/kick.properties
+++ b/devices/kick.properties
@@ -7,4 +7,4 @@ rotation=false
precision=3
sign_bit=0
scale=1.0
-resolution=0.1
+deadband=0.1
diff --git a/devices/kick1.properties b/devices/kick1.properties
index 61f5264..1de0165 100755
--- a/devices/kick1.properties
+++ b/devices/kick1.properties
@@ -7,4 +7,4 @@ rotation=false
precision=3
sign_bit=0
scale=1.0
-resolution=NaN
+deadband=NaN
diff --git a/devices/kick2.properties b/devices/kick2.properties
index 61f5264..1de0165 100755
--- a/devices/kick2.properties
+++ b/devices/kick2.properties
@@ -7,4 +7,4 @@ rotation=false
precision=3
sign_bit=0
scale=1.0
-resolution=NaN
+deadband=NaN
diff --git a/devices/kick3.properties b/devices/kick3.properties
index 812ef22..eadb14b 100755
--- a/devices/kick3.properties
+++ b/devices/kick3.properties
@@ -7,4 +7,4 @@ rotation=false
precision=3
sign_bit=0
scale=1.0
-resolution=NaN
+deadband=NaN
diff --git a/devices/m1.properties b/devices/m1.properties
index e74d0ab..46019ad 100755
--- a/devices/m1.properties
+++ b/devices/m1.properties
@@ -7,7 +7,7 @@ scale=1.0
description=null
estbilizationDelay=0
maxSpeed=10.0
-resolution=NaN
+deadband=NaN
startRetries=1
minValue=-10.0
unit=mm
diff --git a/devices/m2.properties b/devices/m2.properties
index e74d0ab..46019ad 100755
--- a/devices/m2.properties
+++ b/devices/m2.properties
@@ -7,7 +7,7 @@ scale=1.0
description=null
estbilizationDelay=0
maxSpeed=10.0
-resolution=NaN
+deadband=NaN
startRetries=1
minValue=-10.0
unit=mm
diff --git a/devices/m3.properties b/devices/m3.properties
index 84d6771..a4b86dc 100755
--- a/devices/m3.properties
+++ b/devices/m3.properties
@@ -7,6 +7,6 @@ minSpeed=0.1
minValue=-10.0
offset=0.0
precision=2
-resolution=NaN
+deadband=NaN
scale=1.0
unit=mm
diff --git a/devices/mot.properties b/devices/mot.properties
index 558d71a..c91e510 100755
--- a/devices/mot.properties
+++ b/devices/mot.properties
@@ -7,6 +7,6 @@ minSpeed=0.1
minValue=-10.0
offset=0.0
precision=2
-resolution=NaN
+deadband=NaN
scale=1.0
unit=mm
diff --git a/devices/p1.properties b/devices/p1.properties
index 3a98f61..172d373 100755
--- a/devices/p1.properties
+++ b/devices/p1.properties
@@ -8,4 +8,4 @@ rotation=false
sign_bit=0
scale=1.0
description=null
-resolution=NaN
+deadband=NaN
diff --git a/devices/pbpg_mx.properties b/devices/pbpg_mx.properties
index bc87caa..0f89abf 100755
--- a/devices/pbpg_mx.properties
+++ b/devices/pbpg_mx.properties
@@ -9,7 +9,7 @@ minSpeed=NaN
minValue=-0.6
offset=0.0
precision=3
-resolution=0.02
+deadband=0.02
rotation=false
scale=1.0
unit=mm
diff --git a/devices/pbpg_my.properties b/devices/pbpg_my.properties
index a2d476c..662116f 100755
--- a/devices/pbpg_my.properties
+++ b/devices/pbpg_my.properties
@@ -9,7 +9,7 @@ minSpeed=NaN
minValue=-1.4
offset=0.0
precision=3
-resolution=0.02
+deadband=0.02
rotation=false
scale=1.0
unit=mm
diff --git a/devices/pos.properties b/devices/pos.properties
index 44422f8..3312afc 100755
--- a/devices/pos.properties
+++ b/devices/pos.properties
@@ -7,4 +7,4 @@ precision=3
rotation=false
sign_bit=0
scale=1.0
-resolution=NaN
+deadband=NaN
diff --git a/devices/positioner.properties b/devices/positioner.properties
index d452287..9d873fb 100755
--- a/devices/positioner.properties
+++ b/devices/positioner.properties
@@ -1,9 +1,10 @@
-#Thu Sep 27 07:12:39 CEST 2018
+#Tue Dec 16 10:03:37 CET 2025
+deadband=NaN
+description=null
maxValue=NaN
minValue=NaN
offset=0.0
precision=-1
-resolution=NaN
rotation=false
scale=1.0
sign_bit=0
diff --git a/devices/pv.properties b/devices/pv.properties
index 5ea8da8..7730fff 100755
--- a/devices/pv.properties
+++ b/devices/pv.properties
@@ -3,6 +3,6 @@ maxValue=0.0
minValue=0.0
offset=0.0
precision=3
-resolution=0.01
+deadband=0.01
scale=1.0
unit=Degree
diff --git a/devices/quad.properties b/devices/quad.properties
index 439f98b..0598b4a 100755
--- a/devices/quad.properties
+++ b/devices/quad.properties
@@ -7,4 +7,4 @@ rotation=false
precision=3
sign_bit=0
scale=1.0
-resolution=NaN
+deadband=NaN
diff --git a/devices/rep_rate.properties b/devices/rep_rate.properties
index dd8297a..2f20ea4 100755
--- a/devices/rep_rate.properties
+++ b/devices/rep_rate.properties
@@ -3,7 +3,7 @@ maxValue=NaN
minValue=NaN
offset=0.0
precision=2
-resolution=NaN
+deadband=NaN
scale=1.0
sign_bit=0
unit=Hz
diff --git a/devices/rep_rate_bunch_1.properties b/devices/rep_rate_bunch_1.properties
index 86603f5..f747f19 100644
--- a/devices/rep_rate_bunch_1.properties
+++ b/devices/rep_rate_bunch_1.properties
@@ -1,4 +1,4 @@
-#Tue Aug 16 16:29:34 CEST 2022
+#Wed Jan 07 13:30:45 CET 2026
minValue=0.0
unit=Hz
offset=0.0
@@ -7,4 +7,5 @@ precision=2
sign_bit=0
scale=1.0
description=null
+deadband=NaN
resolution=NaN
diff --git a/devices/rep_rate_bunch_2.properties b/devices/rep_rate_bunch_2.properties
index 86603f5..f747f19 100644
--- a/devices/rep_rate_bunch_2.properties
+++ b/devices/rep_rate_bunch_2.properties
@@ -1,4 +1,4 @@
-#Tue Aug 16 16:29:34 CEST 2022
+#Wed Jan 07 13:30:45 CET 2026
minValue=0.0
unit=Hz
offset=0.0
@@ -7,4 +7,5 @@ precision=2
sign_bit=0
scale=1.0
description=null
+deadband=NaN
resolution=NaN
diff --git a/devices/rot 1.properties b/devices/rot 1.properties
index 9cdd5b4..df93ade 100755
--- a/devices/rot 1.properties
+++ b/devices/rot 1.properties
@@ -3,7 +3,7 @@ maxValue=NaN
minValue=NaN
offset=0.0
precision=-1
-resolution=NaN
+deadband=NaN
rotation=false
scale=1.0
unit=null
diff --git a/devices/scanner.properties b/devices/scanner.properties
index 8396081..63a78d8 100755
--- a/devices/scanner.properties
+++ b/devices/scanner.properties
@@ -3,7 +3,7 @@ maxValue=NaN
minValue=NaN
offset=0.0
precision=-1
-resolution=NaN
+deadband=NaN
rotation=false
scale=1.0
sign_bit=0
diff --git a/docker/Dockerfile b/docker/Dockerfile
deleted file mode 100755
index 349a5b1..0000000
--- a/docker/Dockerfile
+++ /dev/null
@@ -1,12 +0,0 @@
-FROM docker.psi.ch:5000/busybox_java
-#COPY ./pshell-1.7.0-fat.jar /pshell/
-RUN cd /
-RUN mkdir pshell
-RUN cd /pshell
-RUN wget -O /pshell/pshell-1.7.0-fat.jar http://artifacts.psi.ch/artifactory/releases/ch/psi/pshell/1.7.0/pshell-1.7.0-fat.jar --no-check-certificate
-#RUN ls /pshell
-
-#COPY ./home/ /pshell/home/
-EXPOSE 5000-10000
-
-CMD ls -al /pshell/home/log; while true; do echo "Starting";java -Djava.awt.headless=true -jar /pshell/pshell-1.7.0-fat.jar -v -home=/pshell/home -clog=FINE; done
\ No newline at end of file
diff --git a/docker/build.sh b/docker/build.sh
deleted file mode 100755
index 2937d85..0000000
--- a/docker/build.sh
+++ /dev/null
@@ -1,6 +0,0 @@
-#!/bin/bash
-VERSION=1.7.0
-docker build --no-cache=true -t docker.psi.ch:5000/pshell_server .
-docker tag docker.psi.ch:5000/pshell_server docker.psi.ch:5000/pshell_server:$VERSION
-docker push docker.psi.ch:5000/pshell_server:$VERSION
-docker push docker.psi.ch:5000/pshell_server
diff --git a/docker/start.sh b/docker/start.sh
deleted file mode 100755
index a97ad47..0000000
--- a/docker/start.sh
+++ /dev/null
@@ -1,3 +0,0 @@
-#!/bin/bash
-docker run --network="host" --name pshellsrv -v /home/gobbo/docker/home:/pshell/home -v /etc/timezone:/etc/timezone:ro -v /etc/localtime:/etc/localtime:ro docker.psi.ch:5000/pshell_server &
-
diff --git a/docker/stop.sh b/docker/stop.sh
deleted file mode 100755
index e1b4c3c..0000000
--- a/docker/stop.sh
+++ /dev/null
@@ -1,3 +0,0 @@
-#!/bin/bash
-docker stop pshellsrv
-docker rm pshellsrv
diff --git a/docker/wb.sh b/docker/wb.sh
deleted file mode 100755
index 6291ddc..0000000
--- a/docker/wb.sh
+++ /dev/null
@@ -1,7 +0,0 @@
-#!/bin/bash
-
-wget -O ./pshell-1.7.0-fat.jar http://artifacts.psi.ch/artifactory/releases/ch/psi/pshell/1.7.0/pshell-1.7.0-fat.jar --no-check-certificate
-
-java -jar ./pshell-1.7.0-fat.jar -o -dlaf
-
-rm ./pshell-1.7.0-fat.jar
\ No newline at end of file
diff --git a/plugins/BunchLength.form b/plugins/BunchLength.form
index f25d25a..fc15593 100755
--- a/plugins/BunchLength.form
+++ b/plugins/BunchLength.form
@@ -84,7 +84,7 @@
-
+
diff --git a/plugins/BunchLength.java b/plugins/BunchLength.java
index f6eabc6..7d4ec15 100755
--- a/plugins/BunchLength.java
+++ b/plugins/BunchLength.java
@@ -2,20 +2,16 @@
* Copyright (c) 2014-2017 Paul Scherrer Institute. All rights reserved.
*/
-import ch.psi.pshell.core.Context;
import ch.psi.pshell.plot.LinePlot;
-import ch.psi.pshell.plot.LinePlotSeries;
-import ch.psi.pshell.ui.Panel;
-import ch.psi.pshell.ui.App;
-import ch.psi.pshell.ui.AppListener;
-import ch.psi.utils.State;
-import ch.psi.utils.swing.SwingUtils;
-import java.awt.Color;
+import ch.psi.pshell.framework.App;
+import ch.psi.pshell.app.AppListener;
+import ch.psi.pshell.framework.Panel;
+import ch.psi.pshell.utils.State;
+import ch.psi.pshell.swing.SwingUtils;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
-import javax.script.ScriptException;
import javax.swing.JSpinner;
/**
diff --git a/plugins/CameraCalibrationDialog.form b/plugins/CameraCalibrationDialog.form
deleted file mode 100755
index 4ac7ff9..0000000
--- a/plugins/CameraCalibrationDialog.form
+++ /dev/null
@@ -1,545 +0,0 @@
-
-
-
diff --git a/plugins/CameraCalibrationDialog.java b/plugins/CameraCalibrationDialog.java
deleted file mode 100755
index 2a93151..0000000
--- a/plugins/CameraCalibrationDialog.java
+++ /dev/null
@@ -1,726 +0,0 @@
-
-
-import ch.psi.utils.swing.StandardDialog;
-import ch.psi.utils.swing.SwingUtils;
-import ch.psi.pshell.bs.CameraServer;
-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.pshell.ui.App;
-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 CameraCalibrationDialog extends StandardDialog {
-
- CameraServer server;
- 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 CameraCalibrationDialog(Frame parent, String cameraName, Renderer renderer) throws IOException {
- super(parent, cameraName, false);
-
- initComponents();
-
- if (App.hasArgument("cam_srv_url")) {
- this.server = new CameraServer("Camera Server", App.getArgumentValue("cam_srv_url"));
- } else {
- this.server = new CameraServer("Camera Server");
- }
-
-
- this.cameraName = cameraName;
- this.renderer = renderer;
-
- Map config = server.getConfig(cameraName);
- Map calibration = (Map) config.get("camera_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")));
- ckCalibrationEnabled.setSelected(calibration!=null);
- 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("angle_horizontal")).doubleValue());
- spinnerAngleVer.setValue(((Number)calibration.get("angle_vertical")).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();
-
-
- 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;
- server.close();
- }
-
-
- 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();
- double angleHor = (Double)spinnerAngleHor.getValue();
- double angleVer = (Double)spinnerAngleVer.getValue();
- double pixelHor = width * Math.cos(Math.toRadians(angleHor)) /Math.abs(right-left);
- double pixelVer = height * Math.cos(Math.toRadians(angleVer)) /Math.abs(bottom-top);
- textOriginX.setText(String.valueOf((left+right)/2));
- textOriginY.setText(String.valueOf((top+bottom)/2));
- textPixelSizeX.setText(String.valueOf(Convert.roundDouble(pixelHor, 2)));
- textPixelSizeY.setText(String.valueOf(Convert.roundDouble(pixelVer, 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" ;
- //java.awt.EventQueue.invokeLater(() -> {
- Renderer renderer = new Renderer();
- JDialog dlgRenderer = SwingUtils.showDialog(null, cameraName, new Dimension(600,400), renderer);
- CameraCalibrationDialog dialog = new CameraCalibrationDialog(null, cameraName, renderer);
- dialog.addWindowListener(new java.awt.event.WindowAdapter() {
- @Override
- public void windowClosing(java.awt.event.WindowEvent e) {
- dlgRenderer.setVisible(false);
- 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();
- ckCalibrationEnabled = new javax.swing.JCheckBox();
- 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();
- buttonApply = 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);
- }
- });
-
- ckCalibrationEnabled.setText("Enabled");
-
- 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(9, 9, 9)
- .addComponent(ckCalibrationEnabled)
- .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, 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)
- .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
- .addComponent(buttonFetch)
- .addComponent(ckCalibrationEnabled))
- .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);
- }
- });
-
- buttonApply.setText("Apply");
- buttonApply.addActionListener(new java.awt.event.ActionListener() {
- public void actionPerformed(java.awt.event.ActionEvent evt) {
- buttonApplyActionPerformed(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(buttonCancel)
- .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
- .addComponent(buttonApply)
- .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
- .addComponent(buttonOk)
- .addGap(0, 0, Short.MAX_VALUE)))
- .addContainerGap())
- );
-
- layout.linkSize(javax.swing.SwingConstants.HORIZONTAL, new java.awt.Component[] {buttonApply, 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)
- .addComponent(buttonApply))
- .addContainerGap())
- );
- }// //GEN-END:initComponents
-
- private void buttonOkActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_buttonOkActionPerformed
-
- buttonApplyActionPerformed(evt);
- 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).doubleValue());
- spinnerAngleVer.setValue(calib.get(3).doubleValue());
- } 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
-
- private void buttonApplyActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_buttonApplyActionPerformed
- try {
- 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);
- System.out.println("Updating " + cameraName + " configuration");
- HashMap calibration = null;
- if (ckCalibrationEnabled.isSelected()){
- 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("angle_horizontal", angleHor);
- calibration.put("angle_vertical", angleVer);
- }
-
- Map config = server.getConfig(cameraName);
- config.put("camera_calibration", calibration);
- config.put("mirror_x", checkMirrorX.isSelected());
- config.put("mirror_y", checkMirrorY.isSelected());
- config.put("rotate", comboRotation.getSelectedIndex());
- server.setConfig(cameraName, config);
-
- System.out.println("New config: " + config);
- boolean reticle = renderer.getShowReticle();
- if (reticle){
- renderer.setShowReticle(false);
- }
- SwingUtils.showMessage(this, "Success", "Updated " + cameraName + " configuration");
-
- if (reticle){
- renderer.setShowReticle(true);
- }
- } catch (Exception ex) {
- SwingUtils.showException(this, ex);
- }
- }//GEN-LAST:event_buttonApplyActionPerformed
-
-
- // Variables declaration - do not modify//GEN-BEGIN:variables
- private javax.swing.JButton buttonApply;
- 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.JCheckBox ckCalibrationEnabled;
- 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/CameraConfigDialog.form b/plugins/CameraConfigDialog.form
deleted file mode 100755
index 73ac4fd..0000000
--- a/plugins/CameraConfigDialog.form
+++ /dev/null
@@ -1,524 +0,0 @@
-
-
-
diff --git a/plugins/CameraConfigDialog.java b/plugins/CameraConfigDialog.java
deleted file mode 100755
index a5549a3..0000000
--- a/plugins/CameraConfigDialog.java
+++ /dev/null
@@ -1,696 +0,0 @@
-
-
-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();
- double angleHor = (Double)spinnerAngleHor.getValue();
- double angleVer = (Double)spinnerAngleVer.getValue();
- double pixelHor = width * Math.cos(Math.toRadians(angleHor)) /Math.abs(right-left);
- double pixelVer = height * Math.cos(Math.toRadians(angleVer)) /Math.abs(bottom-top);
- textOriginX.setText(String.valueOf((left+right)/2));
- textOriginY.setText(String.valueOf((top+bottom)/2));
- textPixelSizeX.setText(String.valueOf(Convert.roundDouble(pixelHor, 2)));
- textPixelSizeY.setText(String.valueOf(Convert.roundDouble(pixelVer, 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/Cameras.form b/plugins/Cameras.form
deleted file mode 100755
index f0d2e57..0000000
--- a/plugins/Cameras.form
+++ /dev/null
@@ -1,189 +0,0 @@
-
-
-
diff --git a/plugins/Cameras.java b/plugins/Cameras.java
deleted file mode 100755
index f2aa083..0000000
--- a/plugins/Cameras.java
+++ /dev/null
@@ -1,847 +0,0 @@
-/*
- * Copyright (c) 2014 Paul Scherrer Institute. All rights reserved.
- */
-
-import ch.psi.pshell.core.Context;
-import java.io.File;
-import java.io.IOException;
-import java.nio.file.Paths;
-import javax.swing.DefaultComboBoxModel;
-import ch.psi.pshell.ui.Panel;
-import ch.psi.pshell.imaging.ImageListener;
-import ch.psi.utils.State;
-import ch.psi.utils.IO;
-import ch.psi.utils.swing.SwingUtils;
-import ch.psi.utils.swing.TextEditor;
-import ch.psi.pshell.epics.PsiCamera;
-import ch.psi.pshell.epics.Camtool;
-import ch.psi.pshell.core.JsonSerializer;
-import ch.psi.pshell.device.Device;
-import ch.psi.pshell.epics.ArraySource;
-import ch.psi.pshell.epics.ChannelDouble;
-import ch.psi.pshell.epics.ChannelDoubleArray;
-import ch.psi.pshell.epics.ChannelInteger;
-import ch.psi.pshell.epics.ChannelIntegerArray;
-import ch.psi.pshell.ui.App;
-import ch.psi.pshell.imaging.Data;
-import ch.psi.pshell.imaging.Overlay;
-import ch.psi.pshell.imaging.Overlays;
-import ch.psi.pshell.imaging.Overlays.Text;
-import ch.psi.pshell.imaging.Pen;
-import ch.psi.pshell.imaging.Renderer.Profile;
-import ch.psi.pshell.imaging.Source;
-import ch.psi.pshell.imaging.Utils;
-import ch.psi.pshell.scripting.InterpreterResult;
-import ch.psi.pshell.scripting.ScriptManager;
-import ch.psi.utils.Arr;
-import ch.psi.utils.ArrayProperties;
-import ch.psi.utils.Convert;
-import ch.psi.utils.Str;
-import ch.psi.utils.swing.Editor.EditorDialog;
-import java.awt.Color;
-import java.awt.Component;
-import java.awt.Dimension;
-import java.awt.Font;
-import java.awt.Point;
-import java.awt.image.BufferedImage;
-import java.nio.file.Files;
-import java.nio.file.Path;
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.HashMap;
-import java.util.List;
-import java.util.logging.Level;
-import java.util.logging.Logger;
-import org.apache.commons.math3.analysis.function.Gaussian;
-import org.apache.commons.math3.fitting.GaussianCurveFitter;
-import org.apache.commons.math3.fitting.WeightedObservedPoint;
-import org.apache.commons.math3.stat.descriptive.DescriptiveStatistics;
-/**
- *
- */
-public class Cameras extends Panel {
-
- public Cameras() {
- initComponents();
- renderer.setPersistenceFile(Paths.get(getContext().getSetup().getContextPath(), "Renderer_Cameras.bin"));
- setPersistedComponents(new Component[]{checkCamtool});
- comboCameras.setEnabled(false);
- if (App.hasArgument("poll")) {
- try{
- polling = Integer.valueOf(App.getArgumentValue("poll"));
- } catch (Exception ex){
- ex.printStackTrace();
- }
- }
- if (App.hasArgument("zoom")) {
- try{
- renderer.setDefaultZoom(Double.valueOf(App.getArgumentValue("zoom")));
- renderer.resetZoom();
- } catch (Exception ex){
- ex.printStackTrace();
- }
- }
- }
-
- @Override
- public void onStart() {
- super.onStart();
- if (App.hasArgument("ct")) {
- checkCamtool.setSelected(!App.getArgumentValue("ct").equals("0") && !App.getArgumentValue("ct").equalsIgnoreCase("false"));
- }
- }
-
- final String configFolder = "/afs/psi.ch/intranet/SF/Applications/config/camtool";
- File[] cameraConfigFiles = new File[0];
- ArraySource camera;
- String cameraName;
- String cameraConfigJson;
- CameraConfig config;
- int polling = 1000;
- Overlay marker = null;
-
- //Overridable callbacks
- @Override
- public void onInitialize(int runCount) {
- comboCameras.setEnabled(false);
- if (App.hasArgument("s")){
- renderer.setDevice((Source)getDevice("image"));
- renderer.setAutoScroll(true);
- ((Source)getDevice("image")).addListener(new ImageListener() {
- @Override
- public void onImage(Object o, BufferedImage bi, Data data) {
- if (bi == null) {
- fitOv = null;
- } else {
- Overlay[] profile = renderer.getProfileOverlays();
- profile = ((profile != null) && (profile.length==4)) ? getFitOverlays(data) : null;
- renderer.updateOverlays(profile, fitOv);
- fitOv = profile;
- }
- }
- @Override
- public void onError(Object o, Exception excptn) {
- }
- }
- );
-
- } else {
- cameraConfigFiles = IO.listFiles(configFolder, new String[]{"json"});
- Arrays.sort(cameraConfigFiles, (a, b) -> a.compareTo(b));
- DefaultComboBoxModel model = new DefaultComboBoxModel();
- for (File file : cameraConfigFiles) {
- String prefix = IO.getPrefix(file);
- if (!prefix.startsWith("#")) {
- model.addElement(prefix);
- }
- }
- comboCameras.setModel(model);
- comboCameras.setEnabled(true);
- comboCameras.setSelectedItem(-1);
- if (model.getSize() > 0) {
- try {
- //setCamera((String)comboCameras.getSelectedItem());
- if (App.hasArgument("cam")) {
- comboCameras.setSelectedItem(App.getArgumentValue("cam"));
- }
- } catch (Exception ex) {
- ex.printStackTrace();
- }
- }
- }
- startTimer(1000);
- }
-
- @Override
- public void onStateChange(State state, State former) {
-
- }
-
- @Override
- public void onExecutedFile(String fileName, Object result) {
- }
-
- //Callback to perform update - in event thread
- @Override
- protected void doUpdate() {
- }
-
- public static class CameraConfig {
-
- public HashMap kwargs;
- public ArrayList args;
- public ArrayList links;
- public String type;
- public HashMap state;
- public CameraConfig image_source;
- public HashMap subcomponents;
-
- public ArrayList getCalibration() {
- return (ArrayList) state.get("calibration");
- }
-
- public double getCalOffsetX(){
- ArrayList calibration = getCalibration();
- double ret = - (calibration.get(0) + calibration.get(2))/2;
- return ret;
- }
-
- public double getCalOffsetY(){
- ArrayList calibration = getCalibration();
- double ret = - (calibration.get(1) + calibration.get(3))/2;
- return ret;
- }
-
- public double getScaleX(){
- ArrayList calibration = getCalibration();
- double width = Math.abs( calibration.get(2) - calibration.get(0));
- return getCalibrationWidth()/width;
- //return getCalibrationWidth()/1000;
- }
-
- public double getScaleY(){
- ArrayList calibration = getCalibration();
- double height = Math.abs( calibration.get(3) - calibration.get(1));
- return getCalibrationHeight()/height;
- }
-
-
- public Double getCalibrationHeight() {
- return (Double) state.get("calibration_height");
- }
-
- public Double getCalibrationWidth() {
- return (Double) state.get("calibration_width");
- }
-
- public Double getCalibrationHorizontalAngle() {
- return (Double) state.get("calibration_horizontal_angle");
- }
-
- public Double getCalibrationVerticalAngle() {
- return (Double) state.get("calibration_vertical_angle");
- }
-
- public Boolean getMirrorX() {
- return (Boolean) state.get("mirror_x");
- }
-
- public Boolean getMirrorY() {
- return (Boolean) state.get("mirror_y");
- }
-
- public Integer getRotate() {
- return (Integer) state.get("rotate");
- }
-
- public ArrayList getOrigin() {
- return (ArrayList) state.get("origin");
- }
-
- public ArrayList getRoi() {
- return (ArrayList) state.get("roi");
- }
-
- public Boolean getRoiEnable() {
- if ((state.get("roi_enable") == null) || (state.get("roi") == null)) {
- return false;
- }
- return (Boolean) state.get("roi_enable");
- }
-
- public ArrayList getUnitSize() {
- return (ArrayList) state.get("unit_size");
- }
-
- public Integer getRun() {
- return (Integer) state.get("run");
- }
- }
-
- Overlay[] fitOv;
-
- void setCamera(String cameraName) throws IOException, InterruptedException {
- System.out.println("Setting camera: " + cameraName);
- if (camera != null) {
- camera.close();
- camera = null;
- renderer.setDevice(null);
- renderer.setShowReticle(false);
- renderer.removeOverlays(fitOv);
- renderer.clear();
- renderer.resetZoom();
- }
- try {
- Path configFile = Paths.get(configFolder, cameraName + ".json");
- cameraConfigJson = new String(Files.readAllBytes(configFile));
- this.cameraName = cameraName;
- //SwingUtils.showMessage(null, "", json);
- try {
- if (checkCamtool.isSelected()) {
- camera = new Camtool("CurrentCamera", cameraName, false);
- camera.getConfig().flipHorizontally = false;
- camera.getConfig().flipVertically = false;
- camera.getConfig().rotation = 0.0;
- camera.getConfig().roiX = 0;
- camera.getConfig().roiY = 0;
- camera.getConfig().roiWidth = -1;
- camera.getConfig().roiHeight = -1;
- } else {
- camera = new PsiCamera("CurrentCamera", cameraName);
- config = (CameraConfig) JsonSerializer.decode(cameraConfigJson, CameraConfig.class);
- camera.getConfig().flipHorizontally = config.getMirrorX();
- camera.getConfig().flipVertically = config.getMirrorY();
- camera.getConfig().rotation = config.getRotate();
- camera.getConfig().rotationCrop = true;
- 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();
- camera.getConfig().spatialCalScaleX = config.getScaleX();
- camera.getConfig().spatialCalScaleY = config.getScaleY();
- } catch (Exception ex){
- camera.getConfig().spatialCalOffsetX = Double.NaN;
- camera.getConfig().spatialCalOffsetY = Double.NaN;
- camera.getConfig().spatialCalScaleX = Double.NaN;
- camera.getConfig().spatialCalScaleY = Double.NaN;
- }
- }
- } catch (Exception ex) {
- config = null;
- showException(ex);
- }
- camera.initialize();
- if (camera instanceof Camtool){
- try{
- camera.getConfig().spatialCalOffsetX = ((Camtool)camera).calOffX.read();
- camera.getConfig().spatialCalOffsetY = ((Camtool)camera).calOffY.read();
- camera.getConfig().spatialCalScaleX = ((Camtool)camera).calScaleX.read();
- camera.getConfig().spatialCalScaleY = ((Camtool)camera).calScaleY.read();
- } catch (Exception ex){
- ex.printStackTrace();
- camera.getConfig().spatialCalOffsetX = 0.0;
- camera.getConfig().spatialCalOffsetY = 0.0;
- camera.getConfig().spatialCalScaleX = 1.0;
- camera.getConfig().spatialCalScaleY = 1.0;
- }
- /*
- double[] origin = ((Camtool)camera).origin.read();
- if (origin.length>=2){
- camera.getConfig().spatialCalOffsetX = origin[0];
- camera.getConfig().spatialCalOffsetY = origin[1];
- }
- */
- }
- buttonReticle.setEnabled(camera.getConfig().isCalibrated());
- buttonGrabBackground.setEnabled(camera instanceof Camtool);
- camera.getConfig().save();
-
- if (polling<=0){
- camera.setMonitored(true);
- } else {
- camera.setPolling(-polling);
- }
- renderer.setDevice(camera);
- renderer.setAutoScroll(true);
- renderer.setMarker(marker);
-
- camera.addListener(new ImageListener() {
- @Override
- public void onImage(Object o, BufferedImage bi, Data data) {
- if (bi == null) {
- renderer.removeOverlays(fitOv);
- fitOv = null;
- } else {
- //System.out.println(bi.getWidth() + " - " + bi.getHeight());
- if (!renderer.isPaused() && buttonFit.isSelected()){
- Overlay[] profile = renderer.getProfileOverlays();
- profile = ((profile != null) && (profile.length==4)) ? getFitOverlays(data) : null;
- renderer.updateOverlays(profile, fitOv);
- fitOv = profile;
- }
- }
- }
-
- @Override
- public void onError(Object o, Exception excptn) {
- }
- });
- } catch (Exception ex) {
- if (renderer.getDevice()==null){
- renderer.setZoom(1.0);
- renderer.addOverlay(new Text(renderer.getPenErrorText(), ex.toString(), new Font("Verdana", Font.PLAIN, 12), new Point(20, 20)));
- }
- } finally {
- checkReticle();
- onTimer();
- }
- }
-
- void checkReticle(){
- if ((renderer.getDevice()!=null) && (camera!=null) && (camera.getConfig().isCalibrated()) && buttonReticle.isSelected()){
- renderer.setCalibration(camera.getCalibration());
- renderer.configureReticle(new Dimension(800,800), 200);
- renderer.setShowReticle(true);
- } else {
- renderer.setShowReticle(false);
- }
- renderer.refresh();
- }
-
- @Override
- protected void onTimer() {
- textState.setText((camera == null) ? "" : camera.getState().toString());
- buttonConfig.setEnabled(camera != null);
- if (App.hasArgument("s")){
- try {
- ((Source)getDevice("image")).initialize();
- } catch (IOException ex) {
- Logger.getLogger(Cameras.class.getName()).log(Level.SEVERE, null, ex);
- } catch (InterruptedException ex) {
- Logger.getLogger(Cameras.class.getName()).log(Level.SEVERE, null, ex);
- }
- }
- }
-
- Pen fitPen = new Pen(new Color(192, 105, 0), 1);
- Pen crossPen = new Pen(new Color(192, 105, 0), 1);
-
- Overlay[] getFitOverlays(Data data) {
- Overlays.Polyline hpoly = null;
- Overlays.Polyline vpoly = null;
- Double xMean = null;
- Double xSigma = null;
- Double yMean = null;
- Double ySigma = null;
- if (data != null) {
- //img = Utils.grayscale(img);
- int profileSize = Math.min(data.getWidth(), data.getHeight())/4;
-
- try {
- double[] sum = (double[]) Convert.toDouble(data.integrateVertically(true));
- int[] x = Arr.indexesInt(sum.length);
- DescriptiveStatistics stats = new DescriptiveStatistics(sum);
- double min = stats.getMin();
- for (int i = 0; i < sum.length; i++) {
- sum[i] = sum[i] - min;
- }
-
- double[] gaussian = fitGaussian(sum, x);
- if (gaussian != null) {
- if ((gaussian[2] < sum.length * 0.45) && (gaussian[0] > min * 0.03)) {
- double maxPlot = gaussian[0];
- xMean = gaussian[1];
- xSigma = gaussian[2];
- gaussian[0] += min;
- double[] fit = getFitFunction(gaussian, x);
- int[] y = new int[x.length];
- for (int i = 0; i < x.length; i++) {
- y[i] = (int) (data.getHeight() - 1 - ((fit[i] / maxPlot) * profileSize));
- }
- vpoly = new Overlays.Polyline(fitPen, x, y);
- }
- }
- } catch (Exception ex) {
- ex.printStackTrace();
- }
-
- try {
- double[] sum = (double[]) Convert.toDouble(data.integrateHorizontally(true));
- int[] x = Arr.indexesInt(sum.length);
- DescriptiveStatistics stats = new DescriptiveStatistics(sum);
- double min = stats.getMin();
- for (int i = 0; i < sum.length; i++) {
- sum[i] = sum[i] - min;
- }
-
- double[] gaussian = fitGaussian(sum, x);
- if (gaussian != null) {
- //Only aknowledge beam fully inside the image and peak over 3% of min
- if ((gaussian[2] < sum.length * 0.45) && (gaussian[0] > min * 0.03)) {
- double maxPlot = gaussian[0];
- yMean = gaussian[1];
- ySigma = gaussian[2];
- gaussian[0] += min;
- double[] fit = getFitFunction(gaussian, x);
-
- int[] y = new int[x.length];
- for (int i = 0; i < x.length; i++) {
- y[i] = (int) ((fit[i] / maxPlot) * profileSize);
- }
- hpoly = new Overlays.Polyline(fitPen, y, x);
- }
- }
-
- } catch (Exception ex) {
- ex.printStackTrace();
- }
-
- Overlays.Crosshairs cross = null;
- Overlays.Text text = null;
- if ((xMean != null) && (yMean != null)) {
- cross = new Overlays.Crosshairs(crossPen,
- new Point(xMean.intValue(), yMean.intValue()),
- new Dimension(2 * xSigma.intValue(), 2 * ySigma.intValue()));
-
- text = new Overlays.Text(fitPen,
- String.format("x = %f \n y = %f" , data.getX((int) Math.round(xMean)), data.getY((int) Math.round(yMean))),
- new Font(Font.MONOSPACED, 0, 14), new Point(20,20));
- }
-
- return new Overlay[]{hpoly, vpoly, cross, text};
- }
- return null;
- }
-
- double[] fitGaussianScript(int[] y, int[] x) {
- ScriptManager sm = Context.getInstance().getScriptManager();
- ArrayProperties pY = ArrayProperties.get(y);
- sm.setVar("y", y);
- sm.setVar("x", x);
- InterpreterResult r = sm.eval("r = fit_gaussians(y, x, [" + pY.maxIndex + ",])");
- if (r.exception != null) {
- r.exception.printStackTrace();
- } else {
- List ret = (List) sm.getVar("r");
- if ((ret != null) && (ret.size() == 1) && (ret.get(0) instanceof List) && (((List) (ret.get(0))).size() == 3)) {
- double norm = (Double) ((List) ret.get(0)).get(0);
- double mean = (Double) ((List) ret.get(0)).get(1);
- double sigma = (Double) ((List) ret.get(0)).get(2);
- return new double[]{norm, mean, sigma};
- }
- }
- return null;
- }
-
- double[] fitGaussian(double[] y, int[] x) {
- try {
- ArrayProperties pY = ArrayProperties.get(y);
- GaussianCurveFitter fitter = GaussianCurveFitter.create().withStartPoint(new double[]{(pY.max - pY.min) / 2, x[pY.maxIndex], 1.0}).withMaxIterations(1000);
- ArrayList values = new ArrayList<>();
- for (int i = 0; i < y.length; i++) {
- values.add(new WeightedObservedPoint(1.0, x[i], y[i]));
- }
- return fitter.fit(values);
- } catch (Exception ex) {
- return null;
- }
-
- }
-
- double[] getFitFunction(double[] pars, int[] x) {
- double[] fit = new double[x.length];
- Gaussian g = new Gaussian(pars[0], pars[1], pars[2]);
- for (int i = 0; i < x.length; i++) {
- fit[i] = g.value(x[i]);
- }
- return fit;
- }
-
-
- ////////
- @SuppressWarnings("unchecked")
- // //GEN-BEGIN:initComponents
- private void initComponents() {
-
- renderer = new ch.psi.pshell.imaging.Renderer();
- jLabel1 = new javax.swing.JLabel();
- comboCameras = new javax.swing.JComboBox();
- jLabel2 = new javax.swing.JLabel();
- textState = new javax.swing.JTextField();
- buttonConfig = new javax.swing.JButton();
- buttonSetup = new javax.swing.JButton();
- checkCamtool = new javax.swing.JCheckBox();
- buttonFit = new javax.swing.JToggleButton();
- buttonPause = new javax.swing.JToggleButton();
- buttonMarker = new javax.swing.JToggleButton();
- buttonSave = new javax.swing.JToggleButton();
- buttonReticle = new javax.swing.JToggleButton();
- buttonGrabBackground = new javax.swing.JButton();
-
- jLabel1.setText("Camera:");
-
- comboCameras.setMaximumRowCount(30);
- comboCameras.addActionListener(new java.awt.event.ActionListener() {
- public void actionPerformed(java.awt.event.ActionEvent evt) {
- comboCamerasActionPerformed(evt);
- }
- });
-
- jLabel2.setText("State:");
-
- textState.setEditable(false);
- textState.setHorizontalAlignment(javax.swing.JTextField.CENTER);
- textState.setDisabledTextColor(new java.awt.Color(0, 0, 0));
- textState.setEnabled(false);
-
- buttonConfig.setText("Config");
- buttonConfig.addActionListener(new java.awt.event.ActionListener() {
- public void actionPerformed(java.awt.event.ActionEvent evt) {
- buttonConfigActionPerformed(evt);
- }
- });
-
- buttonSetup.setText("Setup");
- buttonSetup.addActionListener(new java.awt.event.ActionListener() {
- public void actionPerformed(java.awt.event.ActionEvent evt) {
- buttonSetupActionPerformed(evt);
- }
- });
-
- checkCamtool.setSelected(true);
- checkCamtool.setText("Camtool");
-
- buttonFit.setSelected(true);
- buttonFit.setText("Fit");
- buttonFit.addActionListener(new java.awt.event.ActionListener() {
- public void actionPerformed(java.awt.event.ActionEvent evt) {
- buttonFitActionPerformed(evt);
- }
- });
-
- buttonPause.setText("Pause");
- buttonPause.addActionListener(new java.awt.event.ActionListener() {
- public void actionPerformed(java.awt.event.ActionEvent evt) {
- buttonPauseActionPerformed(evt);
- }
- });
-
- buttonMarker.setText("Marker");
- buttonMarker.addActionListener(new java.awt.event.ActionListener() {
- public void actionPerformed(java.awt.event.ActionEvent evt) {
- buttonMarkerActionPerformed(evt);
- }
- });
-
- buttonSave.setText("Save Snapshot");
- buttonSave.addActionListener(new java.awt.event.ActionListener() {
- public void actionPerformed(java.awt.event.ActionEvent evt) {
- buttonSaveActionPerformed(evt);
- }
- });
-
- buttonReticle.setSelected(true);
- buttonReticle.setText("Reticle");
- buttonReticle.addActionListener(new java.awt.event.ActionListener() {
- public void actionPerformed(java.awt.event.ActionEvent evt) {
- buttonReticleActionPerformed(evt);
- }
- });
-
- buttonGrabBackground.setText("Grab Background");
- buttonGrabBackground.addActionListener(new java.awt.event.ActionListener() {
- public void actionPerformed(java.awt.event.ActionEvent evt) {
- buttonGrabBackgroundActionPerformed(evt);
- }
- });
-
- javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this);
- this.setLayout(layout);
- layout.setHorizontalGroup(
- layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
- .addGroup(layout.createSequentialGroup()
- .addContainerGap()
- .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
- .addComponent(renderer, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, 650, Short.MAX_VALUE)
- .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
- .addComponent(checkCamtool)
- .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
- .addComponent(jLabel1)
- .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
- .addComponent(comboCameras, 0, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
- .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
- .addComponent(buttonConfig)
- .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
- .addComponent(buttonSetup)
- .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
- .addComponent(jLabel2)
- .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
- .addComponent(textState, javax.swing.GroupLayout.PREFERRED_SIZE, 120, javax.swing.GroupLayout.PREFERRED_SIZE))
- .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
- .addComponent(buttonPause)
- .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
- .addComponent(buttonMarker)
- .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
- .addComponent(buttonFit)
- .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
- .addComponent(buttonReticle)
- .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
- .addComponent(buttonGrabBackground)
- .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
- .addComponent(buttonSave)))
- .addContainerGap())
- );
-
- layout.linkSize(javax.swing.SwingConstants.HORIZONTAL, new java.awt.Component[] {buttonConfig, buttonSetup});
-
- layout.linkSize(javax.swing.SwingConstants.HORIZONTAL, new java.awt.Component[] {buttonFit, buttonMarker, buttonPause, buttonReticle});
-
- layout.linkSize(javax.swing.SwingConstants.HORIZONTAL, new java.awt.Component[] {buttonGrabBackground, buttonSave});
-
- layout.setVerticalGroup(
- layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
- .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
- .addContainerGap()
- .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
- .addComponent(jLabel1)
- .addComponent(comboCameras, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
- .addComponent(jLabel2)
- .addComponent(textState, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
- .addComponent(buttonConfig)
- .addComponent(buttonSetup)
- .addComponent(checkCamtool))
- .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
- .addComponent(renderer, javax.swing.GroupLayout.DEFAULT_SIZE, 307, Short.MAX_VALUE)
- .addGap(12, 12, 12)
- .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
- .addComponent(buttonPause)
- .addComponent(buttonFit)
- .addComponent(buttonMarker)
- .addComponent(buttonSave)
- .addComponent(buttonReticle)
- .addComponent(buttonGrabBackground))
- .addContainerGap())
- );
-
- layout.linkSize(javax.swing.SwingConstants.VERTICAL, new java.awt.Component[] {comboCameras, textState});
-
- }// //GEN-END:initComponents
-
- private void comboCamerasActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_comboCamerasActionPerformed
- try {
- comboCameras.setEnabled(false);
- new Thread(new Runnable() {
- @Override
- public void run() {
- try{
- setCamera((String) comboCameras.getSelectedItem());
- } catch(Exception ex){
- ex.printStackTrace();
- } finally{
- comboCameras.setEnabled(true);
- }
- }
- }).start();
- } catch (Exception ex) {
- showException(ex);
- }
- }//GEN-LAST:event_comboCamerasActionPerformed
-
- private void buttonConfigActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_buttonConfigActionPerformed
- try {
- if (camera != null) {
- TextEditor editor = new TextEditor();
- editor.setText(cameraConfigJson);
- editor.setReadOnly(true);
- editor.setTitle(cameraName);
- EditorDialog dlg = editor.getDialog(getTopLevel(), false);
- dlg.setSize(480, 640);
- dlg.setVisible(true);
- SwingUtils.centerComponent(this, dlg);
- }
- } catch (Exception ex) {
- showException(ex);
- }
- }//GEN-LAST:event_buttonConfigActionPerformed
-
- private void buttonSetupActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_buttonSetupActionPerformed
- try {
- if (camera != null) {
- this.showDeviceConfigDialog(camera, false);
- }
- } catch (Exception ex) {
- showException(ex);
- }
- }//GEN-LAST:event_buttonSetupActionPerformed
-
- private void buttonPauseActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_buttonPauseActionPerformed
- try {
- if (camera != null) {
- if (buttonPause.isSelected()){
- renderer.pause();
- } else {
- renderer.resume();
- }
- }
- } catch (Exception ex) {
- showException(ex);
- }
- }//GEN-LAST:event_buttonPauseActionPerformed
-
- private void buttonMarkerActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_buttonMarkerActionPerformed
- try {
- if (camera != null) {
- if (buttonMarker.isSelected()){
- Dimension d = renderer.getImageSize();
- Point p = (d == null) ? new Point(renderer.getWidth() / 2, renderer.getHeight() / 2) : new Point(d.width / 2, d.height / 2);
- Overlay ov = null;
- marker = new Overlays.Crosshairs(renderer.getPenMarker(), p, new Dimension(100, 100));
- marker.setMovable(true);
- } else {
- marker = null;
- }
- renderer.setMarker(marker);
- }
- } catch (Exception ex) {
- showException(ex);
- }
- }//GEN-LAST:event_buttonMarkerActionPerformed
-
- private void buttonFitActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_buttonFitActionPerformed
- try {
- renderer.setProfile(buttonFit.isSelected() ? Profile.Both :Profile.None);
- if (!buttonFit.isSelected()){
- renderer.removeOverlays(fitOv);
- fitOv = null;
- }
- } catch (Exception ex) {
- showException(ex);
- }
- }//GEN-LAST:event_buttonFitActionPerformed
-
- private void buttonReticleActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_buttonReticleActionPerformed
- try {
- checkReticle();
- } catch (Exception ex) {
- showException(ex);
- }
- }//GEN-LAST:event_buttonReticleActionPerformed
-
- private void buttonSaveActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_buttonSaveActionPerformed
- try {
- renderer.setSnapshotDialogVisible(buttonSave.isSelected());
- } catch (Exception ex) {
- showException(ex);
- }
- }//GEN-LAST:event_buttonSaveActionPerformed
-
- private void buttonGrabBackgroundActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_buttonGrabBackgroundActionPerformed
- try {
- if (camera instanceof Camtool){
- ((Camtool)camera).captureBackground(5);
- }
- } catch (Exception ex) {
- showException(ex);
- }
- }//GEN-LAST:event_buttonGrabBackgroundActionPerformed
-
- // Variables declaration - do not modify//GEN-BEGIN:variables
- private javax.swing.JButton buttonConfig;
- private javax.swing.JToggleButton buttonFit;
- private javax.swing.JButton buttonGrabBackground;
- private javax.swing.JToggleButton buttonMarker;
- private javax.swing.JToggleButton buttonPause;
- private javax.swing.JToggleButton buttonReticle;
- private javax.swing.JToggleButton buttonSave;
- private javax.swing.JButton buttonSetup;
- private javax.swing.JCheckBox checkCamtool;
- private javax.swing.JComboBox comboCameras;
- private javax.swing.JLabel jLabel1;
- private javax.swing.JLabel jLabel2;
- private ch.psi.pshell.imaging.Renderer renderer;
- private javax.swing.JTextField textState;
- // End of variables declaration//GEN-END:variables
-}
diff --git a/plugins/Camtool.java b/plugins/Camtool.java
deleted file mode 100755
index 2347ade..0000000
--- a/plugins/Camtool.java
+++ /dev/null
@@ -1,309 +0,0 @@
-/*
- * Copyright (c) 2014 Paul Scherrer Institute. All rights reserved.
- */
-
-import ch.psi.pshell.device.Device;
-import ch.psi.pshell.device.Readable;
-import ch.psi.pshell.epics.*;
-import java.io.IOException;
-import java.util.ArrayList;
-
-/**
- *
- */
-public class Camtool extends ArraySource {
-
- final String prefix;
- final String dataPrefix;
- final boolean latch;
-
- final public ChannelInteger channelRun;
- final public ChannelInteger channelLatch;
- final public ChannelDouble channelTimestamp;
- final public ChannelDoubleArray origin;
- final public ChannelDouble posX, posY;
- final public ChannelDoubleArray profileX, profileY;
- final public ChannelIntegerArray shape;
- final public ChannelInteger roiEnabled;
- final public ChannelIntegerArray roiShape;
- final public ChannelInteger bgEnable, bgCapture, bgCaptureRemain;
- final public ChannelDouble calOffX, calOffY, calScaleX, calScaleY;
- final public CamToolPosX posMeanX;
- final public CamToolPosY posMeanY;
- final public CamToolVarX posVarX;
- final public CamToolVarY posVarY;
-
- public Camtool(String name, String prefix) {
- this(name, prefix, false);
- }
-
- public Camtool(String name, String prefix, boolean latch) {
- //super(name, prefix + (latch ? ":latch" : ":pipeline") + (roi ? ".roi.output" : ".image"));
- super(name, prefix + (latch ? ":latch" : ":pipeline") + ".roi.output");
- this.prefix = prefix + ":";
- this.latch = latch;
- dataPrefix = this.prefix + (latch ? "latch" : "pipeline") + ".";
-
- channelRun = new ChannelInteger(name + " run", this.prefix + "camera.run");
- channelLatch = new ChannelInteger(name + " latch", this.prefix + "latch.capture");
- channelTimestamp = new ChannelDouble(name + " timestamp", dataPrefix + "timestamp");
- channelTimestamp.setMonitored(true);
- //posX = new ChannelDouble(name + " com x", dataPrefix + "x_stats.com");
- //posY = new ChannelDouble(name + " com y", dataPrefix + "y_stats.com");
- posX = new ChannelDouble(name + " com x", dataPrefix + "x_stats.com_egu");
- posY = new ChannelDouble(name + " com y", dataPrefix + "y_stats.com_egu");
- profileX = new ChannelDoubleArray(name + " profile x", dataPrefix + "profile.x");
- profileY = new ChannelDoubleArray(name + " profile y", dataPrefix + "profile.y");
- //shape = new ChannelIntegerArray(name + " shape", dataPrefix + (roi ? "roi.output.shape" : "image.shape"));
- shape = new ChannelIntegerArray(name + " shape", dataPrefix + ("image.shape"));
- roiShape = new ChannelIntegerArray(name + " roi shape", dataPrefix + "roi.roi");
- roiEnabled = new ChannelInteger(name + " roi enabled", dataPrefix + "roi.enabled");
- //origin = new ChannelDoubleArray(name + " origin X", roi ? (dataPrefix + "roi.origin_out") : (prefix + "origin"));
- origin = new ChannelDoubleArray(name + " origin X", dataPrefix + "roi.origin_out");
- bgEnable = new ChannelInteger(name + " bg enable", this.prefix + "pipeline.bg.enabled");
- bgCapture = new ChannelInteger(name + " bg capture", this.prefix + "pipeline.bg.capture");
- bgCaptureRemain = new ChannelInteger(name + " bg capture remain", this.prefix + "pipeline.bg.capture_remain");
- calOffX = new ChannelDouble(name + " cal off x", this.prefix + "pipeline.egu.eoff_x");
- calOffY = new ChannelDouble(name + " cal off y", this.prefix + "pipeline.egu.eoff_y");
- calScaleX = new ChannelDouble(name + " cal scale x", this.prefix + "pipeline.egu.eslo_x");
- calScaleY = new ChannelDouble(name + " cal scale y", this.prefix + "pipeline.egu.eslo_y");
-
- posMeanX = new CamToolPosX();
- posMeanY = new CamToolPosY();
- posVarX = new CamToolVarX();
- posVarY = new CamToolVarY();
- }
-
- @Override
- public void doSetMonitored(boolean value) {
- super.doSetMonitored(value);
- getDevice().setMonitored(value);
- }
-
- @Override
- public void doUpdate() throws IOException, InterruptedException {
- super.doUpdate();
- getDevice().update();
- }
-
- void safeInitialize(Device dev, int timeout) throws IOException, InterruptedException {
- for (int retries = 0; retries < 10; retries++) {
- try {
- dev.initialize();
- break;
- } catch (IOException ex) {
- if (retries == 9) {
- throw ex;
- }
- Thread.sleep(timeout / 10);
- }
- }
- }
-
-
- @Override
- protected void doInitialize() throws IOException, InterruptedException {
- try {
- channelRun.initialize();
- channelLatch.initialize();
- if (latch) {
- start();
- latch();
- }
- safeInitialize(channelTimestamp, 2000);
- posX.initialize();
- posY.initialize();
- profileX.initialize();
- profileY.initialize();
- shape.initialize();
- roiShape.initialize();
- roiEnabled.initialize();
- origin.initialize();
- bgEnable.initialize();
- bgCapture.initialize();
- bgCaptureRemain.initialize();
- try {
- calOffX.initialize();
- calOffY.initialize();
- calScaleX.initialize();
- calScaleY.initialize();
- } catch (Exception ex) {
- ex.printStackTrace();
- }
-
- if (roiEnabled.read()>0){
- int[] s = roiShape.read();
- //for (int x : s) System.out.println(x);
- getConfig().imageHeight = s[3];
- getConfig().imageWidth = s[2];
- } else {
- int[] s = shape.read();
- //for (int x : s){ System.out.println(x);}
- getConfig().imageHeight = s[0];
- getConfig().imageWidth = s[1];
- }
-
- getConfig().save();
- getDevice().setSize(getConfig().imageHeight * getConfig().imageWidth);
- super.doInitialize();
- //System.out.println(((int[])(getDevice().read())).length);
- } catch (InterruptedException ex) {
- throw ex;
- } catch (Exception ex) {
- ex.printStackTrace();
- throw new IOException(ex);
- }
- }
-
- int numImages = 1;
-
- public int getNumImages() {
- return numImages;
- }
-
- public void setNumImages(int value) {
- numImages = value;
- }
-
- double grabTimeout = 3.0;
-
- public double getGrabTimeout() {
- return grabTimeout;
- }
-
- public void setGrabTimeou(double value) {
- grabTimeout = value;
- }
-
- public void capture() throws IOException, InterruptedException {
- int retries = 3;
- while (true) {
- try {
- double timestamp = channelTimestamp.read();
- if (latch) {
- channelLatch.write(1);
- } else {
- channelRun.write(1);
- }
- long start = System.currentTimeMillis();
- while (true) {
- double val = channelTimestamp.read();
- if (timestamp != val) {
- return;
- }
- if ((System.currentTimeMillis() - start) > grabTimeout) {
- throw new IOException("Frame timeout");
- }
- Thread.sleep(5);
- }
- } catch (IOException ex) {
- retries--;
- if (--retries <= 0) {
- throw ex;
- }
- }
- }
- }
-
- public void start() throws IOException, InterruptedException {
- channelRun.write(-1);
- }
-
- public void stop() throws IOException, InterruptedException {
- channelRun.write(0);
- }
-
- public void grabSingle() throws IOException, InterruptedException {
- channelRun.write(1);
- }
-
- public void latch() throws IOException, InterruptedException {
- channelLatch.write(1);
- }
-
- public void enableBackground(boolean value) throws IOException, InterruptedException {
- bgEnable.write(value ? 1 : 0);
- }
-
- public void captureBackground(int images) throws IOException, InterruptedException {
- start();
- bgCapture.write(images);
- Thread.sleep(200);
- while (bgCaptureRemain.read() > 0) {
- Thread.sleep(10);
- }
- }
-
- //Statisticss pseudo devices
- ArrayList posXSamples;
- ArrayList posYSamples;
-
- public void updateStats() throws IOException, InterruptedException {
- posXSamples.clear();
- posYSamples.clear();
- for (int i = 0; i < getNumImages(); i++) {
- capture();
- posXSamples.add(posX.read());
- posXSamples.add(posY.read());
- }
- }
-
- class CamToolPosX implements Readable {
-
- @Override
- public Object read() throws IOException, InterruptedException {
- return mean(posXSamples);
- }
-
- }
-
- class CamToolPosY implements Readable {
-
- @Override
- public Object read() throws IOException, InterruptedException {
- return mean(posYSamples);
- }
- }
-
- class CamToolVarX implements Readable {
-
- @Override
- public Object read() throws IOException, InterruptedException {
- return stdev(posXSamples);
- }
-
- }
-
- class CamToolVarY implements Readable {
-
- @Override
- public Object read() throws IOException, InterruptedException {
- return stdev(posYSamples);
- }
- }
-
- public double mean(ArrayList samples) {
- int count = 0;
- double temp = 0;
- for (Double n : samples) {
- if (!Double.isNaN(n)) {
- temp += n.doubleValue();
- count++;
- }
- }
- return count == 0 ? Double.NaN : temp / count;
- }
-
- public double stdev(ArrayList samples) {
- int count = 0;
- double temp = 0;
- double mean = mean(samples);
- for (Double n : samples) {
- if (!Double.isNaN(n)) {
- temp += Math.pow((mean - n), 2);
- }
- }
- return count == 0 ? Double.NaN : temp / count;
- }
-
-}
diff --git a/plugins/Correlation.java b/plugins/Correlation.java
index 0f88f3c..4dfdba3 100755
--- a/plugins/Correlation.java
+++ b/plugins/Correlation.java
@@ -2,10 +2,11 @@
* Copyright (c) 2014 Paul Scherrer Institute. All rights reserved.
*/
+import ch.psi.pshell.App;
+import ch.psi.pshell.framework.Context;
import ch.psi.pshell.plot.Plot;
-import ch.psi.pshell.ui.App;
-import ch.psi.pshell.ui.Panel;
-import ch.psi.utils.State;
+import ch.psi.pshell.framework.Panel;
+import ch.psi.pshell.utils.State;
import java.awt.Component;
import java.util.HashMap;
import java.util.List;
@@ -73,14 +74,14 @@ public class Correlation extends Panel {
//DecimalFormat formatter = new DecimalFormat("0.##E0");
void updateResults(){
try{
- textCorrelation.setText(String.format("%1.4f", Double.valueOf((Double)getContext().getInterpreterVariable("corr"))));
+ textCorrelation.setText(String.format("%1.4f", Double.valueOf((Double)Context.getSequencer().getInterpreterVariable("corr"))));
} catch (Exception ex){
textCorrelation.setText("");
}
if (checkLinear.isSelected()){
try{
- List pars = (List)getContext().getInterpreterVariable("pars_lin");
+ List pars = (List)Context.getSequencer().getInterpreterVariable("pars_lin");
//textLinear.setText(String.format("%1.3fx%+1.3f", (Double)(pars.get(1)), (Double)(pars.get(0))));
textLinear.setText(String.format("%1.6gx%+1.6g",pars.get(1), pars.get(0)));
} catch (Exception ex){
@@ -90,7 +91,7 @@ public class Correlation extends Panel {
if (checkQuadratic.isSelected()){
try{
- List pars = (List)getContext().getInterpreterVariable("pars_quad");
+ List pars = (List)Context.getSequencer().getInterpreterVariable("pars_quad");
//textQuadratic.setText(String.format("%1.2fx\u00B2 %+1.2fx%+1.2f", (Double)(pars.get(0)), (Double)(pars.get(1)), (Double)(pars.get(0))));
textQuadratic.setText(String.format("%1.3gx\u00B2%+1.3gx%+1.3g", pars.get(0), pars.get(1), pars.get(0)));
//textQuadratic.setText(formatter.format(pars.get(2))+ formatter.format(pars.get(1)) + formatter.format(pars.get(0)));
diff --git a/plugins/Correlation2.java b/plugins/Correlation2.java
index 2874cac..fe86b18 100755
--- a/plugins/Correlation2.java
+++ b/plugins/Correlation2.java
@@ -2,15 +2,17 @@
* Copyright (c) 2014 Paul Scherrer Institute. All rights reserved.
*/
+import ch.psi.pshell.App;
+import ch.psi.pshell.app.Setup;
+import ch.psi.pshell.framework.Context;
import ch.psi.pshell.plot.Plot;
import ch.psi.pshell.swing.ChannelSelector;
-import ch.psi.pshell.ui.App;
-import ch.psi.pshell.ui.Panel;
-import ch.psi.utils.State;
-import ch.psi.utils.Chrono;
-import ch.psi.utils.swing.SwingUtils;
-import ch.psi.utils.swing.SwingUtils.OptionResult;
-import ch.psi.utils.swing.SwingUtils.OptionType;
+import ch.psi.pshell.framework.Panel;
+import ch.psi.pshell.utils.State;
+import ch.psi.pshell.utils.Chrono;
+import ch.psi.pshell.swing.SwingUtils;
+import ch.psi.pshell.swing.SwingUtils.OptionResult;
+import ch.psi.pshell.swing.SwingUtils.OptionType;
import java.awt.Component;
import java.awt.GridBagConstraints;
import java.awt.GridBagLayout;
@@ -86,14 +88,14 @@ public class Correlation2 extends Panel {
//DecimalFormat formatter = new DecimalFormat("0.##E0");
void updateResults(){
try{
- textCorrelation.setText(String.format("%1.4f", Double.valueOf((Double)getContext().getInterpreterVariable("corr"))));
+ textCorrelation.setText(String.format("%1.4f", Double.valueOf((Double)Context.getSequencer().getInterpreterVariable("corr"))));
} catch (Exception ex){
textCorrelation.setText("");
}
if (checkLinear.isSelected()){
try{
- List pars = (List)getContext().getInterpreterVariable("pars_lin");
+ List pars = (List)Context.getSequencer().getInterpreterVariable("pars_lin");
//textLinear.setText(String.format("%1.3fx%+1.3f", (Double)(pars.get(1)), (Double)(pars.get(0))));
textLinear.setText(String.format("%1.6gx%+1.6g",pars.get(1), pars.get(0)));
} catch (Exception ex){
@@ -103,7 +105,7 @@ public class Correlation2 extends Panel {
if (checkQuadratic.isSelected()){
try{
- List pars = (List)getContext().getInterpreterVariable("pars_quad");
+ List pars = (List)Context.getSequencer().getInterpreterVariable("pars_quad");
//textQuadratic.setText(String.format("%1.2fx\u00B2 %+1.2fx%+1.2f", (Double)(pars.get(0)), (Double)(pars.get(1)), (Double)(pars.get(0))));
textQuadratic.setText(String.format("%1.3gx\u00B2%+1.3gx%+1.3g", pars.get(0), pars.get(1), pars.get(0)));
//textQuadratic.setText(formatter.format(pars.get(2))+ formatter.format(pars.get(1)) + formatter.format(pars.get(0)));
@@ -112,11 +114,11 @@ public class Correlation2 extends Panel {
textQuadratic.setText("");
}
try{
- String peak = (String)getContext().getInterpreterVariable("pos_peak");
+ String peak = (String)Context.getSequencer().getInterpreterVariable("pos_peak");
if (peak!=null){
textPeak.setText(peak + " (max)");
} else {
- peak = (String)getContext().getInterpreterVariable("neg_peak");
+ peak = (String)Context.getSequencer().getInterpreterVariable("neg_peak");
if (peak!=null){
textPeak.setText(peak + " (min)");
} else {
@@ -449,15 +451,15 @@ public class Correlation2 extends Panel {
if (isRunning()){
//abort();
//Stooping smootly so displayed variables get updated.
- getContext().setInterpreterVariable("stop_exec", true);
+ Context.getSequencer().setInterpreterVariable("stop_exec", true);
Chrono chrono = new Chrono();
while (!chrono.isTimeout(500)){
- if (!Boolean.TRUE.equals(getContext().getInterpreterVariable("stop_exec"))){
+ if (!Boolean.TRUE.equals(Context.getSequencer().getInterpreterVariable("stop_exec"))){
break;
}
Thread.sleep(1);
}
- if (Boolean.TRUE.equals(getContext().getInterpreterVariable("stop_exec"))){
+ if (Boolean.TRUE.equals(Context.getSequencer().getInterpreterVariable("stop_exec"))){
System.out.println("Timeout stopping script - aborting...");
abort();
}
@@ -515,7 +517,7 @@ public class Correlation2 extends Panel {
private void buttonElogActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_buttonElogActionPerformed
try{
- String snapshotFile = getContext().getSetup().expandPath("{context}/correlation_plot.png");
+ String snapshotFile = Setup.expandPath("{context}/correlation_plot.png");
plot.saveSnapshot(snapshotFile, "png");
JPanel panel = new JPanel();
GridBagLayout layout = new GridBagLayout();
diff --git a/plugins/GunEnergyScan.java b/plugins/GunEnergyScan.java
index 87fcf77..8e063e4 100755
--- a/plugins/GunEnergyScan.java
+++ b/plugins/GunEnergyScan.java
@@ -3,9 +3,9 @@
*/
import ch.psi.pshell.plot.LinePlot;
-import ch.psi.pshell.ui.Panel;
-import ch.psi.utils.State;
-import ch.psi.utils.swing.SwingUtils;
+import ch.psi.pshell.framework.Panel;
+import ch.psi.pshell.swing.SwingUtils;
+import ch.psi.pshell.utils.State;
import java.util.ArrayList;
import java.util.List;
import javax.swing.JSpinner;
diff --git a/plugins/GunSolenoidAlignment.java b/plugins/GunSolenoidAlignment.java
index 105103b..e88279e 100755
--- a/plugins/GunSolenoidAlignment.java
+++ b/plugins/GunSolenoidAlignment.java
@@ -2,15 +2,11 @@
* Copyright (c) 2014 Paul Scherrer Institute. All rights reserved.
*/
-import ch.psi.pshell.core.Context;
import ch.psi.pshell.plot.LinePlot;
-import ch.psi.pshell.plot.LinePlotJFree;
-import ch.psi.pshell.ui.Panel;
-import ch.psi.utils.State;
+import ch.psi.pshell.framework.Panel;
+import ch.psi.pshell.utils.State;
import java.awt.Component;
import java.util.HashMap;
-import java.util.logging.Level;
-import java.util.logging.Logger;
import javax.swing.JPanel;
/**
@@ -39,7 +35,7 @@ public class GunSolenoidAlignment extends Panel {
}
return ret;
});
- } catch (Context.ContextStateException ex) {
+ } catch (StateException ex) {
showException((Exception) ex);
}
}
diff --git a/plugins/Inventory.java b/plugins/Inventory.java
deleted file mode 100755
index 9e0104c..0000000
--- a/plugins/Inventory.java
+++ /dev/null
@@ -1,148 +0,0 @@
-/*
- * 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