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
e4ac0da9
Commit
e4ac0da9
authored
Aug 28, 2014
by
Andrey Filippov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
more on adjustment
parent
2ed1f2f7
Changes
3
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
461 additions
and
59 deletions
+461
-59
Aberration_Calibration.java
src/main/java/Aberration_Calibration.java
+80
-4
FocusingField.java
src/main/java/FocusingField.java
+364
-55
LensAdjustment.java
src/main/java/LensAdjustment.java
+17
-0
No files found.
src/main/java/Aberration_Calibration.java
View file @
e4ac0da9
...
@@ -4388,6 +4388,7 @@ if (MORE_BUTTONS) {
...
@@ -4388,6 +4388,7 @@ if (MORE_BUTTONS) {
""
,
//); //String defaultPath); // AtomicInteger stopRequested
""
,
//); //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
);
if
(
PROPERTIES
!=
null
)
FOCUSING_FIELD
.
getProperties
(
"FOCUSING_FIELD."
,
PROPERTIES
);
if
(
PROPERTIES
!=
null
)
FOCUSING_FIELD
.
getProperties
(
"FOCUSING_FIELD."
,
PROPERTIES
);
System
.
out
.
println
(
"Loaded FocusingField"
);
System
.
out
.
println
(
"Loaded FocusingField"
);
if
(!
FOCUSING_FIELD
.
configureDataVector
(
"Configure curvature - TODO: fix many settings restored from properties"
,
true
,
true
))
return
;
if
(!
FOCUSING_FIELD
.
configureDataVector
(
"Configure curvature - TODO: fix many settings restored from properties"
,
true
,
true
))
return
;
...
@@ -4415,6 +4416,7 @@ if (MORE_BUTTONS) {
...
@@ -4415,6 +4416,7 @@ if (MORE_BUTTONS) {
DEBUG_LEVEL
=
MASTER_DEBUG_LEVEL
;
DEBUG_LEVEL
=
MASTER_DEBUG_LEVEL
;
if
(
FOCUSING_FIELD
==
null
)
return
;
if
(
FOCUSING_FIELD
==
null
)
return
;
FOCUSING_FIELD
.
setDebugLevel
(
DEBUG_LEVEL
);
FOCUSING_FIELD
.
setDebugLevel
(
DEBUG_LEVEL
);
FOCUSING_FIELD
.
setAdjustMode
(
false
);
if
(!
FOCUSING_FIELD
.
configureDataVector
(
"Re-configure curvature parameters"
,
false
,
true
))
return
;
if
(!
FOCUSING_FIELD
.
configureDataVector
(
"Re-configure curvature parameters"
,
false
,
true
))
return
;
FOCUSING_FIELD
.
setDataVector
(
FOCUSING_FIELD
.
setDataVector
(
true
,
// calibrate mode
true
,
// calibrate mode
...
@@ -4454,10 +4456,11 @@ if (MORE_BUTTONS) {
...
@@ -4454,10 +4456,11 @@ if (MORE_BUTTONS) {
DEBUG_LEVEL
=
MASTER_DEBUG_LEVEL
;
DEBUG_LEVEL
=
MASTER_DEBUG_LEVEL
;
if
(
FOCUSING_FIELD
==
null
)
return
;
if
(
FOCUSING_FIELD
==
null
)
return
;
FOCUSING_FIELD
.
setDebugLevel
(
DEBUG_LEVEL
);
FOCUSING_FIELD
.
setDebugLevel
(
DEBUG_LEVEL
);
FOCUSING_FIELD
.
setAdjustMode
(
false
);
FOCUSING_FIELD
.
LevenbergMarquardt
(
FOCUSING_FIELD
.
LevenbergMarquardt
(
null
,
// measurement
null
,
// measurement
true
,
// open dialog
true
,
// open dialog
false
,
// filterZ
//
false, // filterZ
DEBUG_LEVEL
);
//boolean openDialog, int debugLevel){
DEBUG_LEVEL
);
//boolean openDialog, int debugLevel){
return
;
return
;
}
}
...
@@ -9719,7 +9722,44 @@ if (MORE_BUTTONS) {
...
@@ -9719,7 +9722,44 @@ if (MORE_BUTTONS) {
}
}
if
(!
allOK
)
break
;
// failed
if
(!
allOK
)
break
;
// failed
}
}
if
(
focusMeasurementParameters
.
scanTiltReverse
)
{
if
(
debugLevel
>
0
)
System
.
out
.
println
(
"Starting reverse scanning tilt in X direction, number of stops="
+
focusMeasurementParameters
.
scanTiltStepsX
+
", step size="
+
IJ
.
d2s
(
scanStepX
,
0
));
for
(
int
numStep
=
0
;
numStep
<
focusMeasurementParameters
.
scanTiltStepsX
;
numStep
++){
int
delta
=(
int
)
Math
.
round
(
focusMeasurementParameters
.
scanTiltRangeX
*
(
1.0
*
numStep
/(
focusMeasurementParameters
.
scanTiltStepsX
-
1
)
-
0.5
));
scanPos
[
0
]=
centerMotorPos
[
0
]+
delta
;
scanPos
[
1
]=
centerMotorPos
[
1
]+
delta
;
scanPos
[
2
]=
centerMotorPos
[
2
]-
delta
;
if
(
debugLevel
>
0
)
System
.
out
.
println
(
"Reverse scanning tilt in X direction, step#"
+(
numStep
+
1
)+
" (of "
+
focusMeasurementParameters
.
scanTiltStepsX
+
") at "
+
IJ
.
d2s
(
0.000000001
*(
System
.
nanoTime
()-
startTime
),
3
));
allOK
&=
moveAndMaybeProbe
(
true
,
scanPos
,
// null OK
focusingMotors
,
camerasInterface
,
lensDistortionParameters
,
matchSimulatedPattern
,
// should not bee null
focusMeasurementParameters
,
patternDetectParameters
,
distortionParameters
,
simulParameters
,
colorComponents
,
otfFilterParameters
,
psfParameters
,
threadsMax
,
updateStatus
,
debugLevel
,
loopDebugLevel
);
if
(
this
.
SYNC_COMMAND
.
stopRequested
.
get
()>
0
){
aborted
=
true
;
allOK
=
false
;
System
.
out
.
println
(
"Stop requested, command aborted, returning motors to initial position"
);
break
;
}
if
(!
allOK
)
break
;
// failed
}
}
}
}
if
(
allOK
&&
(
focusMeasurementParameters
.
scanTiltStepsY
>
1
))
{
// 0 or 1 STOPS - do not scan
if
(
allOK
&&
(
focusMeasurementParameters
.
scanTiltStepsY
>
1
))
{
// 0 or 1 STOPS - do not scan
double
scanStepY
=
1.0
*
focusMeasurementParameters
.
scanTiltRangeY
/(
focusMeasurementParameters
.
scanTiltStepsY
-
1
);
double
scanStepY
=
1.0
*
focusMeasurementParameters
.
scanTiltRangeY
/(
focusMeasurementParameters
.
scanTiltStepsY
-
1
);
...
@@ -9759,9 +9799,45 @@ if (MORE_BUTTONS) {
...
@@ -9759,9 +9799,45 @@ if (MORE_BUTTONS) {
}
}
if
(!
allOK
)
break
;
// failed
if
(!
allOK
)
break
;
// failed
}
}
if
(
focusMeasurementParameters
.
scanTiltReverse
)
{
if
(
debugLevel
>
0
)
System
.
out
.
println
(
"Starting reverse scanning tilt in Y direction, number of stops="
+
focusMeasurementParameters
.
scanTiltStepsY
+
", step size="
+
IJ
.
d2s
(
scanStepY
,
0
));
for
(
int
numStep
=
0
;
numStep
<
focusMeasurementParameters
.
scanTiltStepsY
;
numStep
++){
int
delta
=(
int
)
Math
.
round
(
focusMeasurementParameters
.
scanTiltRangeY
*
(
1.0
*
numStep
/(
focusMeasurementParameters
.
scanTiltStepsY
-
1
)
-
0.5
));
scanPos
[
0
]=
centerMotorPos
[
0
]+
delta
;
scanPos
[
1
]=
centerMotorPos
[
1
]-
delta
;
scanPos
[
2
]=
centerMotorPos
[
2
]+
0
;
if
(
debugLevel
>
0
)
System
.
out
.
println
(
"Reverse scanning tilt in Y direction, step#"
+(
numStep
+
1
)+
" (of "
+
focusMeasurementParameters
.
scanTiltStepsY
+
") at "
+
IJ
.
d2s
(
0.000000001
*(
System
.
nanoTime
()-
startTime
),
3
));
allOK
&=
moveAndMaybeProbe
(
true
,
scanPos
,
// null OK
focusingMotors
,
camerasInterface
,
lensDistortionParameters
,
matchSimulatedPattern
,
// should not bee null
focusMeasurementParameters
,
patternDetectParameters
,
distortionParameters
,
simulParameters
,
colorComponents
,
otfFilterParameters
,
psfParameters
,
threadsMax
,
updateStatus
,
debugLevel
,
loopDebugLevel
);
if
(
this
.
SYNC_COMMAND
.
stopRequested
.
get
()>
0
){
aborted
=
true
;
allOK
=
false
;
System
.
out
.
println
(
"Stop requested, command aborted, returning motors to initial position"
);
break
;
}
if
(!
allOK
)
break
;
// failed
}
}
}
}
}
}
if
(
allOK
&&
focusMeasurementParameters
.
scanHysteresis
&&
(
scanPosLast
!=
null
)){
if
(
allOK
&&
focusMeasurementParameters
.
scanHysteresis
&&
(
scanPosLast
!=
null
)){
...
...
src/main/java/FocusingField.java
View file @
e4ac0da9
This diff is collapsed.
Click to expand it.
src/main/java/LensAdjustment.java
View file @
e4ac0da9
...
@@ -304,6 +304,7 @@ public class LensAdjustment {
...
@@ -304,6 +304,7 @@ public class LensAdjustment {
public
int
scanHysteresisNumber
=
5
;
// number of test points for the Hysteresis measurement
public
int
scanHysteresisNumber
=
5
;
// number of test points for the Hysteresis measurement
public
boolean
scanTiltEnable
=
true
;
// enable scanning tilt
public
boolean
scanTiltEnable
=
true
;
// enable scanning tilt
public
boolean
scanTiltReverse
=
false
;
// enable scanning tilt in both directions
public
int
scanTiltRangeX
=
14336
;
// 4 periods
public
int
scanTiltRangeX
=
14336
;
// 4 periods
public
int
scanTiltRangeY
=
14336
;
// 4 periods
public
int
scanTiltRangeY
=
14336
;
// 4 periods
public
int
scanTiltStepsX
=
24
;
public
int
scanTiltStepsX
=
24
;
...
@@ -518,6 +519,7 @@ public class LensAdjustment {
...
@@ -518,6 +519,7 @@ public class LensAdjustment {
int
scanHysteresisNumber
,
// number of test points for the Hysteresis measurement
int
scanHysteresisNumber
,
// number of test points for the Hysteresis measurement
boolean
scanTiltEnable
,
//=true; // enable scanning tilt
boolean
scanTiltEnable
,
//=true; // enable scanning tilt
boolean
scanTiltReverse
,
int
scanTiltRangeX
,
//=14336; // 4 periods
int
scanTiltRangeX
,
//=14336; // 4 periods
int
scanTiltRangeY
,
//=14336; // 4 periods
int
scanTiltRangeY
,
//=14336; // 4 periods
int
scanTiltStepsX
,
//=24;
int
scanTiltStepsX
,
//=24;
...
@@ -660,6 +662,7 @@ public class LensAdjustment {
...
@@ -660,6 +662,7 @@ public class LensAdjustment {
this
.
scanHysteresisNumber
=
scanHysteresisNumber
;
// number of test points for the Hysteresis measurement
this
.
scanHysteresisNumber
=
scanHysteresisNumber
;
// number of test points for the Hysteresis measurement
this
.
scanTiltEnable
=
scanTiltEnable
;
//=true; // enable scanning tilt
this
.
scanTiltEnable
=
scanTiltEnable
;
//=true; // enable scanning tilt
this
.
scanTiltReverse
=
scanTiltReverse
;
this
.
scanTiltRangeX
=
scanTiltRangeX
;
//, //=14336; // 4 periods
this
.
scanTiltRangeX
=
scanTiltRangeX
;
//, //=14336; // 4 periods
this
.
scanTiltRangeY
=
scanTiltRangeY
;
//, //=14336; // 4 periods
this
.
scanTiltRangeY
=
scanTiltRangeY
;
//, //=14336; // 4 periods
this
.
scanTiltStepsX
=
scanTiltStepsX
;
//=24;
this
.
scanTiltStepsX
=
scanTiltStepsX
;
//=24;
...
@@ -803,6 +806,7 @@ public class LensAdjustment {
...
@@ -803,6 +806,7 @@ public class LensAdjustment {
this
.
scanHysteresisNumber
,
// number of test points for the Hysteresis measurement
this
.
scanHysteresisNumber
,
// number of test points for the Hysteresis measurement
this
.
scanTiltEnable
,
// enable scanning tilt
this
.
scanTiltEnable
,
// enable scanning tilt
this
.
scanTiltReverse
,
this
.
scanTiltRangeX
,
// 4 periods
this
.
scanTiltRangeX
,
// 4 periods
this
.
scanTiltRangeY
,
// 4 periods
this
.
scanTiltRangeY
,
// 4 periods
this
.
scanTiltStepsX
,
this
.
scanTiltStepsX
,
...
@@ -953,6 +957,8 @@ public class LensAdjustment {
...
@@ -953,6 +957,8 @@ public class LensAdjustment {
properties
.
setProperty
(
prefix
+
"scanHysteresisNumber"
,
this
.
scanHysteresisNumber
+
""
);
properties
.
setProperty
(
prefix
+
"scanHysteresisNumber"
,
this
.
scanHysteresisNumber
+
""
);
properties
.
setProperty
(
prefix
+
"scanTiltEnable"
,
this
.
scanTiltEnable
+
""
);
// enable scanning tilt
properties
.
setProperty
(
prefix
+
"scanTiltEnable"
,
this
.
scanTiltEnable
+
""
);
// enable scanning tilt
properties
.
setProperty
(
prefix
+
"scanTiltReverse"
,
this
.
scanTiltReverse
+
""
);
properties
.
setProperty
(
prefix
+
"scanTiltRangeX"
,
this
.
scanTiltRangeX
+
""
);
// 4 periods
properties
.
setProperty
(
prefix
+
"scanTiltRangeX"
,
this
.
scanTiltRangeX
+
""
);
// 4 periods
properties
.
setProperty
(
prefix
+
"scanTiltRangeY"
,
this
.
scanTiltRangeY
+
""
);
// 4 periods
properties
.
setProperty
(
prefix
+
"scanTiltRangeY"
,
this
.
scanTiltRangeY
+
""
);
// 4 periods
properties
.
setProperty
(
prefix
+
"scanTiltStepsX"
,
this
.
scanTiltStepsX
+
""
);
properties
.
setProperty
(
prefix
+
"scanTiltStepsX"
,
this
.
scanTiltStepsX
+
""
);
...
@@ -1207,6 +1213,10 @@ public class LensAdjustment {
...
@@ -1207,6 +1213,10 @@ public class LensAdjustment {
if
(
properties
.
getProperty
(
prefix
+
"scanTiltEnable"
)!=
null
)
if
(
properties
.
getProperty
(
prefix
+
"scanTiltEnable"
)!=
null
)
this
.
scanTiltEnable
=
Boolean
.
parseBoolean
(
properties
.
getProperty
(
prefix
+
"scanTiltEnable"
));
this
.
scanTiltEnable
=
Boolean
.
parseBoolean
(
properties
.
getProperty
(
prefix
+
"scanTiltEnable"
));
if
(
properties
.
getProperty
(
prefix
+
"scanTiltReverse"
)!=
null
)
this
.
scanTiltReverse
=
Boolean
.
parseBoolean
(
properties
.
getProperty
(
prefix
+
"scanTiltReverse"
));
if
(
properties
.
getProperty
(
prefix
+
"scanTiltRangeX"
)!=
null
)
if
(
properties
.
getProperty
(
prefix
+
"scanTiltRangeX"
)!=
null
)
this
.
scanTiltRangeX
=
Integer
.
parseInt
(
properties
.
getProperty
(
prefix
+
"scanTiltRangeX"
));
this
.
scanTiltRangeX
=
Integer
.
parseInt
(
properties
.
getProperty
(
prefix
+
"scanTiltRangeX"
));
if
(
properties
.
getProperty
(
prefix
+
"scanTiltRangeY"
)!=
null
)
if
(
properties
.
getProperty
(
prefix
+
"scanTiltRangeY"
)!=
null
)
...
@@ -1353,6 +1363,9 @@ public class LensAdjustment {
...
@@ -1353,6 +1363,9 @@ public class LensAdjustment {
gd
.
addNumericField
(
"Number of scan steps during hysteresis (play) measurement"
,
this
.
scanHysteresisNumber
,
0
);
gd
.
addNumericField
(
"Number of scan steps during hysteresis (play) measurement"
,
this
.
scanHysteresisNumber
,
0
);
gd
.
addCheckbox
(
"Scan for tilt measurement (approximately preserving center)"
,
this
.
scanTiltEnable
);
gd
.
addCheckbox
(
"Scan for tilt measurement (approximately preserving center)"
,
this
.
scanTiltEnable
);
gd
.
addCheckbox
(
"Scan for tilt measurement in both directions"
,
this
.
scanTiltReverse
);
gd
.
addNumericField
(
"Full range of scanning motors tilting in X-direction"
,
this
.
scanTiltRangeX
,
0
,
7
,
"motors steps"
);
gd
.
addNumericField
(
"Full range of scanning motors tilting in X-direction"
,
this
.
scanTiltRangeX
,
0
,
7
,
"motors steps"
);
gd
.
addNumericField
(
"Full range of scanning motors tilting in Y-direction"
,
this
.
scanTiltRangeY
,
0
,
7
,
"motors steps"
);
gd
.
addNumericField
(
"Full range of scanning motors tilting in Y-direction"
,
this
.
scanTiltRangeY
,
0
,
7
,
"motors steps"
);
gd
.
addNumericField
(
"Number of stops measurements when tilting in X-deirection"
,
this
.
scanTiltStepsX
,
0
);
gd
.
addNumericField
(
"Number of stops measurements when tilting in X-deirection"
,
this
.
scanTiltStepsX
,
0
);
...
@@ -1372,6 +1385,7 @@ public class LensAdjustment {
...
@@ -1372,6 +1385,7 @@ public class LensAdjustment {
this
.
scanHysteresisNumber
=
(
int
)
gd
.
getNextNumber
();
this
.
scanHysteresisNumber
=
(
int
)
gd
.
getNextNumber
();
this
.
scanTiltEnable
=
gd
.
getNextBoolean
();
this
.
scanTiltEnable
=
gd
.
getNextBoolean
();
this
.
scanTiltReverse
=
gd
.
getNextBoolean
();
this
.
scanTiltRangeX
=
(
int
)
gd
.
getNextNumber
();
this
.
scanTiltRangeX
=
(
int
)
gd
.
getNextNumber
();
this
.
scanTiltRangeY
=
(
int
)
gd
.
getNextNumber
();
this
.
scanTiltRangeY
=
(
int
)
gd
.
getNextNumber
();
this
.
scanTiltStepsX
=
(
int
)
gd
.
getNextNumber
();
this
.
scanTiltStepsX
=
(
int
)
gd
.
getNextNumber
();
...
@@ -1503,6 +1517,8 @@ public class LensAdjustment {
...
@@ -1503,6 +1517,8 @@ public class LensAdjustment {
gd
.
addNumericField
(
"Number of scan steps during hysteresis (play) measurement"
,
this
.
scanHysteresisNumber
,
0
);
gd
.
addNumericField
(
"Number of scan steps during hysteresis (play) measurement"
,
this
.
scanHysteresisNumber
,
0
);
gd
.
addCheckbox
(
"Scan for tilt measurement (approximately preserving center)"
,
this
.
scanTiltEnable
);
gd
.
addCheckbox
(
"Scan for tilt measurement (approximately preserving center)"
,
this
.
scanTiltEnable
);
gd
.
addCheckbox
(
"Scan for tilt measurement in both directions"
,
this
.
scanTiltReverse
);
gd
.
addNumericField
(
"Full range of scanning motors tilting in X-direction"
,
this
.
scanTiltRangeX
,
0
,
7
,
"motors steps"
);
gd
.
addNumericField
(
"Full range of scanning motors tilting in X-direction"
,
this
.
scanTiltRangeX
,
0
,
7
,
"motors steps"
);
gd
.
addNumericField
(
"Full range of scanning motors tilting in Y-direction"
,
this
.
scanTiltRangeY
,
0
,
7
,
"motors steps"
);
gd
.
addNumericField
(
"Full range of scanning motors tilting in Y-direction"
,
this
.
scanTiltRangeY
,
0
,
7
,
"motors steps"
);
gd
.
addNumericField
(
"Number of stops measurements when tilting in X-deirection"
,
this
.
scanTiltStepsX
,
0
);
gd
.
addNumericField
(
"Number of stops measurements when tilting in X-deirection"
,
this
.
scanTiltStepsX
,
0
);
...
@@ -1667,6 +1683,7 @@ public class LensAdjustment {
...
@@ -1667,6 +1683,7 @@ public class LensAdjustment {
this
.
scanHysteresisNumber
=
(
int
)
gd
.
getNextNumber
();
this
.
scanHysteresisNumber
=
(
int
)
gd
.
getNextNumber
();
this
.
scanTiltEnable
=
gd
.
getNextBoolean
();
this
.
scanTiltEnable
=
gd
.
getNextBoolean
();
this
.
scanTiltReverse
=
gd
.
getNextBoolean
();
this
.
scanTiltRangeX
=
(
int
)
gd
.
getNextNumber
();
this
.
scanTiltRangeX
=
(
int
)
gd
.
getNextNumber
();
this
.
scanTiltRangeY
=
(
int
)
gd
.
getNextNumber
();
this
.
scanTiltRangeY
=
(
int
)
gd
.
getNextNumber
();
this
.
scanTiltStepsX
=
(
int
)
gd
.
getNextNumber
();
this
.
scanTiltStepsX
=
(
int
)
gd
.
getNextNumber
();
...
...
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