Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
I
imagej-elphel
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
3
Issues
3
List
Board
Labels
Milestones
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
Elphel
imagej-elphel
Commits
c4070b30
Commit
c4070b30
authored
Sep 19, 2014
by
Andrey Filippov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
automatic save history name, and restory history file
parent
79dd9ba6
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
133 additions
and
19 deletions
+133
-19
Aberration_Calibration.java
src/main/java/Aberration_Calibration.java
+119
-18
FocusingField.java
src/main/java/FocusingField.java
+3
-0
LensAdjustment.java
src/main/java/LensAdjustment.java
+11
-1
No files found.
src/main/java/Aberration_Calibration.java
View file @
c4070b30
...
@@ -526,6 +526,7 @@ public static MatchSimulatedPattern.DistortionParameters DISTORTION =new MatchSi
...
@@ -526,6 +526,7 @@ public static MatchSimulatedPattern.DistortionParameters DISTORTION =new MatchSi
public
static
LensAdjustment
.
FocusMeasurementParameters
FOCUS_MEASUREMENT_PARAMETERS
=
new
LensAdjustment
.
FocusMeasurementParameters
(
MOTORS
.
curpos
);
public
static
LensAdjustment
.
FocusMeasurementParameters
FOCUS_MEASUREMENT_PARAMETERS
=
new
LensAdjustment
.
FocusMeasurementParameters
(
MOTORS
.
curpos
);
public
static
CalibrationHardwareInterface
.
GoniometerMotors
GONIOMETER_MOTORS
=
new
CalibrationHardwareInterface
.
GoniometerMotors
();
public
static
CalibrationHardwareInterface
.
GoniometerMotors
GONIOMETER_MOTORS
=
new
CalibrationHardwareInterface
.
GoniometerMotors
();
public
static
FocusingField
FOCUSING_FIELD
=
null
;
public
static
FocusingField
FOCUSING_FIELD
=
null
;
// public String FOCUSING_FIELD_HISTORY_PATH=null;
//GoniometerParameters
//GoniometerParameters
public
static
Goniometer
.
GoniometerParameters
GONIOMETER_PARAMETERS
=
new
Goniometer
.
GoniometerParameters
(
GONIOMETER_MOTORS
);
public
static
Goniometer
.
GoniometerParameters
GONIOMETER_PARAMETERS
=
new
Goniometer
.
GoniometerParameters
(
GONIOMETER_MOTORS
);
...
@@ -4144,6 +4145,8 @@ if (MORE_BUTTONS) {
...
@@ -4144,6 +4145,8 @@ if (MORE_BUTTONS) {
MOTORS
.
addCurrentHistoryToFocusingField
(
FOCUSING_FIELD
);
MOTORS
.
addCurrentHistoryToFocusingField
(
FOCUSING_FIELD
);
System
.
out
.
println
(
"Saving measurement history to "
+
path
);
System
.
out
.
println
(
"Saving measurement history to "
+
path
);
FOCUSING_FIELD
.
saveXML
(
path
);
FOCUSING_FIELD
.
saveXML
(
path
);
// FOCUSING_FIELD_HISTORY_PATH=path;
FOCUS_MEASUREMENT_PARAMETERS
.
focusingHistoryFile
=
path
;
saveCurrentConfig
();
saveCurrentConfig
();
// for now just copying from "Restore History". TODO: Make both more automatic (move number of parameters outside?)
// for now just copying from "Restore History". TODO: Make both more automatic (move number of parameters outside?)
if
(!
FOCUSING_FIELD
.
configureDataVector
(
if
(!
FOCUSING_FIELD
.
configureDataVector
(
...
@@ -4513,14 +4516,20 @@ if (MORE_BUTTONS) {
...
@@ -4513,14 +4516,20 @@ if (MORE_BUTTONS) {
System
.
out
.
println
(
"Saving measurement history to "
+
path
);
System
.
out
.
println
(
"Saving measurement history to "
+
path
);
MOTORS
.
addCurrentHistoryToFocusingField
(
FOCUSING_FIELD
);
MOTORS
.
addCurrentHistoryToFocusingField
(
FOCUSING_FIELD
);
FOCUSING_FIELD
.
saveXML
(
path
);
FOCUSING_FIELD
.
saveXML
(
path
);
// FOCUSING_FIELD_HISTORY_PATH=path;
FOCUS_MEASUREMENT_PARAMETERS
.
focusingHistoryFile
=
path
;
return
;
return
;
}
}
/* ======================================================================== */
/* ======================================================================== */
if
(
label
.
equals
(
"Restore History"
))
{
if
(
label
.
equals
(
"Restore History"
))
{
DEBUG_LEVEL
=
MASTER_DEBUG_LEVEL
;
DEBUG_LEVEL
=
MASTER_DEBUG_LEVEL
;
restoreFocusingHistory
(
true
);
//boolean interactive)
/*
change - blank file - no autoload
FOCUSING_FIELD=new FocusingField(
FOCUSING_FIELD=new FocusingField(
true
,
// boolean smart, // do not open dialog if default matches
false, //
true, // boolean smart, // do not open dialog if default matches
""
,
//); //String defaultPath); // AtomicInteger stopRequested
FOCUS_MEASUREMENT_PARAMETERS.focusingHistoryFile, // FOCUSING_FIELD_HISTORY_PATH, //
"",//); //String defaultPath); // AtomicInteger stopRequested
this.SYNC_COMMAND.stopRequested);
this.SYNC_COMMAND.stopRequested);
FOCUSING_FIELD.setDebugLevel(DEBUG_LEVEL);
FOCUSING_FIELD.setDebugLevel(DEBUG_LEVEL);
FOCUSING_FIELD.setAdjustMode(false);
FOCUSING_FIELD.setAdjustMode(false);
...
@@ -4542,12 +4551,17 @@ if (MORE_BUTTONS) {
...
@@ -4542,12 +4551,17 @@ if (MORE_BUTTONS) {
double rms= FOCUSING_FIELD.calcErrorDiffY(focusing_fx, false);
double rms= FOCUSING_FIELD.calcErrorDiffY(focusing_fx, false);
double rms_pure= FOCUSING_FIELD.calcErrorDiffY(focusing_fx, true);
double rms_pure= FOCUSING_FIELD.calcErrorDiffY(focusing_fx, true);
System.out.println("rms="+rms+", rms_pure="+rms_pure);
System.out.println("rms="+rms+", rms_pure="+rms_pure);
*/
return
;
return
;
}
}
/* ======================================================================== */
/* ======================================================================== */
if
(
label
.
equals
(
"History RMS"
))
{
if
(
label
.
equals
(
"History RMS"
))
{
if
(
FOCUSING_FIELD
==
null
)
return
;
DEBUG_LEVEL
=
MASTER_DEBUG_LEVEL
;
DEBUG_LEVEL
=
MASTER_DEBUG_LEVEL
;
if
(
FOCUSING_FIELD
==
null
)
{
if
(
DEBUG_LEVEL
>
0
)
System
.
out
.
println
(
"FOCUSING_FIELD==null, trying to restore from the previously saved file"
);
if
(!
restoreFocusingHistory
(
false
))
return
;
// try to restore from the saved history file
}
FOCUSING_FIELD
.
setDebugLevel
(
DEBUG_LEVEL
);
FOCUSING_FIELD
.
setDebugLevel
(
DEBUG_LEVEL
);
// FOCUSING_FIELD.setAdjustMode(false);
// FOCUSING_FIELD.setAdjustMode(false);
double
[]
sv
=
FOCUSING_FIELD
.
fieldFitting
.
createParameterVector
(
FOCUSING_FIELD
.
sagittalMaster
);
double
[]
sv
=
FOCUSING_FIELD
.
fieldFitting
.
createParameterVector
(
FOCUSING_FIELD
.
sagittalMaster
);
...
@@ -4564,7 +4578,10 @@ if (MORE_BUTTONS) {
...
@@ -4564,7 +4578,10 @@ if (MORE_BUTTONS) {
/* ======================================================================== */
/* ======================================================================== */
if
(
label
.
equals
(
"Modify LMA"
))
{
if
(
label
.
equals
(
"Modify LMA"
))
{
DEBUG_LEVEL
=
MASTER_DEBUG_LEVEL
;
DEBUG_LEVEL
=
MASTER_DEBUG_LEVEL
;
if
(
FOCUSING_FIELD
==
null
)
return
;
if
(
FOCUSING_FIELD
==
null
)
{
if
(
DEBUG_LEVEL
>
0
)
System
.
out
.
println
(
"FOCUSING_FIELD==null, trying to restore from the previously saved file"
);
if
(!
restoreFocusingHistory
(
false
))
return
;
// try to restore from the saved history file
}
FOCUSING_FIELD
.
setDebugLevel
(
DEBUG_LEVEL
);
FOCUSING_FIELD
.
setDebugLevel
(
DEBUG_LEVEL
);
FOCUSING_FIELD
.
setAdjustMode
(
false
);
FOCUSING_FIELD
.
setAdjustMode
(
false
);
if
(!
FOCUSING_FIELD
.
configureDataVector
(
if
(!
FOCUSING_FIELD
.
configureDataVector
(
...
@@ -4581,7 +4598,11 @@ if (MORE_BUTTONS) {
...
@@ -4581,7 +4598,11 @@ if (MORE_BUTTONS) {
/* ======================================================================== */
/* ======================================================================== */
if
(
label
.
equals
(
"Load strategies"
))
{
if
(
label
.
equals
(
"Load strategies"
))
{
DEBUG_LEVEL
=
MASTER_DEBUG_LEVEL
;
DEBUG_LEVEL
=
MASTER_DEBUG_LEVEL
;
if
(
FOCUSING_FIELD
==
null
)
return
;
if
(
FOCUSING_FIELD
==
null
)
{
if
(
DEBUG_LEVEL
>
0
)
System
.
out
.
println
(
"FOCUSING_FIELD==null, trying to restore from the previously saved file"
);
if
(!
restoreFocusingHistory
(
false
))
return
;
// try to restore from the saved history file
}
FOCUSING_FIELD
.
setDebugLevel
(
DEBUG_LEVEL
);
FOCUSING_FIELD
.
setDebugLevel
(
DEBUG_LEVEL
);
FOCUSING_FIELD
.
fieldFitting
.
fieldStrategies
.
loadStrategies
(
null
,
PROCESS_PARAMETERS
.
kernelsDirectory
);
FOCUSING_FIELD
.
fieldFitting
.
fieldStrategies
.
loadStrategies
(
null
,
PROCESS_PARAMETERS
.
kernelsDirectory
);
return
;
return
;
...
@@ -4589,7 +4610,11 @@ if (MORE_BUTTONS) {
...
@@ -4589,7 +4610,11 @@ if (MORE_BUTTONS) {
/* ======================================================================== */
/* ======================================================================== */
if
(
label
.
equals
(
"Save strategies"
))
{
if
(
label
.
equals
(
"Save strategies"
))
{
DEBUG_LEVEL
=
MASTER_DEBUG_LEVEL
;
DEBUG_LEVEL
=
MASTER_DEBUG_LEVEL
;
if
(
FOCUSING_FIELD
==
null
)
return
;
if
(
FOCUSING_FIELD
==
null
)
{
if
(
DEBUG_LEVEL
>
0
)
System
.
out
.
println
(
"FOCUSING_FIELD==null, trying to restore from the previously saved file"
);
if
(!
restoreFocusingHistory
(
false
))
return
;
// try to restore from the saved history file
}
FOCUSING_FIELD
.
setDebugLevel
(
DEBUG_LEVEL
);
FOCUSING_FIELD
.
setDebugLevel
(
DEBUG_LEVEL
);
FOCUSING_FIELD
.
fieldFitting
.
fieldStrategies
.
saveStrategies
(
null
,
PROCESS_PARAMETERS
.
kernelsDirectory
);
FOCUSING_FIELD
.
fieldFitting
.
fieldStrategies
.
saveStrategies
(
null
,
PROCESS_PARAMETERS
.
kernelsDirectory
);
return
;
return
;
...
@@ -4597,7 +4622,11 @@ if (MORE_BUTTONS) {
...
@@ -4597,7 +4622,11 @@ if (MORE_BUTTONS) {
/* ======================================================================== */
/* ======================================================================== */
if
(
label
.
equals
(
"Organize strategies"
))
{
if
(
label
.
equals
(
"Organize strategies"
))
{
DEBUG_LEVEL
=
MASTER_DEBUG_LEVEL
;
DEBUG_LEVEL
=
MASTER_DEBUG_LEVEL
;
if
(
FOCUSING_FIELD
==
null
)
return
;
if
(
FOCUSING_FIELD
==
null
)
{
if
(
DEBUG_LEVEL
>
0
)
System
.
out
.
println
(
"FOCUSING_FIELD==null, trying to restore from the previously saved file"
);
if
(!
restoreFocusingHistory
(
false
))
return
;
// try to restore from the saved history file
}
FOCUSING_FIELD
.
setDebugLevel
(
DEBUG_LEVEL
);
FOCUSING_FIELD
.
setDebugLevel
(
DEBUG_LEVEL
);
int
resp
=
0
;
int
resp
=
0
;
while
(
resp
==
0
){
while
(
resp
==
0
){
...
@@ -4609,20 +4638,29 @@ if (MORE_BUTTONS) {
...
@@ -4609,20 +4638,29 @@ if (MORE_BUTTONS) {
/* ======================================================================== */
/* ======================================================================== */
if
(
label
.
equals
(
"LMA History"
))
{
if
(
label
.
equals
(
"LMA History"
))
{
DEBUG_LEVEL
=
MASTER_DEBUG_LEVEL
;
DEBUG_LEVEL
=
MASTER_DEBUG_LEVEL
;
if
(
FOCUSING_FIELD
==
null
)
return
;
if
(
FOCUSING_FIELD
==
null
)
{
if
(
DEBUG_LEVEL
>
0
)
System
.
out
.
println
(
"FOCUSING_FIELD==null, trying to restore from the previously saved file"
);
if
(!
restoreFocusingHistory
(
false
))
return
;
// try to restore from the saved history file
}
FOCUSING_FIELD
.
setDebugLevel
(
DEBUG_LEVEL
);
FOCUSING_FIELD
.
setDebugLevel
(
DEBUG_LEVEL
);
FOCUSING_FIELD
.
setAdjustMode
(
false
);
FOCUSING_FIELD
.
setAdjustMode
(
false
);
FOCUSING_FIELD
.
LevenbergMarquardt
(
boolean
OK
=
FOCUSING_FIELD
.
LevenbergMarquardt
(
null
,
// measurement
null
,
// measurement
true
,
// open dialog
true
,
// open dialog
true
,
// boolean autoSel,
true
,
// boolean autoSel,
DEBUG_LEVEL
);
//boolean openDialog, int debugLevel){
DEBUG_LEVEL
);
//boolean openDialog, int debugLevel){
if
(
OK
)
saveCurrentConfig
();
return
;
return
;
}
}
/* ======================================================================== */
/* ======================================================================== */
if
(
label
.
equals
(
"List curv pars"
))
{
if
(
label
.
equals
(
"List curv pars"
))
{
DEBUG_LEVEL
=
MASTER_DEBUG_LEVEL
;
DEBUG_LEVEL
=
MASTER_DEBUG_LEVEL
;
if
(
FOCUSING_FIELD
==
null
)
return
;
if
(
FOCUSING_FIELD
==
null
)
{
if
(
DEBUG_LEVEL
>
0
)
System
.
out
.
println
(
"FOCUSING_FIELD==null, trying to restore from the previously saved file"
);
if
(!
restoreFocusingHistory
(
false
))
return
;
// try to restore from the saved history file
}
FOCUSING_FIELD
.
setDebugLevel
(
DEBUG_LEVEL
);
FOCUSING_FIELD
.
setDebugLevel
(
DEBUG_LEVEL
);
FOCUSING_FIELD
.
listParameters
(
"Field curvature measurement parameters"
,
null
);
// to screen
FOCUSING_FIELD
.
listParameters
(
"Field curvature measurement parameters"
,
null
);
// to screen
return
;
return
;
...
@@ -4630,7 +4668,11 @@ if (MORE_BUTTONS) {
...
@@ -4630,7 +4668,11 @@ if (MORE_BUTTONS) {
/* ======================================================================== */
/* ======================================================================== */
if
(
label
.
equals
(
"List curv data"
))
{
if
(
label
.
equals
(
"List curv data"
))
{
DEBUG_LEVEL
=
MASTER_DEBUG_LEVEL
;
DEBUG_LEVEL
=
MASTER_DEBUG_LEVEL
;
if
(
FOCUSING_FIELD
==
null
)
return
;
if
(
FOCUSING_FIELD
==
null
)
{
if
(
DEBUG_LEVEL
>
0
)
System
.
out
.
println
(
"FOCUSING_FIELD==null, trying to restore from the previously saved file"
);
if
(!
restoreFocusingHistory
(
false
))
return
;
// try to restore from the saved history file
}
FOCUSING_FIELD
.
setDebugLevel
(
DEBUG_LEVEL
);
FOCUSING_FIELD
.
setDebugLevel
(
DEBUG_LEVEL
);
FOCUSING_FIELD
.
listData
(
"Field curvature measurement data"
,
null
);
// to screen
FOCUSING_FIELD
.
listData
(
"Field curvature measurement data"
,
null
);
// to screen
return
;
return
;
...
@@ -4639,7 +4681,11 @@ if (MORE_BUTTONS) {
...
@@ -4639,7 +4681,11 @@ if (MORE_BUTTONS) {
/* ======================================================================== */
/* ======================================================================== */
if
(
label
.
equals
(
"List qualB"
))
{
if
(
label
.
equals
(
"List qualB"
))
{
DEBUG_LEVEL
=
MASTER_DEBUG_LEVEL
;
DEBUG_LEVEL
=
MASTER_DEBUG_LEVEL
;
if
(
FOCUSING_FIELD
==
null
)
return
;
if
(
FOCUSING_FIELD
==
null
)
{
if
(
DEBUG_LEVEL
>
0
)
System
.
out
.
println
(
"FOCUSING_FIELD==null, trying to restore from the previously saved file"
);
if
(!
restoreFocusingHistory
(
false
))
return
;
// try to restore from the saved history file
}
FOCUSING_FIELD
.
setDebugLevel
(
DEBUG_LEVEL
);
FOCUSING_FIELD
.
setDebugLevel
(
DEBUG_LEVEL
);
FOCUSING_FIELD
.
listScanQB
();
// to screen
FOCUSING_FIELD
.
listScanQB
();
// to screen
return
;
return
;
...
@@ -4647,7 +4693,11 @@ if (MORE_BUTTONS) {
...
@@ -4647,7 +4693,11 @@ if (MORE_BUTTONS) {
/* ======================================================================== */
/* ======================================================================== */
if
(
label
.
equals
(
"List curv"
))
{
if
(
label
.
equals
(
"List curv"
))
{
DEBUG_LEVEL
=
MASTER_DEBUG_LEVEL
;
DEBUG_LEVEL
=
MASTER_DEBUG_LEVEL
;
if
(
FOCUSING_FIELD
==
null
)
return
;
if
(
FOCUSING_FIELD
==
null
)
{
if
(
DEBUG_LEVEL
>
0
)
System
.
out
.
println
(
"FOCUSING_FIELD==null, trying to restore from the previously saved file"
);
if
(!
restoreFocusingHistory
(
false
))
return
;
// try to restore from the saved history file
}
FOCUSING_FIELD
.
setDebugLevel
(
DEBUG_LEVEL
);
FOCUSING_FIELD
.
setDebugLevel
(
DEBUG_LEVEL
);
FOCUSING_FIELD
.
listCombinedResults
();
// to screen
FOCUSING_FIELD
.
listCombinedResults
();
// to screen
return
;
return
;
...
@@ -4655,7 +4705,11 @@ if (MORE_BUTTONS) {
...
@@ -4655,7 +4705,11 @@ if (MORE_BUTTONS) {
/* ======================================================================== */
/* ======================================================================== */
if
(
label
.
equals
(
"Show curv corr"
))
{
if
(
label
.
equals
(
"Show curv corr"
))
{
DEBUG_LEVEL
=
MASTER_DEBUG_LEVEL
;
DEBUG_LEVEL
=
MASTER_DEBUG_LEVEL
;
if
(
FOCUSING_FIELD
==
null
)
return
;
if
(
FOCUSING_FIELD
==
null
)
{
if
(
DEBUG_LEVEL
>
0
)
System
.
out
.
println
(
"FOCUSING_FIELD==null, trying to restore from the previously saved file"
);
if
(!
restoreFocusingHistory
(
false
))
return
;
// try to restore from the saved history file
}
FOCUSING_FIELD
.
setDebugLevel
(
DEBUG_LEVEL
);
FOCUSING_FIELD
.
setDebugLevel
(
DEBUG_LEVEL
);
FOCUSING_FIELD
.
showCurvCorr
();
// to screen
FOCUSING_FIELD
.
showCurvCorr
();
// to screen
return
;
return
;
...
@@ -4663,7 +4717,11 @@ if (MORE_BUTTONS) {
...
@@ -4663,7 +4717,11 @@ if (MORE_BUTTONS) {
/* ======================================================================== */
/* ======================================================================== */
if
(
label
.
equals
(
"Test measurement"
))
{
if
(
label
.
equals
(
"Test measurement"
))
{
DEBUG_LEVEL
=
MASTER_DEBUG_LEVEL
;
DEBUG_LEVEL
=
MASTER_DEBUG_LEVEL
;
if
(
FOCUSING_FIELD
==
null
)
return
;
if
(
FOCUSING_FIELD
==
null
)
{
if
(
DEBUG_LEVEL
>
0
)
System
.
out
.
println
(
"FOCUSING_FIELD==null, trying to restore from the previously saved file"
);
if
(!
restoreFocusingHistory
(
false
))
return
;
// try to restore from the saved history file
}
FOCUSING_FIELD
.
setDebugLevel
(
DEBUG_LEVEL
);
FOCUSING_FIELD
.
setDebugLevel
(
DEBUG_LEVEL
);
FOCUSING_FIELD
.
testMeasurement
();
FOCUSING_FIELD
.
testMeasurement
();
return
;
return
;
...
@@ -4671,7 +4729,11 @@ if (MORE_BUTTONS) {
...
@@ -4671,7 +4729,11 @@ if (MORE_BUTTONS) {
/* ======================================================================== */
/* ======================================================================== */
if
(
label
.
equals
(
"Optimize qualB"
))
{
if
(
label
.
equals
(
"Optimize qualB"
))
{
DEBUG_LEVEL
=
MASTER_DEBUG_LEVEL
;
DEBUG_LEVEL
=
MASTER_DEBUG_LEVEL
;
if
(
FOCUSING_FIELD
==
null
)
return
;
if
(
FOCUSING_FIELD
==
null
)
{
if
(
DEBUG_LEVEL
>
0
)
System
.
out
.
println
(
"FOCUSING_FIELD==null, trying to restore from the previously saved file"
);
if
(!
restoreFocusingHistory
(
false
))
return
;
// try to restore from the saved history file
}
FOCUSING_FIELD
.
setDebugLevel
(
DEBUG_LEVEL
);
FOCUSING_FIELD
.
setDebugLevel
(
DEBUG_LEVEL
);
FOCUSING_FIELD
.
testQualB
(
true
);
// public double[] testQualB(boolean interactive)
FOCUSING_FIELD
.
testQualB
(
true
);
// public double[] testQualB(boolean interactive)
return
;
return
;
...
@@ -4682,7 +4744,11 @@ if (MORE_BUTTONS) {
...
@@ -4682,7 +4744,11 @@ if (MORE_BUTTONS) {
/* ======================================================================== */
/* ======================================================================== */
if
(
label
.
equals
(
"Focus/Tilt LMA"
))
{
if
(
label
.
equals
(
"Focus/Tilt LMA"
))
{
DEBUG_LEVEL
=
MASTER_DEBUG_LEVEL
;
DEBUG_LEVEL
=
MASTER_DEBUG_LEVEL
;
if
(
FOCUSING_FIELD
==
null
)
return
;
if
(
FOCUSING_FIELD
==
null
)
{
if
(
DEBUG_LEVEL
>
0
)
System
.
out
.
println
(
"FOCUSING_FIELD==null, trying to restore from the previously saved file"
);
if
(!
restoreFocusingHistory
(
false
))
return
;
// try to restore from the saved history file
}
FOCUSING_FIELD
.
setDebugLevel
(
DEBUG_LEVEL
);
FOCUSING_FIELD
.
setDebugLevel
(
DEBUG_LEVEL
);
if
(!
FOCUS_MEASUREMENT_PARAMETERS
.
cameraIsConfigured
)
{
if
(!
FOCUS_MEASUREMENT_PARAMETERS
.
cameraIsConfigured
)
{
if
(
CAMERAS
.
showDialog
(
"Configure cameras interface"
,
1
,
true
)){
if
(
CAMERAS
.
showDialog
(
"Configure cameras interface"
,
1
,
true
)){
...
@@ -5356,7 +5422,7 @@ if (MORE_BUTTONS) {
...
@@ -5356,7 +5422,7 @@ if (MORE_BUTTONS) {
);
);
if
(
useLMA
&&
(
ff
!=
null
)){
if
(
useLMA
&&
(
ff
!=
null
)){
String
focusingPath
=
dFile
+
Prefs
.
getFileSeparator
()+
lensPrefix
+
CAMERAS
.
getLastTimestampUnderscored
()+
".history-xml"
;
String
focusingPath
=
dFile
+
Prefs
.
getFileSeparator
()+
lensPrefix
+
CAMERAS
.
getLastTimestampUnderscored
()+
".history-xml"
;
System
.
out
.
println
(
"Saving measurement history to "
+
focusingPath
);
System
.
out
.
println
(
"Saving measurement history to "
+
focusingPath
);
// Do not save history here
ff
.
saveXML
(
focusingPath
);
ff
.
saveXML
(
focusingPath
);
}
}
}
}
...
@@ -9002,6 +9068,41 @@ if (MORE_BUTTONS) {
...
@@ -9002,6 +9068,41 @@ if (MORE_BUTTONS) {
}
}
/* ===== Other methods ==================================================== */
/* ===== Other methods ==================================================== */
public
boolean
restoreFocusingHistory
(
boolean
interactive
){
if
(!
interactive
&&
((
FOCUS_MEASUREMENT_PARAMETERS
.
focusingHistoryFile
==
null
)
||
(
FOCUS_MEASUREMENT_PARAMETERS
.
focusingHistoryFile
.
length
()==
0
))){
System
.
out
.
println
(
"*** No focusing history to load!"
);
return
false
;
}
FOCUSING_FIELD
=
new
FocusingField
(
!
interactive
,
// false, // true, // boolean smart, // do not open dialog if default matches
FOCUS_MEASUREMENT_PARAMETERS
.
focusingHistoryFile
,
// FOCUSING_FIELD_HISTORY_PATH, //"",//); //String defaultPath); // AtomicInteger stopRequested
this
.
SYNC_COMMAND
.
stopRequested
);
FOCUSING_FIELD
.
setDebugLevel
(
DEBUG_LEVEL
);
FOCUSING_FIELD
.
setAdjustMode
(
false
);
if
(
PROPERTIES
!=
null
)
FOCUSING_FIELD
.
getProperties
(
"FOCUSING_FIELD."
,
PROPERTIES
,
true
);
// keep distortions center from history
System
.
out
.
println
(
"Loaded FocusingField"
);
if
(!
FOCUSING_FIELD
.
configureDataVector
(
true
,
// boolean silent (maybe add option with false to change number of parameters?)
"Configure curvature - TODO: fix many settings restored from properties"
,
// String title
true
,
// boolean forcenew,
true
)
// boolean enableReset
)
return
false
;
System
.
out
.
println
(
"TODO: fix many settings restored from properties, overwriting entered fields. Currently run \"Modify LMA\" to re-enter values"
);
System
.
out
.
println
(
"TODO: Probably need to make a separate dialog that enters number of parameters."
);
double
[]
sv
=
FOCUSING_FIELD
.
fieldFitting
.
createParameterVector
(
FOCUSING_FIELD
.
sagittalMaster
);
FOCUSING_FIELD
.
setDataVector
(
true
,
// calibrate mode
FOCUSING_FIELD
.
createDataVector
());
double
[]
focusing_fx
=
FOCUSING_FIELD
.
createFXandJacobian
(
sv
,
false
);
double
rms
=
FOCUSING_FIELD
.
calcErrorDiffY
(
focusing_fx
,
false
);
double
rms_pure
=
FOCUSING_FIELD
.
calcErrorDiffY
(
focusing_fx
,
true
);
System
.
out
.
println
(
"rms="
+
rms
+
", rms_pure="
+
rms_pure
);
return
true
;
// add OK/fail
}
public
boolean
adjustFocusTiltLMA
(){
public
boolean
adjustFocusTiltLMA
(){
// just for reporting distance old way
// just for reporting distance old way
/*
/*
...
...
src/main/java/FocusingField.java
View file @
c4070b30
...
@@ -4480,6 +4480,9 @@ public boolean LevenbergMarquardt(
...
@@ -4480,6 +4480,9 @@ public boolean LevenbergMarquardt(
motors
,
motors
,
sampleStrings
));
sampleStrings
));
}
}
if
(
debugLevel
>
0
){
System
.
out
.
println
(
"Loaded measurement history "
+
pathname
);
}
return
true
;
return
true
;
}
}
public
void
saveXML
(
public
void
saveXML
(
...
...
src/main/java/LensAdjustment.java
View file @
c4070b30
...
@@ -194,6 +194,7 @@ public class LensAdjustment {
...
@@ -194,6 +194,7 @@ public class LensAdjustment {
public
static
class
FocusMeasurementParameters
{
public
static
class
FocusMeasurementParameters
{
public
String
gridGeometryFile
=
""
;
public
String
gridGeometryFile
=
""
;
public
String
initialCalibrationFile
=
""
;
public
String
initialCalibrationFile
=
""
;
public
String
focusingHistoryFile
=
""
;
public
String
strategyFile
=
""
;
public
String
strategyFile
=
""
;
public
String
resultsSuperDirectory
=
""
;
// directory with subdirectories named as serial numbers to stro results
public
String
resultsSuperDirectory
=
""
;
// directory with subdirectories named as serial numbers to stro results
public
int
EEPROM_channel
=
1
;
// EEPROM channel to read serial number from
public
int
EEPROM_channel
=
1
;
// EEPROM channel to read serial number from
...
@@ -414,7 +415,7 @@ public class LensAdjustment {
...
@@ -414,7 +415,7 @@ public class LensAdjustment {
this
.
result_tiltY
=
Double
.
NaN
;
// last measured tilt Y
this
.
result_tiltY
=
Double
.
NaN
;
// last measured tilt Y
this
.
result_R50
=
Double
.
NaN
;
// last measured R50 (average PSF 50% level radius, pixels - somewhat larged than actual because of measurement settings)
this
.
result_R50
=
Double
.
NaN
;
// last measured R50 (average PSF 50% level radius, pixels - somewhat larged than actual because of measurement settings)
this
.
result_A50
=
Double
.
NaN
;
// last measured A50 (simailar, but R^2 are averaged)
this
.
result_A50
=
Double
.
NaN
;
// last measured A50 (simailar, but R^2 are averaged)
this
.
result_B50
=
Double
.
NaN
;
// last measured B50 (sim
a
ilar, but R^4 are averaged)
this
.
result_B50
=
Double
.
NaN
;
// last measured B50 (similar, but R^4 are averaged)
this
.
result_RC50
=
Double
.
NaN
;
// last measured RC50(R50 calculated only for the 2 center samples)
this
.
result_RC50
=
Double
.
NaN
;
// last measured RC50(R50 calculated only for the 2 center samples)
this
.
result_PX0
=
Double
.
NaN
;
// lens center shift, X
this
.
result_PX0
=
Double
.
NaN
;
// lens center shift, X
this
.
result_PY0
=
Double
.
NaN
;
// lens center shift, Y
this
.
result_PY0
=
Double
.
NaN
;
// lens center shift, Y
...
@@ -427,6 +428,7 @@ public class LensAdjustment {
...
@@ -427,6 +428,7 @@ public class LensAdjustment {
String
initialCalibrationFile
,
String
initialCalibrationFile
,
String
strategyFile
,
String
strategyFile
,
String
resultsSuperDirectory
,
// directory with subdirectories named as serial numbers to stro results
String
resultsSuperDirectory
,
// directory with subdirectories named as serial numbers to stro results
String
focusingHistoryFile
,
int
EEPROM_channel
,
// EEPROM channel to read serial number from
int
EEPROM_channel
,
// EEPROM channel to read serial number from
boolean
saveResults
,
// save focusing results
boolean
saveResults
,
// save focusing results
boolean
showResults
,
// show focusing (includingh intermediate) results
boolean
showResults
,
// show focusing (includingh intermediate) results
...
@@ -572,6 +574,7 @@ public class LensAdjustment {
...
@@ -572,6 +574,7 @@ public class LensAdjustment {
this
.
initialCalibrationFile
=
initialCalibrationFile
;
this
.
initialCalibrationFile
=
initialCalibrationFile
;
this
.
strategyFile
=
strategyFile
;
this
.
strategyFile
=
strategyFile
;
this
.
resultsSuperDirectory
=
resultsSuperDirectory
;
// directory with subdirectories named as serial numbers to stro results
this
.
resultsSuperDirectory
=
resultsSuperDirectory
;
// directory with subdirectories named as serial numbers to stro results
this
.
focusingHistoryFile
=
focusingHistoryFile
;
this
.
EEPROM_channel
=
EEPROM_channel
;
// EEPROM channel to read serial number from
this
.
EEPROM_channel
=
EEPROM_channel
;
// EEPROM channel to read serial number from
this
.
saveResults
=
saveResults
;
// save focusing results
this
.
saveResults
=
saveResults
;
// save focusing results
this
.
showResults
=
showResults
;
// show focusing (includingh intermediate) results
this
.
showResults
=
showResults
;
// show focusing (includingh intermediate) results
...
@@ -718,6 +721,7 @@ public class LensAdjustment {
...
@@ -718,6 +721,7 @@ public class LensAdjustment {
this
.
initialCalibrationFile
,
this
.
initialCalibrationFile
,
this
.
strategyFile
,
this
.
strategyFile
,
this
.
resultsSuperDirectory
,
// directory with subdirectories named as serial numbers to stro results
this
.
resultsSuperDirectory
,
// directory with subdirectories named as serial numbers to stro results
this
.
focusingHistoryFile
,
this
.
EEPROM_channel
,
// EEPROM channel to read serial number from
this
.
EEPROM_channel
,
// EEPROM channel to read serial number from
this
.
saveResults
,
// save focusing results
this
.
saveResults
,
// save focusing results
this
.
showResults
,
// show focusing (includingh intermediate) results
this
.
showResults
,
// show focusing (includingh intermediate) results
...
@@ -862,6 +866,7 @@ public class LensAdjustment {
...
@@ -862,6 +866,7 @@ public class LensAdjustment {
properties
.
setProperty
(
prefix
+
"initialCalibrationFile"
,
this
.
initialCalibrationFile
+
""
);
properties
.
setProperty
(
prefix
+
"initialCalibrationFile"
,
this
.
initialCalibrationFile
+
""
);
properties
.
setProperty
(
prefix
+
"strategyFile"
,
this
.
strategyFile
+
""
);
properties
.
setProperty
(
prefix
+
"strategyFile"
,
this
.
strategyFile
+
""
);
properties
.
setProperty
(
prefix
+
"resultsSuperDirectory"
,
this
.
resultsSuperDirectory
+
""
);
properties
.
setProperty
(
prefix
+
"resultsSuperDirectory"
,
this
.
resultsSuperDirectory
+
""
);
properties
.
setProperty
(
prefix
+
"focusingHistoryFile"
,
this
.
focusingHistoryFile
+
""
);
properties
.
setProperty
(
prefix
+
"serialNumber"
,
this
.
serialNumber
+
""
);
properties
.
setProperty
(
prefix
+
"serialNumber"
,
this
.
serialNumber
+
""
);
if
(!
Double
.
isNaN
(
this
.
sensorTemperature
))
properties
.
setProperty
(
prefix
+
"sensorTemperature"
,
this
.
sensorTemperature
+
""
);
if
(!
Double
.
isNaN
(
this
.
sensorTemperature
))
properties
.
setProperty
(
prefix
+
"sensorTemperature"
,
this
.
sensorTemperature
+
""
);
if
(!
Double
.
isNaN
(
this
.
result_lastKT
))
properties
.
setProperty
(
prefix
+
"result_lastKT"
,
this
.
result_lastKT
+
""
);
if
(!
Double
.
isNaN
(
this
.
result_lastKT
))
properties
.
setProperty
(
prefix
+
"result_lastKT"
,
this
.
result_lastKT
+
""
);
...
@@ -1017,6 +1022,9 @@ public class LensAdjustment {
...
@@ -1017,6 +1022,9 @@ public class LensAdjustment {
this
.
strategyFile
=
properties
.
getProperty
(
prefix
+
"strategyFile"
);
this
.
strategyFile
=
properties
.
getProperty
(
prefix
+
"strategyFile"
);
if
(
properties
.
getProperty
(
prefix
+
"resultsSuperDirectory"
)!=
null
)
if
(
properties
.
getProperty
(
prefix
+
"resultsSuperDirectory"
)!=
null
)
this
.
resultsSuperDirectory
=
properties
.
getProperty
(
prefix
+
"resultsSuperDirectory"
);
this
.
resultsSuperDirectory
=
properties
.
getProperty
(
prefix
+
"resultsSuperDirectory"
);
if
(
properties
.
getProperty
(
prefix
+
"focusingHistoryFile"
)!=
null
)
this
.
focusingHistoryFile
=
properties
.
getProperty
(
prefix
+
"focusingHistoryFile"
);
if
(
properties
.
getProperty
(
prefix
+
"serialNumber"
)!=
null
)
if
(
properties
.
getProperty
(
prefix
+
"serialNumber"
)!=
null
)
this
.
serialNumber
=
properties
.
getProperty
(
prefix
+
"serialNumber"
);
this
.
serialNumber
=
properties
.
getProperty
(
prefix
+
"serialNumber"
);
// this.serialNumber is only written, but never read from the configuration file (only from devivce)
// this.serialNumber is only written, but never read from the configuration file (only from devivce)
...
@@ -1422,6 +1430,7 @@ public class LensAdjustment {
...
@@ -1422,6 +1430,7 @@ public class LensAdjustment {
gd
.
addStringField
(
"Initial camera intrinsic/extrinsic parametres file"
,
this
.
initialCalibrationFile
,
40
);
gd
.
addStringField
(
"Initial camera intrinsic/extrinsic parametres file"
,
this
.
initialCalibrationFile
,
40
);
gd
.
addStringField
(
"Levenberg-Marquardt algorithm strategy file"
,
this
.
strategyFile
,
40
);
gd
.
addStringField
(
"Levenberg-Marquardt algorithm strategy file"
,
this
.
strategyFile
,
40
);
gd
.
addStringField
(
"Focusing results superdirectory (individual will be named by serial numbers)"
,
this
.
resultsSuperDirectory
,
40
);
gd
.
addStringField
(
"Focusing results superdirectory (individual will be named by serial numbers)"
,
this
.
resultsSuperDirectory
,
40
);
gd
.
addStringField
(
"Measurement history (acquired during \"Scan Calib LMA\" file"
,
this
.
focusingHistoryFile
,
80
);
gd
.
addNumericField
(
"EEPROM channel to read sensor serial number from"
,
this
.
EEPROM_channel
,
0
,
4
,
""
);
gd
.
addNumericField
(
"EEPROM channel to read sensor serial number from"
,
this
.
EEPROM_channel
,
0
,
4
,
""
);
gd
.
addCheckbox
(
"Save SFE focusing results (including intermediate) "
,
this
.
saveResults
);
gd
.
addCheckbox
(
"Save SFE focusing results (including intermediate) "
,
this
.
saveResults
);
gd
.
addCheckbox
(
"Show SFE focusing results (including intermediate) "
,
this
.
showResults
);
gd
.
addCheckbox
(
"Show SFE focusing results (including intermediate) "
,
this
.
showResults
);
...
@@ -1597,6 +1606,7 @@ public class LensAdjustment {
...
@@ -1597,6 +1606,7 @@ public class LensAdjustment {
this
.
initialCalibrationFile
=
gd
.
getNextString
();
this
.
initialCalibrationFile
=
gd
.
getNextString
();
this
.
strategyFile
=
gd
.
getNextString
();
this
.
strategyFile
=
gd
.
getNextString
();
this
.
resultsSuperDirectory
=
gd
.
getNextString
();
this
.
resultsSuperDirectory
=
gd
.
getNextString
();
this
.
focusingHistoryFile
=
gd
.
getNextString
();
this
.
EEPROM_channel
=
(
int
)
gd
.
getNextNumber
();
this
.
EEPROM_channel
=
(
int
)
gd
.
getNextNumber
();
this
.
saveResults
=
gd
.
getNextBoolean
();
this
.
saveResults
=
gd
.
getNextBoolean
();
this
.
showResults
=
gd
.
getNextBoolean
();
this
.
showResults
=
gd
.
getNextBoolean
();
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment