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
57f9aca9
Commit
57f9aca9
authored
Jul 02, 2014
by
Andrey Filippov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
next snapshot
parent
47ffc516
Changes
4
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
599 additions
and
138 deletions
+599
-138
Aberration_Calibration.java
src/main/java/Aberration_Calibration.java
+59
-12
CalibrationHardwareInterface.java
src/main/java/CalibrationHardwareInterface.java
+17
-10
FocusingField.java
src/main/java/FocusingField.java
+475
-116
MatchSimulatedPattern.java
src/main/java/MatchSimulatedPattern.java
+48
-0
No files found.
src/main/java/Aberration_Calibration.java
View file @
57f9aca9
...
@@ -10147,6 +10147,9 @@ if (MORE_BUTTONS) {
...
@@ -10147,6 +10147,9 @@ if (MORE_BUTTONS) {
}
}
}
}
boolean
showPSF
=
debugLevel
>
1
;
boolean
showPSF
=
debugLevel
>
1
;
if
(
metrics
==
null
)
return
null
;
if
(
showPSF
||
(
focusMeasurementParameters
.
saveResults
)){
if
(
showPSF
||
(
focusMeasurementParameters
.
saveResults
)){
double
[][][][]
psfRGB
=
new
double
[
psf_kernels
.
length
][
psf_kernels
[
0
].
length
][][];
double
[][][][]
psfRGB
=
new
double
[
psf_kernels
.
length
][
psf_kernels
[
0
].
length
][][];
// reorder and assign names to kernel color channels
// reorder and assign names to kernel color channels
...
@@ -10189,8 +10192,11 @@ if (MORE_BUTTONS) {
...
@@ -10189,8 +10192,11 @@ if (MORE_BUTTONS) {
imp_psf
.
setProperty
(
"pY_"
+
index
,
""
+
sampleCoord
[
ii
][
jj
][
1
]);
imp_psf
.
setProperty
(
"pY_"
+
index
,
""
+
sampleCoord
[
ii
][
jj
][
1
]);
if
(
fullResults
[
ii
][
jj
]!=
null
){
if
(
fullResults
[
ii
][
jj
]!=
null
){
for
(
int
cc
=
0
;
cc
<
fullResults
[
ii
][
jj
].
length
;
cc
++)
if
(
fullResults
[
ii
][
jj
][
cc
]!=
null
){
for
(
int
cc
=
0
;
cc
<
fullResults
[
ii
][
jj
].
length
;
cc
++)
if
(
fullResults
[
ii
][
jj
][
cc
]!=
null
){
imp_psf
.
setProperty
(
"R50_"
+
cc
+
"_"
+
index
,
""
+
fullResults
[
ii
][
jj
][
cc
][
0
]);
// imp_psf.setProperty("R50_"+cc+"_"+index, ""+fullResults[ii][jj][cc][0]);
imp_psf
.
setProperty
(
"RTratio_"
+
cc
+
"_"
+
index
,
""
+
fullResults
[
ii
][
jj
][
cc
][
1
]);
// imp_psf.setProperty("RTratio_"+cc+"_"+index, ""+fullResults[ii][jj][cc][1]);
imp_psf
.
setProperty
(
"R50_x2_"
+
cc
+
"_"
+
index
,
""
+
fullResults
[
ii
][
jj
][
cc
][
0
]);
imp_psf
.
setProperty
(
"R50_y2_"
+
cc
+
"_"
+
index
,
""
+
fullResults
[
ii
][
jj
][
cc
][
1
]);
imp_psf
.
setProperty
(
"R50_xy_"
+
cc
+
"_"
+
index
,
""
+
fullResults
[
ii
][
jj
][
cc
][
2
]);
}
}
}
}
}
}
...
@@ -10276,7 +10282,7 @@ if (MORE_BUTTONS) {
...
@@ -10276,7 +10282,7 @@ if (MORE_BUTTONS) {
fullResults
[
i
][
j
]=
new
double
[
numColors
][];
fullResults
[
i
][
j
]=
new
double
[
numColors
][];
for
(
int
cc
=
0
;
cc
<
numColors
;
cc
++)
fullResults
[
i
][
j
][
cc
]=
null
;
for
(
int
cc
=
0
;
cc
<
numColors
;
cc
++)
fullResults
[
i
][
j
][
cc
]=
null
;
}
}
if
(
fullResults
!=
null
)
fullResults
[
i
][
j
][
color
]=
new
double
[
2
];
//
if (fullResults!=null) fullResults[i][j][color]=new double[2];
double
x
=(
sampleCoord
[
i
][
j
][
0
]-
x0
);
double
x
=(
sampleCoord
[
i
][
j
][
0
]-
x0
);
double
y
=(
sampleCoord
[
i
][
j
][
1
]-
y0
);
double
y
=(
sampleCoord
[
i
][
j
][
1
]-
y0
);
double
r
=
Math
.
sqrt
(
x
*
x
+
y
*
y
);
double
r
=
Math
.
sqrt
(
x
*
x
+
y
*
y
);
...
@@ -10287,6 +10293,7 @@ if (MORE_BUTTONS) {
...
@@ -10287,6 +10293,7 @@ if (MORE_BUTTONS) {
// " psf_cutoffLevel="+focusMeasurementParameters.psf_cutoffLevel+
// " psf_cutoffLevel="+focusMeasurementParameters.psf_cutoffLevel+
// " psf_minArea="+focusMeasurementParameters.psf_minArea+
// " psf_minArea="+focusMeasurementParameters.psf_minArea+
// " psf_blurSigma="+focusMeasurementParameters.psf_blurSigma);
// " psf_blurSigma="+focusMeasurementParameters.psf_blurSigma);
/*
double [] tanRad= matchSimulatedPattern.tangetRadialSizes(
double [] tanRad= matchSimulatedPattern.tangetRadialSizes(
ca, // cosine of the center to sample vector
ca, // cosine of the center to sample vector
sa, // sine of the center to sample vector
sa, // sine of the center to sample vector
...
@@ -10302,9 +10309,50 @@ if (MORE_BUTTONS) {
...
@@ -10302,9 +10309,50 @@ if (MORE_BUTTONS) {
tanRad=new double[2];
tanRad=new double[2];
tanRad[0]=Double.NaN;
tanRad[0]=Double.NaN;
tanRad[1]=Double.NaN;
tanRad[1]=Double.NaN;
} else {
// debug calculations
double [] x2y2xy= matchSimulatedPattern.x2y2xySizes(
psf[i][j][color], // PSF function, square array, nominally positive
focusMeasurementParameters.psf_cutoffEnergy, // fraction of energy in the pixels to be used
focusMeasurementParameters.psf_cutoffLevel, // minimal level as a fraction of maximal
focusMeasurementParameters.psf_minArea, // minimal selected area in pixels
focusMeasurementParameters.psf_blurSigma, // optionally blur the selection
0.1, //maskCutOff,
debugLevel-2, // debug level
i+":"+j+"["+color+"]"); // String title) { // prefix used for debug images
double [] tanRad1={
Math.sqrt(sa*sa*x2y2xy[0]+ca*ca*x2y2xy[1]-2*ca*sa*x2y2xy[2]),
Math.sqrt(ca*ca*x2y2xy[0]+sa*sa*x2y2xy[1]+2*ca*sa*x2y2xy[2])};
System.out.println("i="+i+" j="+j+" tanRad[0]="+tanRad[0]+ "("+tanRad1[0]+")"+
" tanRad[1]="+tanRad[1]+ "("+tanRad1[1]+") ### "+x2y2xy[0]+", "+x2y2xy[1]+", "+x2y2xy[2]);
}
}
tanRad
[
0
]/=(
focusMeasurementParameters
.
subdiv
/
2
);
// to sesnor pixels
*/
tanRad
[
1
]/=(
focusMeasurementParameters
.
subdiv
/
2
);
double
[]
x2y2xy
=
matchSimulatedPattern
.
x2y2xySizes
(
psf
[
i
][
j
][
color
],
// PSF function, square array, nominally positive
focusMeasurementParameters
.
psf_cutoffEnergy
,
// fraction of energy in the pixels to be used
focusMeasurementParameters
.
psf_cutoffLevel
,
// minimal level as a fraction of maximal
focusMeasurementParameters
.
psf_minArea
,
// minimal selected area in pixels
focusMeasurementParameters
.
psf_blurSigma
,
// optionally blur the selection
0.1
,
//maskCutOff,
debugLevel
-
2
,
// debug level
i
+
":"
+
j
+
"["
+
color
+
"]"
);
// String title) { // prefix used for debug images
if
(
x2y2xy
==
null
){
x2y2xy
=
new
double
[
3
];
for
(
int
ii
=
0
;
ii
<
3
;
ii
++)
x2y2xy
[
ii
]=
Double
.
NaN
;
}
else
{
for
(
int
ii
=
0
;
ii
<
x2y2xy
.
length
;
ii
++)
x2y2xy
[
ii
]/=
focusMeasurementParameters
.
subdiv
*
focusMeasurementParameters
.
subdiv
/
4
;
}
/*
double [] tanRad={
Math.sqrt(sa*sa*x2y2xy[0]+ca*ca*x2y2xy[1]-2*ca*sa*x2y2xy[2]),
Math.sqrt(ca*ca*x2y2xy[0]+sa*sa*x2y2xy[1]+2*ca*sa*x2y2xy[2])};
*/
// tanRad[0]/=(focusMeasurementParameters.subdiv/2); // to sesnor pixels
// tanRad[1]/=(focusMeasurementParameters.subdiv/2);
double
[][]
quadCoeff
=
matchSimulatedPattern
.
approximatePSFQuadratic
(
double
[][]
quadCoeff
=
matchSimulatedPattern
.
approximatePSFQuadratic
(
psf
[
i
][
j
][
color
],
// PSF function, square array, nominally positive
psf
[
i
][
j
][
color
],
// PSF function, square array, nominally positive
...
@@ -10411,13 +10459,10 @@ Reff=sqrt(1/sqrt(Ar*Br-(Cr/2)^2))
...
@@ -10411,13 +10459,10 @@ Reff=sqrt(1/sqrt(Ar*Br-(Cr/2)^2))
SFcenter
+=
R50
;
// only center samples
SFcenter
+=
R50
;
// only center samples
}
}
if
(
fullResults
!=
null
){
if
(
fullResults
!=
null
){
// fullResults[i][j][color][0]=R50/(focusMeasurementParameters.subdiv/2); // pixels
// fullResults[i][j][color][1]=BA; // radial-to-tangential ratio - was fullResults[i][j][color][0] ???
fullResults
[
i
][
j
][
color
][
0
]=
Math
.
sqrt
((
tanRad
[
0
]*
tanRad
[
0
]+
tanRad
[
1
]*
tanRad
[
1
])/
2
);
// sensor pixels
fullResults
[
i
][
j
][
color
][
1
]=
tanRad
[
1
]/
tanRad
[
0
];
// radial-to-tangential ratio
// fullResults[i][j][color][0]=Math.sqrt((tanRad[0]*tanRad[0]+tanRad[1]*tanRad[1])/2); // sensor pixels
// fullResults[i][j][color][1]=tanRad[1]/tanRad[0]; // radial-to-tangential ratio
fullResults
[
i
][
j
][
color
]=
x2y2xy
.
clone
();
}
}
...
@@ -10426,7 +10471,8 @@ Reff=sqrt(1/sqrt(Ar*Br-(Cr/2)^2))
...
@@ -10426,7 +10471,8 @@ Reff=sqrt(1/sqrt(Ar*Br-(Cr/2)^2))
for
(
int
k
=
0
;
k
<
quadCoeff
[
0
].
length
;
k
++)
debugStr
+=
" "
+
quadCoeff
[
0
][
k
];
for
(
int
k
=
0
;
k
<
quadCoeff
[
0
].
length
;
k
++)
debugStr
+=
" "
+
quadCoeff
[
0
][
k
];
if
(
debugLevel
>
3
)
System
.
out
.
println
(
debugStr
);
if
(
debugLevel
>
3
)
System
.
out
.
println
(
debugStr
);
System
.
out
.
println
(
i
+
":"
+
j
+
"["
+
color
+
"] x="
+
IJ
.
d2s
(
x
,
1
)+
" y="
+
IJ
.
d2s
(
y
,
1
)+
" xc="
+
IJ
.
d2s
(
xc
,
2
)+
" yc="
+
IJ
.
d2s
(
yc
,
2
)+
System
.
out
.
println
(
i
+
":"
+
j
+
"["
+
color
+
"] x="
+
IJ
.
d2s
(
x
,
1
)+
" y="
+
IJ
.
d2s
(
y
,
1
)+
" xc="
+
IJ
.
d2s
(
xc
,
2
)+
" yc="
+
IJ
.
d2s
(
yc
,
2
)+
" tan="
+
IJ
.
d2s
(
tanRad
[
0
],
3
)+
" rad="
+
IJ
.
d2s
(
tanRad
[
1
],
3
)+
// " tan="+IJ.d2s(tanRad[0],3)+" rad="+IJ.d2s(tanRad[1],3)+
"x2="
+
IJ
.
d2s
(
x2y2xy
[
0
],
3
)+
"y2="
+
IJ
.
d2s
(
x2y2xy
[
1
],
3
)+
"xy="
+
IJ
.
d2s
(
x2y2xy
[
2
],
3
)+
" Ar="
+
IJ
.
d2s
(
Ar
,
3
)+
" Br="
+
IJ
.
d2s
(
Br
,
3
)+
" Cr="
+
IJ
.
d2s
(
Cr
,
3
)+
" **** Br/Ar="
+
IJ
.
d2s
(
Br
/
Ar
,
3
)+
" R50="
+
IJ
.
d2s
(
R50
,
3
)+
" subpixels"
+
" A50="
+
IJ
.
d2s
(
Math
.
sqrt
(
A50
),
2
)+
" subpixels"
+
" B50="
+
IJ
.
d2s
(
Math
.
sqrt
(
B50
),
3
)+
" subpixels"
);
" Ar="
+
IJ
.
d2s
(
Ar
,
3
)+
" Br="
+
IJ
.
d2s
(
Br
,
3
)+
" Cr="
+
IJ
.
d2s
(
Cr
,
3
)+
" **** Br/Ar="
+
IJ
.
d2s
(
Br
/
Ar
,
3
)+
" R50="
+
IJ
.
d2s
(
R50
,
3
)+
" subpixels"
+
" A50="
+
IJ
.
d2s
(
Math
.
sqrt
(
A50
),
2
)+
" subpixels"
+
" B50="
+
IJ
.
d2s
(
Math
.
sqrt
(
B50
),
3
)+
" subpixels"
);
}
}
}
}
...
@@ -14959,6 +15005,7 @@ private double [][] jacobianByJacobian(double [][] jacobian, boolean [] mask) {
...
@@ -14959,6 +15005,7 @@ private double [][] jacobianByJacobian(double [][] jacobian, boolean [] mask) {
false
,
// use linear approximation (instead of quadratic)
false
,
// use linear approximation (instead of quadratic)
1.0
E
-
10
,
// thershold ratio of matrix determinant to norm for linear approximation (det too low - fail)
1.0
E
-
10
,
// thershold ratio of matrix determinant to norm for linear approximation (det too low - fail)
1.0
E
-
20
);
// thershold ratio of matrix determinant to norm for quadratic approximation (det too low - fail)
1.0
E
-
20
);
// thershold ratio of matrix determinant to norm for quadratic approximation (det too low - fail)
if
(
distPatPars
==
null
)
return
null
;
int
[]
iUV
={(
int
)
Math
.
floor
(
distPatPars
[
0
][
2
]),(
int
)
Math
.
floor
(
distPatPars
[
1
][
2
])};
int
[]
iUV
={(
int
)
Math
.
floor
(
distPatPars
[
0
][
2
]),(
int
)
Math
.
floor
(
distPatPars
[
1
][
2
])};
boolean
negative
=((
iUV
[
0
]^
iUV
[
1
])&
1
)!=
0
;
boolean
negative
=((
iUV
[
0
]^
iUV
[
1
])&
1
)!=
0
;
double
[]
simCorr
={
double
[]
simCorr
={
...
...
src/main/java/CalibrationHardwareInterface.java
View file @
57f9aca9
...
@@ -5525,18 +5525,19 @@ if (debugLevel>=debugThreshold) System.out.println(i+" "+diff[0]+" "+diff[1]+" "
...
@@ -5525,18 +5525,19 @@ if (debugLevel>=debugThreshold) System.out.println(i+" "+diff[0]+" "+diff[1]+" "
if
((
samples
[
ii
][
jj
]!=
null
)
&&
(
samples
[
ii
][
jj
].
length
>
0
))
{
if
((
samples
[
ii
][
jj
]!=
null
)
&&
(
samples
[
ii
][
jj
].
length
>
0
))
{
String
sdata
=
ii
+
sep
+
jj
;
String
sdata
=
ii
+
sep
+
jj
;
for
(
int
cc
=
0
;
cc
<
samples
[
ii
][
jj
].
length
;
cc
++)
{
for
(
int
cc
=
0
;
cc
<
samples
[
ii
][
jj
].
length
;
cc
++)
{
/*
double rt=samples[ii][jj][cc][0]/Math.sqrt((1+samples[ii][jj][cc][1]*samples[ii][jj][cc][1])/2.0); // tangential;
double rt=samples[ii][jj][cc][0]/Math.sqrt((1+samples[ii][jj][cc][1]*samples[ii][jj][cc][1])/2.0); // tangential;
double rs=rt*samples[ii][jj][cc][1]; // saggital
double rs=rt*samples[ii][jj][cc][1]; // saggital
sdata += sep+rs+ // saggital
sdata += sep+rs+ // saggital
sep+rt; // tangential
sep+rt; // tangential
*/
sdata
+=
sep
+
samples
[
ii
][
jj
][
cc
][
0
]+
// x2
sep
+
samples
[
ii
][
jj
][
cc
][
1
]+
// y2
sep
+
samples
[
ii
][
jj
][
cc
][
2
];
// xy
// double [] samples_st={
// double [] samples_st={
// samples[ii][jj][cc][0], // saggital
// samples[ii][jj][cc][0], // saggital
// samples[ii][jj][cc][0]/samples[ii][jj][cc][1] // tangential (was ratio)
// samples[ii][jj][cc][0]/samples[ii][jj][cc][1] // tangential (was ratio)
// };
// };
if
((
samples
[
ii
][
jj
]!=
null
)
&&
(
samples
[
ii
][
jj
][
cc
]!=
null
))
{
// hConfig.addProperty(prefix+"y"+ii+".x"+jj+".c"+cc,samples_st); // array of 2
// nodeList.add(sdata);
}
}
}
nodeList
.
add
(
sdata
);
nodeList
.
add
(
sdata
);
}
}
...
@@ -5599,14 +5600,18 @@ if (debugLevel>=debugThreshold) System.out.println(i+" "+diff[0]+" "+diff[1]+" "
...
@@ -5599,14 +5600,18 @@ if (debugLevel>=debugThreshold) System.out.println(i+" "+diff[0]+" "+diff[1]+" "
if
(
showIndividualSamples
){
if
(
showIndividualSamples
){
if
(
showIndividualComponents
)
{
// additional 3 per-color rows
if
(
showIndividualComponents
)
{
// additional 3 per-color rows
for
(
int
i
=
0
;
i
<
sampleRows
;
i
++)
for
(
int
j
=
0
;
j
<
sampleColumns
;
j
++){
for
(
int
i
=
0
;
i
<
sampleRows
;
i
++)
for
(
int
j
=
0
;
j
<
sampleColumns
;
j
++){
header
+=
"\tY"
+
i
+
"X"
+
j
+
"_R"
+
"\tY"
+
i
+
"X"
+
j
+
"_R/T"
;
// header+="\tY"+i+"X"+j+"_R"+"\tY"+i+"X"+j+"_R/T";
header
+=
"\tY"
+
i
+
"X"
+
j
+
"_X2"
+
"\tY"
+
i
+
"X"
+
j
+
"_Y2"
+
"\tY"
+
i
+
"X"
+
j
+
"_XY"
;
}
}
}
else
{
}
else
{
for
(
int
i
=
0
;
i
<
sampleRows
;
i
++)
for
(
int
j
=
0
;
j
<
sampleColumns
;
j
++){
// single row fro all colors
for
(
int
i
=
0
;
i
<
sampleRows
;
i
++)
for
(
int
j
=
0
;
j
<
sampleColumns
;
j
++){
// single row fro all colors
header
+=
"\tY"
+
i
+
"X"
+
j
+
"_Red_R"
+
"\tY"
+
i
+
"X"
+
j
+
"_Red_R/T"
+
// header+="\tY"+i+"X"+j+"_Red_R"+"\tY"+i+"X"+j+"_Red_R/T"+
"\tY"
+
i
+
"X"
+
j
+
"_Green_R"
+
"\tY"
+
i
+
"X"
+
j
+
"_Green_R/T"
+
// "\tY"+i+"X"+j+"_Green_R"+"\tY"+i+"X"+j+"_Green_R/T"+
"\tY"
+
i
+
"X"
+
j
+
"_Blue_R"
+
"\tY"
+
i
+
"X"
+
j
+
"_Blue_R/T"
;
// "\tY"+i+"X"+j+"_Blue_R"+"\tY"+i+"X"+j+"_Blue_R/T";
header
+=
"\tY"
+
i
+
"X"
+
j
+
"_Red_X2"
+
"\tY"
+
i
+
"X"
+
j
+
"_Red_Y2"
+
"\tY"
+
i
+
"X"
+
j
+
"_Red_XY"
+
"\tY"
+
i
+
"X"
+
j
+
"_Green_X2"
+
"\tY"
+
i
+
"X"
+
j
+
"_Green_Y2"
+
"\tY"
+
i
+
"X"
+
j
+
"_Green_XY"
+
"\tY"
+
i
+
"X"
+
j
+
"_Blue_X2"
+
"\tY"
+
i
+
"X"
+
j
+
"_Blue_Y2"
+
"\tY"
+
i
+
"X"
+
j
+
"_Blue_XY"
;
}
}
}
}
}
}
...
@@ -5675,8 +5680,9 @@ if (debugLevel>=debugThreshold) System.out.println(i+" "+diff[0]+" "+diff[1]+" "
...
@@ -5675,8 +5680,9 @@ if (debugLevel>=debugThreshold) System.out.println(i+" "+diff[0]+" "+diff[1]+" "
if
((
samples
[
ii
][
jj
]!=
null
)
&&
(
samples
[
ii
][
jj
][
c
]!=
null
))
{
if
((
samples
[
ii
][
jj
]!=
null
)
&&
(
samples
[
ii
][
jj
][
c
]!=
null
))
{
sb
.
append
(
"\t"
+
IJ
.
d2s
(
samples
[
ii
][
jj
][
c
][
0
],
3
));
sb
.
append
(
"\t"
+
IJ
.
d2s
(
samples
[
ii
][
jj
][
c
][
0
],
3
));
sb
.
append
(
"\t"
+
IJ
.
d2s
(
samples
[
ii
][
jj
][
c
][
1
],
3
));
sb
.
append
(
"\t"
+
IJ
.
d2s
(
samples
[
ii
][
jj
][
c
][
1
],
3
));
sb
.
append
(
"\t"
+
IJ
.
d2s
(
samples
[
ii
][
jj
][
c
][
2
],
3
));
}
else
{
}
else
{
sb
.
append
(
"\t---\t---"
);
sb
.
append
(
"\t---\t---
\t---
"
);
}
}
}
}
}
}
...
@@ -5755,8 +5761,9 @@ if (debugLevel>=debugThreshold) System.out.println(i+" "+diff[0]+" "+diff[1]+" "
...
@@ -5755,8 +5761,9 @@ if (debugLevel>=debugThreshold) System.out.println(i+" "+diff[0]+" "+diff[1]+" "
if
((
samples
[
ii
][
jj
]!=
null
)
&&
(
samples
[
ii
][
jj
][
cc
]!=
null
))
{
if
((
samples
[
ii
][
jj
]!=
null
)
&&
(
samples
[
ii
][
jj
][
cc
]!=
null
))
{
sb
.
append
(
"\t"
+
IJ
.
d2s
(
samples
[
ii
][
jj
][
cc
][
0
],
3
));
sb
.
append
(
"\t"
+
IJ
.
d2s
(
samples
[
ii
][
jj
][
cc
][
0
],
3
));
sb
.
append
(
"\t"
+
IJ
.
d2s
(
samples
[
ii
][
jj
][
cc
][
1
],
3
));
sb
.
append
(
"\t"
+
IJ
.
d2s
(
samples
[
ii
][
jj
][
cc
][
1
],
3
));
sb
.
append
(
"\t"
+
IJ
.
d2s
(
samples
[
ii
][
jj
][
cc
][
2
],
3
));
}
else
{
}
else
{
sb
.
append
(
"\t---\t---"
);
sb
.
append
(
"\t---\t---
\t---
"
);
}
}
}
}
}
}
...
...
src/main/java/FocusingField.java
View file @
57f9aca9
This diff is collapsed.
Click to expand it.
src/main/java/MatchSimulatedPattern.java
View file @
57f9aca9
...
@@ -5354,6 +5354,53 @@ java.lang.ArrayIndexOutOfBoundsException: -3566
...
@@ -5354,6 +5354,53 @@ java.lang.ArrayIndexOutOfBoundsException: -3566
return
result
;
return
result
;
}
}
//====================================================
public
double
[]
x2y2xySizes
(
double
[]
psf
,
// PSF function, square array, nominally positive
double
cutoffEnergy
,
// fraction of energy in the pixels to be used
double
cutoffLevel
,
// minimal level as a fraction of maximal
int
minArea
,
// minimal selected area in pixels
double
blurSigma
,
// optionally blur the selection
double
maskCutOff
,
int
debugLevel
,
// debug level
String
title
)
{
// prefix used for debug images
double
[]
mask
=
findClusterOnPSF
(
psf
,
cutoffEnergy
,
cutoffLevel
,
minArea
,
blurSigma
,
debugLevel
,
title
);
for
(
int
i
=
0
;
i
<
mask
.
length
;
i
++)
if
(
mask
[
i
]<
maskCutOff
)
mask
[
i
]=
0.0
;
int
size
=
(
int
)
Math
.
sqrt
(
psf
.
length
);
int
hsize
=
size
/
2
;
// int nn=0;
double
S0
=
0.0
,
SX
=
0.0
,
SY
=
0.0
,
SX2
=
0.0
,
SY2
=
0.0
,
SXY
=
0.0
;
for
(
int
i
=
0
;
i
<
mask
.
length
;
i
++)
if
(
mask
[
i
]>
0.0
)
{
double
x
=(
i
%
size
)
-
hsize
;
double
y
=(
i
/
size
)
-
hsize
;
double
d
=
psf
[
i
]*
mask
[
i
];
S0
+=
d
;
SX
+=
d
*
x
;
SY
+=
d
*
y
;
SX2
+=
d
*
x
*
x
;
SY2
+=
d
*
y
*
y
;
SXY
+=
d
*
x
*
y
;
// nn++;
}
if
(
S0
==
0.0
)
return
null
;
// make sure it is OK
double
[]
result
={
(
SX2
*
S0
-
SX
*
SX
)/
S0
/
S0
,
(
SY2
*
S0
-
SY
*
SY
)/
S0
/
S0
,
(
SXY
*
S0
-
SX
*
SY
)/
S0
/
S0
};
// this may be negative
// System.out.println(" mask.length="+mask.length+" nn="+nn+" S0="+S0+" SX="+SX+" SY="+SY+" SX2="+SXR2+" SY2="+SY2+" SXY="+SXY+
// " result={"+result[0]+","+result[1]+","+result[2]+"}");
return
result
;
}
//====================================================
//====================================================
public
double
[]
findClusterOnPSF
(
public
double
[]
findClusterOnPSF
(
...
@@ -8509,6 +8556,7 @@ d()/dy=C*x+2*B*y+E=0
...
@@ -8509,6 +8556,7 @@ d()/dy=C*x+2*B*y+E=0
IJ
.
showMessage
(
"Error"
,
msg
);
IJ
.
showMessage
(
"Error"
,
msg
);
throw
new
IllegalArgumentException
(
msg
);
throw
new
IllegalArgumentException
(
msg
);
}
}
if
(
this
.
PATTERN_GRID
.
length
==
0
)
return
null
;
double
x1
=
x0
,
y1
=
y0
;
double
x1
=
x0
,
y1
=
y0
;
double
x2
=
x1
+
size
;
double
x2
=
x1
+
size
;
double
y2
=
y1
+
size
;
double
y2
=
y1
+
size
;
...
...
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