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
ada2ac85
Commit
ada2ac85
authored
May 17, 2017
by
Andrey Filippov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
testing/debugging diagonal swapping
parent
5d6289e3
Changes
4
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
487 additions
and
483 deletions
+487
-483
Conflict.java
src/main/java/Conflict.java
+205
-147
Conflicts.java
src/main/java/Conflicts.java
+5
-12
SuperTiles.java
src/main/java/SuperTiles.java
+262
-280
TileProcessor.java
src/main/java/TileProcessor.java
+15
-44
No files found.
src/main/java/Conflict.java
View file @
ada2ac85
...
@@ -23,6 +23,7 @@
...
@@ -23,6 +23,7 @@
*/
*/
public
class
Conflict
{
public
class
Conflict
{
int
nsTile
=
-
1
;
int
start_layer
;
int
start_layer
;
int
end_layer
;
int
end_layer
;
boolean
[]
start_dirs
=
new
boolean
[
24
];
boolean
[]
start_dirs
=
new
boolean
[
24
];
...
@@ -35,9 +36,19 @@ public class Conflict{
...
@@ -35,9 +36,19 @@ public class Conflict{
// 16 ... 23 - ortho-ortho-diagonal (turn left)
// 16 ... 23 - ortho-ortho-diagonal (turn left)
// 16 ... 19 : 16 - start_layer->N->W->SE->end_layer, 17 - start_layer->E->N->SW->end_layer, ...
// 16 ... 19 : 16 - start_layer->N->W->SE->end_layer, 17 - start_layer->E->N->SW->end_layer, ...
// 20 ... 23 : 20 - end_layer->N->W->SE->start_layer, 21 - end_layer->E->N->SW->start_layer, ...
// 20 ... 23 : 20 - end_layer->N->W->SE->start_layer, 21 - end_layer->E->N->SW->start_layer, ...
private
void
dbgCheck
(){
Conflict
(
int
start_layer
,
int
end_layer
,
int
start_dir
)
// for ortho-diag-ortho
// if (nsTile== 630){
// System.out.println("Conflict().dbgCheck, nsTile = "+nsTile);
// System.out.println("Conflict().dbgCheck, nsTile = "+nsTile);
// }
}
public
Conflict
(
int
nsTile
,
int
start_layer
,
int
end_layer
,
int
start_dir
)
// for ortho-diag-ortho
{
{
this
.
nsTile
=
nsTile
;
if
(
end_layer
>
start_layer
)
{
if
(
end_layer
>
start_layer
)
{
this
.
start_layer
=
start_layer
;
this
.
start_layer
=
start_layer
;
this
.
end_layer
=
end_layer
;
this
.
end_layer
=
end_layer
;
...
@@ -48,23 +59,33 @@ public class Conflict{
...
@@ -48,23 +59,33 @@ public class Conflict{
this
.
start_dirs
[
start_dir
+
4
]
=
true
;
this
.
start_dirs
[
start_dir
+
4
]
=
true
;
}
}
dbgCheck
();
}
}
Conflict
(
int
start_layer
,
int
end_layer
,
int
start_dir
,
boolean
right
)
// for ortho-ortho-diag
Conflict
(
int
nsTile
,
int
start_layer
,
int
end_layer
,
int
start_dir
,
boolean
right
)
// for ortho-ortho-diag
{
{
this
.
nsTile
=
nsTile
;
if
(
end_layer
>
start_layer
)
{
if
(
end_layer
>
start_layer
)
{
this
.
start_layer
=
start_layer
;
this
.
start_layer
=
start_layer
;
this
.
end_layer
=
end_layer
;
this
.
end_layer
=
end_layer
;
this
.
start_dirs
[(
right
?
8
:
12
)
+
start_dir
]
=
true
;
this
.
start_dirs
[(
right
?
8
:
16
)
+
start_dir
]
=
true
;
}
else
{
}
else
{
this
.
start_layer
=
end_layer
;
this
.
start_layer
=
end_layer
;
this
.
end_layer
=
start_layer
;
this
.
end_layer
=
start_layer
;
this
.
start_dirs
[(
right
?
16
:
20
)
+
start_dir
]
=
true
;
this
.
start_dirs
[(
right
?
12
:
20
)
+
start_dir
]
=
true
;
}
}
dbgCheck
();
}
}
Conflict
(
int
[]
arr
)
Conflict
(
int
nsTile
,
int
[]
arr
)
{
{
this
.
nsTile
=
nsTile
;
this
.
start_layer
=
arr
[
0
];
this
.
start_layer
=
arr
[
0
];
this
.
end_layer
=
arr
[
1
];
this
.
end_layer
=
arr
[
1
];
for
(
int
i
=
0
;
i
<
start_dirs
.
length
;
i
++){
for
(
int
i
=
0
;
i
<
start_dirs
.
length
;
i
++){
...
@@ -78,12 +99,39 @@ public class Conflict{
...
@@ -78,12 +99,39 @@ public class Conflict{
for
(
int
i
=
0
;
i
<
start_dirs
.
length
;
i
++){
for
(
int
i
=
0
;
i
<
start_dirs
.
length
;
i
++){
start_dirs
[
i
]
=
(
bits
&
(
1
<<
i
))
!=
0
;
start_dirs
[
i
]
=
(
bits
&
(
1
<<
i
))
!=
0
;
}
}
dbgCheck
();
}
int
getSTile
()
{
return
this
.
nsTile
;
}
}
public
String
toString
()
{
String
s
=
"Conflict"
+
" nsTile = "
+
getSTile
()+
" nl1 = "
+
getStartLayer
()+
" nl2 = "
+
getEndLayer
()+
" all = "
+
getNumConflicts
()
+
" ("
+
String
.
format
(
"%06x"
,
getDirBits
())+
")"
+
" odo = "
+
getNumOrthoDiagOrthoConflicts
()
+
" ood = "
+
getNumOrthoOrthoDiagConflicts
()
+
" number of odo incompatible triangles = "
+
getIncompatibleOrthoDiagOrthoConflicts
()
+
" number of odo dual triangles = "
+
getDualTriOrthoDiagOrthoConflicts
();
return
s
;
}
public
boolean
conflictExists
(
int
start_dir4
,
boolean
right
,
boolean
reverse
)
{
return
start_dirs
[
8
+
start_dir4
+
(
reverse
?
4
:
0
)
+
(
right
?
0
:
8
)];
}
boolean
combine
(
Conflict
other_conflict
)
boolean
combine
(
Conflict
other_conflict
)
{
{
dbgCheck
();
if
((
other_conflict
.
start_layer
==
this
.
start_layer
)
&&
(
other_conflict
.
end_layer
==
this
.
end_layer
))
{
if
((
other_conflict
.
start_layer
==
this
.
start_layer
)
&&
(
other_conflict
.
end_layer
==
this
.
end_layer
))
{
for
(
int
i
=
0
;
i
<
start_dirs
.
length
;
i
++)
start_dirs
[
i
]
|=
other_conflict
.
start_dirs
[
i
];
for
(
int
i
=
0
;
i
<
start_dirs
.
length
;
i
++)
start_dirs
[
i
]
|=
other_conflict
.
start_dirs
[
i
];
return
true
;
return
true
;
...
@@ -99,6 +147,16 @@ public class Conflict{
...
@@ -99,6 +147,16 @@ public class Conflict{
return
end_layer
;
return
end_layer
;
}
}
int
getStartLayer
(
boolean
reverse
){
return
reverse
?
end_layer:
start_layer
;
}
int
getEndLayer
(
boolean
reverse
){
return
reverse
?
start_layer
:
end_layer
;
}
int
getDirBits
(){
int
getDirBits
(){
int
dirs_bits
=
0
;
int
dirs_bits
=
0
;
for
(
int
i
=
0
;
i
<
start_dirs
.
length
;
i
++){
for
(
int
i
=
0
;
i
<
start_dirs
.
length
;
i
++){
...
@@ -191,4 +249,4 @@ public class Conflict{
...
@@ -191,4 +249,4 @@ public class Conflict{
}
}
}
}
src/main/java/Conflicts.java
View file @
ada2ac85
...
@@ -96,7 +96,7 @@ public class Conflicts {
...
@@ -96,7 +96,7 @@ public class Conflicts {
{
{
for
(
int
nsTile
=
0
;
nsTile
<
conflicts
.
length
;
nsTile
++)
if
(
conflicts
[
nsTile
]
!=
null
){
for
(
int
nsTile
=
0
;
nsTile
<
conflicts
.
length
;
nsTile
++)
if
(
conflicts
[
nsTile
]
!=
null
){
for
(
int
nc
=
0
;
nc
<
conflicts
[
nsTile
].
length
;
nc
++){
for
(
int
nc
=
0
;
nc
<
conflicts
[
nsTile
].
length
;
nc
++){
Conflict
conf
=
new
Conflict
(
conflicts
[
nsTile
][
nc
]);
Conflict
conf
=
new
Conflict
(
nsTile
,
conflicts
[
nsTile
][
nc
]);
if
(
conf
.
getNumOrthoDiagOrthoConflicts
()
>
0
)
num_ortho_diag_ortho
[
conf
.
getNumOrthoDiagOrthoConflicts
()
-
1
]++;
if
(
conf
.
getNumOrthoDiagOrthoConflicts
()
>
0
)
num_ortho_diag_ortho
[
conf
.
getNumOrthoDiagOrthoConflicts
()
-
1
]++;
if
(
conf
.
getNumOrthoOrthoDiagConflicts
()
>
0
)
num_ortho_ortho_diag
[
conf
.
getNumOrthoOrthoDiagConflicts
()
-
1
]++;
if
(
conf
.
getNumOrthoOrthoDiagConflicts
()
>
0
)
num_ortho_ortho_diag
[
conf
.
getNumOrthoOrthoDiagConflicts
()
-
1
]++;
if
(
conf
.
getNumConflicts
()
>
0
)
num_all_conflicts
[
conf
.
getNumConflicts
()
-
1
]++;
if
(
conf
.
getNumConflicts
()
>
0
)
num_all_conflicts
[
conf
.
getNumConflicts
()
-
1
]++;
...
@@ -153,14 +153,7 @@ public class Conflicts {
...
@@ -153,14 +153,7 @@ public class Conflicts {
public
void
printConflict
(
String
prefix
,
Conflict
conf
)
public
void
printConflict
(
String
prefix
,
Conflict
conf
)
{
{
System
.
out
.
println
(
prefix
+
System
.
out
.
println
(
prefix
+
conf
.
toString
());
" nl1 = "
+
conf
.
getStartLayer
()+
" nl2 = "
+
conf
.
getEndLayer
()+
" all = "
+
conf
.
getNumConflicts
()
+
" ("
+
String
.
format
(
"%06x"
,
conf
.
getDirBits
())+
")"
+
" odo = "
+
conf
.
getNumOrthoDiagOrthoConflicts
()
+
" ood = "
+
conf
.
getNumOrthoOrthoDiagConflicts
()
+
" number of odo incompatible triangles = "
+
conf
.
getIncompatibleOrthoDiagOrthoConflicts
()
+
" number of odo dual triangles = "
+
conf
.
getDualTriOrthoDiagOrthoConflicts
());
}
}
public
int
numBetterWorse
(
public
int
numBetterWorse
(
...
@@ -309,7 +302,7 @@ public class Conflicts {
...
@@ -309,7 +302,7 @@ public class Conflicts {
int
dir2
=
(
dir1
+
3
)
%
8
;
int
dir2
=
(
dir1
+
3
)
%
8
;
int
np3
=
neibs2
[
dir2
];
// planes[nsTile2][np2].getNeibBest(dir2);
int
np3
=
neibs2
[
dir2
];
// planes[nsTile2][np2].getNeibBest(dir2);
if
((
np3
>=
0
)
&&
(
np3
!=
np0
)){
if
((
np3
>=
0
)
&&
(
np3
!=
np0
)){
Conflict
conflict
=
new
Conflict
(
np0
,
np3
,
dir
/
2
);
Conflict
conflict
=
new
Conflict
(
n
sTile0
,
n
p0
,
np3
,
dir
/
2
);
label_apply:
label_apply:
{
{
for
(
Conflict
conf_old:
conflicts_list
){
for
(
Conflict
conf_old:
conflicts_list
){
...
@@ -335,7 +328,7 @@ public class Conflicts {
...
@@ -335,7 +328,7 @@ public class Conflicts {
int
dir2
=
(
dir1
+
3
)
%
8
;
int
dir2
=
(
dir1
+
3
)
%
8
;
int
np3
=
neibs2
[
dir2
];
// planes[nsTile2][np2].getNeibBest(dir2);
int
np3
=
neibs2
[
dir2
];
// planes[nsTile2][np2].getNeibBest(dir2);
if
((
np3
>=
0
)
&&
(
np3
!=
np0
)){
if
((
np3
>=
0
)
&&
(
np3
!=
np0
)){
Conflict
conflict
=
new
Conflict
(
np0
,
np3
,
dir
/
2
,
true
);
// ood, right
Conflict
conflict
=
new
Conflict
(
n
sTile0
,
n
p0
,
np3
,
dir
/
2
,
true
);
// ood, right
label_apply:
label_apply:
{
{
for
(
Conflict
conf_old:
conflicts_list
){
for
(
Conflict
conf_old:
conflicts_list
){
...
@@ -361,7 +354,7 @@ public class Conflicts {
...
@@ -361,7 +354,7 @@ public class Conflicts {
int
dir2
=
(
dir1
+
5
)
%
8
;
int
dir2
=
(
dir1
+
5
)
%
8
;
int
np3
=
neibs2
[
dir2
];
// planes[nsTile2][np2].getNeibBest(dir2);
int
np3
=
neibs2
[
dir2
];
// planes[nsTile2][np2].getNeibBest(dir2);
if
((
np3
>=
0
)
&&
(
np3
!=
np0
)){
if
((
np3
>=
0
)
&&
(
np3
!=
np0
)){
Conflict
conflict
=
new
Conflict
(
n
p0
,
np3
,
dir
/
2
,
true
);
// ood, righ
t
Conflict
conflict
=
new
Conflict
(
n
sTile0
,
np0
,
np3
,
dir
/
2
,
false
);
// ood, lef
t
label_apply:
label_apply:
{
{
for
(
Conflict
conf_old:
conflicts_list
){
for
(
Conflict
conf_old:
conflicts_list
){
...
...
src/main/java/SuperTiles.java
View file @
ada2ac85
This diff is collapsed.
Click to expand it.
src/main/java/TileProcessor.java
View file @
ada2ac85
...
@@ -3477,7 +3477,6 @@ public class TileProcessor {
...
@@ -3477,7 +3477,6 @@ public class TileProcessor {
int
[]
conflict_resoultion_results
=
st
.
resolveMultiTriangularConflicts
(
int
[]
conflict_resoultion_results
=
st
.
resolveMultiTriangularConflicts
(
conflicts0
,
// int [][][] conflicts,
conflicts0
,
// int [][][] conflicts,
conflicts0_stats
,
conflicts0_stats
,
clt_parameters
.
plMaxEigen
,
clt_parameters
.
plStarOrtho
,
// double orthoWeight,
clt_parameters
.
plStarOrtho
,
// double orthoWeight,
clt_parameters
.
plStarDiag
,
// double diagonalWeight,
clt_parameters
.
plStarDiag
,
// double diagonalWeight,
clt_parameters
.
plDblTriLoss
,
// double diagonalWeight,
clt_parameters
.
plDblTriLoss
,
// double diagonalWeight,
...
@@ -3486,28 +3485,10 @@ public class TileProcessor {
...
@@ -3486,28 +3485,10 @@ public class TileProcessor {
clt_parameters
.
tileX
,
clt_parameters
.
tileX
,
clt_parameters
.
tileY
);
clt_parameters
.
tileY
);
System
.
out
.
println
(
"Pass "
+(
pass
+
1
)+
": multi_tri_results (success/failures) = "
+
conflict_resoultion_results
[
0
]+
" / "
+
conflict_resoultion_results
[
1
]);
System
.
out
.
println
(
"Pass "
+(
pass
+
1
)+
": multi_tri_results (success/failures) = "
+
conflict_resoultion_results
[
0
]+
" / "
+
conflict_resoultion_results
[
1
]);
if
((
dual_tri_results
[
0
]
==
0
)
&&(
conflict_resoultion_results
[
0
]
==
0
))
break
;
}
/*
int [] conflicts1_stats = st.getNumConflicts(
conflicts0,
1); // -1); // debugLevel);
st.printConflictSummary(conflicts1_stats);
*/
Conflicts
conflicts1_stats
=
new
Conflicts
(
conflicts0
,
st
,
-
1
);
// debugLevel);
conflicts1_stats
.
printConflictSummary
(
"Detected conflicts (all):"
,
true
,
false
,
false
);
conflicts1_stats
.
printConflictSummary
(
"Detected conflicts (ortho-diag-ortho):"
,
false
,
true
,
false
);
conflicts1_stats
.
printConflictSummary
(
"Detected conflicts(ortho-ortho-diag):"
,
false
,
false
,
true
);
/*
int
[]
diagonal_resoultion_results
=
st
.
resolveDiagonalTriangularConflicts
(
for (int pass = 0; pass < 10; pass ++) {
int [] dual_tri_results = st. resolveDualTriangularConflicts(
conflicts0
,
// int [][][] conflicts,
conflicts0
,
// int [][][] conflicts,
conflicts0_stats
,
conflicts0_stats
,
clt_parameters.plMaxEigen,
clt_parameters
.
plStarOrtho
,
// double orthoWeight,
clt_parameters
.
plStarOrtho
,
// double orthoWeight,
clt_parameters
.
plStarDiag
,
// double diagonalWeight,
clt_parameters
.
plStarDiag
,
// double diagonalWeight,
clt_parameters
.
plDblTriLoss
,
// double diagonalWeight,
clt_parameters
.
plDblTriLoss
,
// double diagonalWeight,
...
@@ -3515,27 +3496,19 @@ public class TileProcessor {
...
@@ -3515,27 +3496,19 @@ public class TileProcessor {
1
,
// final int debugLevel)
1
,
// final int debugLevel)
clt_parameters
.
tileX
,
clt_parameters
.
tileX
,
clt_parameters
.
tileY
);
clt_parameters
.
tileY
);
System.out.println("Pass "+(pass+1)+": dual_tri_results (success/failures) = "+dual_tri_results[0]+" / "+dual_tri_results[1]);
System
.
out
.
println
(
"Pass "
+(
pass
+
1
)+
": resolveDiagonalTriangularConflicts (success/failures) = "
+
diagonal_resoultion_results
[
0
]+
" / "
+
diagonal_resoultion_results
[
1
]);
if (dual_tri_results[0] == 0) break;
if
(
(
dual_tri_results
[
0
]
==
0
)
&&
(
conflict_resoultion_results
[
0
]
==
0
)
&&
(
diagonal_resoultion_results
[
0
]
==
0
))
break
;
}
}
Conflicts
conflicts1_stats
=
new
Conflicts
(
conflicts1_stats = st.getNumConflicts(
conflicts0
,
conflicts0
,
st
,
1
);
// -1); // debugLevel);
1
);
// -1); // debugLevel);
st.printConflictSummary(conflicts1_stats);
*/
/*
conflicts1_stats
.
printConflictSummary
(
"Detected conflicts (all):"
,
true
,
false
,
false
);
// re-checking conflicts (make sure update is correct)
conflicts1_stats
.
printConflictSummary
(
"Detected conflicts (ortho-diag-ortho):"
,
false
,
true
,
false
);
int [][][] conflicts1r = st.detectTriangularConflicts(
conflicts1_stats
.
printConflictSummary
(
"Detected conflicts(ortho-ortho-diag):"
,
false
,
false
,
true
);
1); // final int debugLevel)
int [] conflicts1r_stats = st.getNumConflicts(
conflicts1r,
-1); // debugLevel);
st.printConflictSummary(conflicts1r_stats);
*/
st
.
testResoveTriangle
(
st
.
testResoveTriangle
(
clt_parameters
.
plWorstWorsening
,
// final double worst_worsening,
clt_parameters
.
plWorstWorsening
,
// final double worst_worsening,
...
@@ -3550,8 +3523,6 @@ public class TileProcessor {
...
@@ -3550,8 +3523,6 @@ public class TileProcessor {
clt_parameters
.
tileX
,
clt_parameters
.
tileX
,
clt_parameters
.
tileY
);
clt_parameters
.
tileY
);
if
(
clt_parameters
.
plSplitApply
)
{
if
(
clt_parameters
.
plSplitApply
)
{
while
(
true
)
{
while
(
true
)
{
int
num_added
=
0
;
int
num_added
=
0
;
...
...
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