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
e2086aa9
Commit
e2086aa9
authored
Nov 09, 2014
by
Andrey Filippov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
more debugging
parent
cbbac8c8
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
39 additions
and
17 deletions
+39
-17
EyesisAberrations.java
src/main/java/EyesisAberrations.java
+14
-8
MatchSimulatedPattern.java
src/main/java/MatchSimulatedPattern.java
+25
-9
No files found.
src/main/java/EyesisAberrations.java
View file @
e2086aa9
...
@@ -1066,7 +1066,7 @@ public class EyesisAberrations {
...
@@ -1066,7 +1066,7 @@ public class EyesisAberrations {
MatchSimulatedPattern
.
PatternDetectParameters
patternDetectParameters
,
MatchSimulatedPattern
.
PatternDetectParameters
patternDetectParameters
,
SimulationPattern
.
SimulParameters
simulParameters
,
SimulationPattern
.
SimulParameters
simulParameters
,
ColorComponents
colorComponents
,
ColorComponents
colorComponents
,
boolean
resetBadKernels
,
// ignore and reset noUsefulKernels mark for selec
c
ted channel
boolean
resetBadKernels
,
// ignore and reset noUsefulKernels mark for selected channel
int
threadsMax
,
int
threadsMax
,
boolean
updateStatus
,
boolean
updateStatus
,
int
loopDebugLevel
,
// debug level used inside loops
int
loopDebugLevel
,
// debug level used inside loops
...
@@ -1094,14 +1094,14 @@ public class EyesisAberrations {
...
@@ -1094,14 +1094,14 @@ public class EyesisAberrations {
boolean
[]
selectedChannels
=
this
.
aberrationParameters
.
getChannelSelection
(
distortions
);
boolean
[]
selectedChannels
=
this
.
aberrationParameters
.
getChannelSelection
(
distortions
);
int
numSelected
=
0
;
int
numSelected
=
0
;
int
numDeselected
=
0
;
int
numDeselected
=
0
;
if
(
debugLevel
>
1
){
if
(
debugLevel
>
2
){
for
(
int
i
=
0
;
i
<
selectedChannels
.
length
;
i
++){
for
(
int
i
=
0
;
i
<
selectedChannels
.
length
;
i
++){
System
.
out
.
println
(
"Channel "
+
i
+
" is "
+(
selectedChannels
[
i
]?
"Enabled"
:
"Disabled"
));
System
.
out
.
println
(
"Channel "
+
i
+
" is "
+(
selectedChannels
[
i
]?
"Enabled"
:
"Disabled"
));
}
}
}
}
for
(
int
imgNum
=
0
;
imgNum
<
selectedImages
.
length
;
imgNum
++)
if
(
selectedImages
[
imgNum
])
{
for
(
int
imgNum
=
0
;
imgNum
<
selectedImages
.
length
;
imgNum
++)
if
(
selectedImages
[
imgNum
])
{
int
numChannel
=
distortionCalibrationData
.
gIP
[
imgNum
].
channel
;
int
numChannel
=
distortionCalibrationData
.
gIP
[
imgNum
].
channel
;
if
(
debugLevel
>
1
){
if
(
debugLevel
>
2
){
System
.
out
.
println
(
"Image "
+
imgNum
+
" channel "
+
numChannel
+
" is "
+(
selectedChannels
[
numChannel
]?
"ENABLED"
:
"DISABLED"
));
System
.
out
.
println
(
"Image "
+
imgNum
+
" channel "
+
numChannel
+
" is "
+(
selectedChannels
[
numChannel
]?
"ENABLED"
:
"DISABLED"
));
}
}
if
(!
selectedChannels
[
numChannel
]){
if
(!
selectedChannels
[
numChannel
]){
...
@@ -1111,7 +1111,7 @@ public class EyesisAberrations {
...
@@ -1111,7 +1111,7 @@ public class EyesisAberrations {
distortions
.
fittingStrategy
.
setNoUsefulPSFKernels
(
imgNum
,
false
);
// reset noUsefulKernels mark (if it was not set - OK)
distortions
.
fittingStrategy
.
setNoUsefulPSFKernels
(
imgNum
,
false
);
// reset noUsefulKernels mark (if it was not set - OK)
numSelected
++;
numSelected
++;
}
}
}
else
if
(
debugLevel
>
1
){
}
else
if
(
debugLevel
>
2
){
System
.
out
.
println
(
"Skipping disabled image "
+
imgNum
);
System
.
out
.
println
(
"Skipping disabled image "
+
imgNum
);
}
}
if
(
debugLevel
>
0
)
System
.
out
.
println
(
"Enabled "
+
numSelected
+
" source files ("
+
numDeselected
+
") were removed by channel selection"
);
if
(
debugLevel
>
0
)
System
.
out
.
println
(
"Enabled "
+
numSelected
+
" source files ("
+
numDeselected
+
") were removed by channel selection"
);
...
@@ -1237,9 +1237,9 @@ public class EyesisAberrations {
...
@@ -1237,9 +1237,9 @@ public class EyesisAberrations {
int
MaxRetries
=
4
;
int
MaxRetries
=
4
;
int
iRetry
=
0
;
int
iRetry
=
0
;
for
(
iRetry
=
0
;
iRetry
<
MaxRetries
;
iRetry
++){
for
(
iRetry
=
0
;
iRetry
<
MaxRetries
;
iRetry
++){
// is this retry needed?
try
{
try
{
matchSimulatedPattern
.
calculateDistortions
(
int
rslt
=
matchSimulatedPattern
.
calculateDistortions
(
distortionParameters
,
//
distortionParameters
,
//
patternDetectParameters
,
patternDetectParameters
,
simulParameters
,
simulParameters
,
...
@@ -1255,7 +1255,10 @@ public class EyesisAberrations {
...
@@ -1255,7 +1255,10 @@ public class EyesisAberrations {
debugLevel
,
debugLevel
,
loopDebugLevel
,
// debug level
loopDebugLevel
,
// debug level
aberrationParameters
.
noMessageBoxes
);
aberrationParameters
.
noMessageBoxes
);
if
(
rslt
<
0
){
if
(
debugLevel
>
0
)
System
.
out
.
println
(
"calculateDistortions failed, returned error code "
+
rslt
+
" riRetry="
+
iRetry
+
" (of "
+
MaxRetries
+
")"
);
continue
;
}
correlationSizesUsed
=
matchSimulatedPattern
.
getCorrelationSizesUsed
();
correlationSizesUsed
=
matchSimulatedPattern
.
getCorrelationSizesUsed
();
simArray
=
(
new
SimulationPattern
(
simulParameters
)).
simulateGridAll
(
simArray
=
(
new
SimulationPattern
(
simulParameters
)).
simulateGridAll
(
imp
.
getWidth
(),
imp
.
getWidth
(),
...
@@ -1299,7 +1302,10 @@ public class EyesisAberrations {
...
@@ -1299,7 +1302,10 @@ public class EyesisAberrations {
continue
;
continue
;
}
}
}
}
if
(
iRetry
==
MaxRetries
)
continue
;
if
(
iRetry
==
MaxRetries
)
{
System
.
out
.
println
(
"File "
+
files
[
imgNum
][
1
]+
" has problems - finished at "
+
IJ
.
d2s
(
0.000000001
*(
System
.
nanoTime
()-
startTime
),
3
));
continue
;
}
ImageStack
stack
=
mergeKernelsToStack
(
this
.
pdfKernelMap
);
ImageStack
stack
=
mergeKernelsToStack
(
this
.
pdfKernelMap
);
...
...
src/main/java/MatchSimulatedPattern.java
View file @
e2086aa9
...
@@ -3282,7 +3282,7 @@ public class MatchSimulatedPattern {
...
@@ -3282,7 +3282,7 @@ public class MatchSimulatedPattern {
triedIndices
[
numTries
]=
true
;
// all tried
triedIndices
[
numTries
]=
true
;
// all tried
}
else
{
}
else
{
// if (debugLevel>1) System.out.println("Found "+nodes.length+" candidates");
// if (debugLevel>1) System.out.println("Found "+nodes.length+" candidates");
if
(
debugLevel
>
1
)
System
.
out
.
println
(
"Found "
+
nodeQueue
.
size
()+
" candidates"
);
if
(
debugLevel
>
1
)
System
.
out
.
println
(
"
distortions:
Found "
+
nodeQueue
.
size
()+
" candidates"
);
}
}
}
else
{
}
else
{
if
(
debugLevel
>
1
)
System
.
out
.
println
(
"All start points tried before - should not get here"
);
if
(
debugLevel
>
1
)
System
.
out
.
println
(
"All start points tried before - should not get here"
);
...
@@ -3330,15 +3330,23 @@ public class MatchSimulatedPattern {
...
@@ -3330,15 +3330,23 @@ public class MatchSimulatedPattern {
nodeQueue
.
add
(
new
GridNode
(
node
));
// will not be used, any element
nodeQueue
.
add
(
new
GridNode
(
node
));
// will not be used, any element
}
}
int
numDefinedCells
=
0
;
int
numDefinedCells
=
0
;
for
(
GridNode
gn:
nodeQueue
){
int
debug_left
=
nodeQueue
.
size
();
for
(
GridNode
gn:
nodeQueue
){
// trying candidates as grid seeds - until found or nothing left
if
(
global_debug_level
>
1
)
{
System
.
out
.
println
(
"distortions: nodeQueue has "
+(
debug_left
--)+
" candidates left (including this one)"
);
}
if
(!
updating
){
if
(!
updating
){
double
[][]
node
=
gn
.
getNode
();
double
[][]
node
=
gn
.
getNode
();
double
[]
centerXY
=
node
[
0
];
double
[]
centerXY
=
node
[
0
];
if
(
global_debug_level
>
1
)
{
System
.
out
.
println
(
"distortions: node X/Y are "
+
centerXY
[
0
]+
"/"
+
centerXY
[
1
]);
}
// if (debugLevel>1) {
// if (debugLevel>1) {
if
(
global_debug_level
>
1
)
{
if
(
global_debug_level
>
1
)
{
System
.
out
.
println
(
"*** distortions: Center x="
+
IJ
.
d2s
(
centerXY
[
0
],
3
)+
" y="
+
IJ
.
d2s
(
centerXY
[
1
],
3
));
System
.
out
.
println
(
"*** distortions: Center x="
+
IJ
.
d2s
(
centerXY
[
0
],
3
)+
" y="
+
IJ
.
d2s
(
centerXY
[
1
],
3
));
System
.
out
.
println
(
"*** distortions: setting debugX="
+
IJ
.
d2s
(
centerXY
[
0
],
3
)+
" debugY="
+
IJ
.
d2s
(
centerXY
[
1
],
3
));
System
.
out
.
println
(
"*** distortions: setting debugX="
+
IJ
.
d2s
(
centerXY
[
0
],
3
)+
" debugY="
+
IJ
.
d2s
(
centerXY
[
1
],
3
));
patternDetectParameters
.
debugX
=
centerXY
[
0
];
//
patternDetectParameters
.
debugX
=
centerXY
[
0
];
//
Change debug coordinates to the initial node
patternDetectParameters
.
debugY
=
centerXY
[
1
];
//patternDetectParameters.debugRadius);
patternDetectParameters
.
debugY
=
centerXY
[
1
];
//patternDetectParameters.debugRadius);
}
}
debugLevel
=
debug_level
;
debugLevel
=
debug_level
;
...
@@ -3352,7 +3360,9 @@ public class MatchSimulatedPattern {
...
@@ -3352,7 +3360,9 @@ public class MatchSimulatedPattern {
node
[
2
]);
node
[
2
]);
waveFrontList
.
clear
();
waveFrontList
.
clear
();
putInWaveList
(
waveFrontList
,
centerUV
,
0
);
putInWaveList
(
waveFrontList
,
centerUV
,
0
);
if
(
global_debug_level
>
1
)
{
System
.
out
.
println
(
"putInWaveList(waveFrontList, {"
+
centerUV
[
0
]+
","
+
centerUV
[
1
]+
"}, 0);"
);
}
}
}
...
@@ -3382,6 +3392,7 @@ public class MatchSimulatedPattern {
...
@@ -3382,6 +3392,7 @@ public class MatchSimulatedPattern {
final
AtomicInteger
debugCellSet
=
new
AtomicInteger
(
0
);
// cells added at cleanup stage
final
AtomicInteger
debugCellSet
=
new
AtomicInteger
(
0
);
// cells added at cleanup stage
// special case (most common, actually) when initial wave has 1 node. Remove it after processing
// special case (most common, actually) when initial wave has 1 node. Remove it after processing
//first cell(s) will need large correction and so may fail during "refine", so trying to recalculate it right after the first layer)
ArrayList
<
Integer
>
initialWave
=
new
ArrayList
<
Integer
>();
ArrayList
<
Integer
>
initialWave
=
new
ArrayList
<
Integer
>();
for
(
Integer
I:
waveFrontList
)
initialWave
.
add
(
I
);
for
(
Integer
I:
waveFrontList
)
initialWave
.
add
(
I
);
while
(
waveFrontList
.
size
()>
0
)
{
while
(
waveFrontList
.
size
()>
0
)
{
...
@@ -3430,7 +3441,8 @@ public class MatchSimulatedPattern {
...
@@ -3430,7 +3441,8 @@ public class MatchSimulatedPattern {
if
(
waveFrontList
.
size
()==
0
)
break
;
// not really needed?
if
(
waveFrontList
.
size
()==
0
)
break
;
// not really needed?
layer
++;
layer
++;
if
(
updateStatus
)
IJ
.
showStatus
(
"Correlating patterns, layer "
+
layer
+(
cleanup
.
get
()?
"(cleanup)"
:
""
)+
", length "
+
waveFrontList
.
size
());
if
(
updateStatus
)
IJ
.
showStatus
(
"Correlating patterns, layer "
+
layer
+(
cleanup
.
get
()?
"(cleanup)"
:
""
)+
", length "
+
waveFrontList
.
size
());
if
(
debugLevel
>
1
)
System
.
out
.
println
(
"Correlating patterns, layer "
+
layer
+
", length "
+
waveFrontList
.
size
());
// if (debugLevel>1) System.out.println("Correlating patterns, layer "+layer+", length "+waveFrontList.size());
if
(
global_debug_level
>
1
)
System
.
out
.
println
(
"Correlating patterns, layer "
+
layer
+
", length "
+
waveFrontList
.
size
());
// starting layer
// starting layer
cellNum
.
set
(
0
);
cellNum
.
set
(
0
);
for
(
int
ithread
=
0
;
ithread
<
threads
.
length
;
ithread
++)
{
for
(
int
ithread
=
0
;
ithread
<
threads
.
length
;
ithread
++)
{
...
@@ -3453,7 +3465,8 @@ public class MatchSimulatedPattern {
...
@@ -3453,7 +3465,8 @@ public class MatchSimulatedPattern {
double
[][]
refCell
=
PATTERN_GRID
[
iUVRef
[
1
]][
iUVRef
[
0
]];
// should never be null as it is an old one
double
[][]
refCell
=
PATTERN_GRID
[
iUVRef
[
1
]][
iUVRef
[
0
]];
// should never be null as it is an old one
if
(
refCell
==
null
){
if
(
refCell
==
null
){
System
.
out
.
println
(
"**** refCell==null - what does it mean?**** u="
+
iUVRef
[
0
]+
" v="
+
iUVRef
[
1
]);
System
.
out
.
println
(
"**** refCell==null - what does it mean?**** u="
+
iUVRef
[
0
]+
" v="
+
iUVRef
[
1
]+
" current="
+
iUVdir
[
0
]+
"/"
+
iUVdir
[
1
]+
" len="
+
iUVdir
.
length
);
continue
;
continue
;
}
else
if
((
refCell
[
0
]!=
null
)
&&
(
refCell
[
0
].
length
>
3
)){
}
else
if
((
refCell
[
0
]!=
null
)
&&
(
refCell
[
0
].
length
>
3
)){
System
.
out
.
println
(
"**** refCell was deleted ****"
);
System
.
out
.
println
(
"**** refCell was deleted ****"
);
...
@@ -3678,7 +3691,7 @@ public class MatchSimulatedPattern {
...
@@ -3678,7 +3691,7 @@ public class MatchSimulatedPattern {
}
}
if
(
global_debug_level
>
1
)
System
.
out
.
println
(
"***** Starting cleanup, wave length="
+
waveFrontList
.
size
());
if
(
global_debug_level
>
1
)
System
.
out
.
println
(
"***** Starting cleanup, wave length="
+
waveFrontList
.
size
());
}
}
// end of layer
// end of layer
- it is a hack below, marking initial wave to recalculate it from neighbors
if
(
initialWave
!=
null
){
// just after the first layer (usually one cell) - delete it and add next time - otherwise first one needs large correction
if
(
initialWave
!=
null
){
// just after the first layer (usually one cell) - delete it and add next time - otherwise first one needs large correction
if
(
global_debug_level
>
0
)
if
(
global_debug_level
>
0
)
System
.
out
.
println
(
"Removing "
+
initialWave
.
size
()+
" initial wave cells"
);
System
.
out
.
println
(
"Removing "
+
initialWave
.
size
()+
" initial wave cells"
);
...
@@ -5415,6 +5428,7 @@ public class MatchSimulatedPattern {
...
@@ -5415,6 +5428,7 @@ public class MatchSimulatedPattern {
int
[]
uv
){
int
[]
uv
){
grid
[
uv
[
1
]][
uv
[
0
]]=
null
;
grid
[
uv
[
1
]][
uv
[
0
]]=
null
;
}
}
private
void
markDeletedPatternGridCell
(
private
void
markDeletedPatternGridCell
(
double
[][][][]
grid
,
double
[][][][]
grid
,
int
[]
uv
){
int
[]
uv
){
...
@@ -5426,8 +5440,10 @@ public class MatchSimulatedPattern {
...
@@ -5426,8 +5440,10 @@ public class MatchSimulatedPattern {
else
else
newXYC
[
i
]=
Double
.
NaN
;
newXYC
[
i
]=
Double
.
NaN
;
}
}
grid
[
uv
[
1
]][
uv
[
0
]][
0
]=
newXYC
;
}
}
grid
[
uv
[
1
]][
uv
[
0
]]=
null
;
// grid[uv[1]][uv[0]]=null;
}
}
private
boolean
isCellNew
(
//modified, for invalid uv will return "not new"
private
boolean
isCellNew
(
//modified, for invalid uv will return "not new"
double
[][][][]
grid
,
double
[][][][]
grid
,
...
@@ -5565,7 +5581,7 @@ public class MatchSimulatedPattern {
...
@@ -5565,7 +5581,7 @@ public class MatchSimulatedPattern {
public
int
gridUVHeight
(){
return
((
this
.
PATTERN_GRID
==
null
)
||
(
this
.
PATTERN_GRID
.
length
==
0
l
)
||(
this
.
PATTERN_GRID
[
0
]==
null
))?
0
:
this
.
PATTERN_GRID
.
length
;}
public
int
gridUVHeight
(){
return
((
this
.
PATTERN_GRID
==
null
)
||
(
this
.
PATTERN_GRID
.
length
==
0
l
)
||(
this
.
PATTERN_GRID
[
0
]==
null
))?
0
:
this
.
PATTERN_GRID
.
length
;}
/* ======================================================================== */
/* ======================================================================== */
/**
/**
* returns number of laser pointers matched
* returns number of laser pointers matched
(or negative error)
* if (this.flatFieldForGrid!=null) it should already be applied !!
* if (this.flatFieldForGrid!=null) it should already be applied !!
*/
*/
public
int
calculateDistortions
(
public
int
calculateDistortions
(
...
...
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