Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
ttk
spam
Commits
dc5bde15
Commit
dc5bde15
authored
Nov 10, 2020
by
Edward Andò
Browse files
resolves
#192
by checking for non-existent labels in the bounding box computation
parent
e04f9069
Pipeline
#52493
passed with stages
in 24 minutes and 14 seconds
Changes
1
Pipelines
3
Hide whitespace changes
Inline
Side-by-side
scripts/spam-ereg-discrete
View file @
dc5bde15
...
...
@@ -83,9 +83,15 @@ class MainWindow(QWidget):
self
.
Phi
=
numpy
.
eye
(
4
)
self
.
mainWindowGrid
=
QGridLayout
(
self
)
self
.
nonConvergedGrains
=
numpy
.
where
(
DDIC
[
'returnStatus'
]
<
args
.
RETURN_STAT_THRESHOLD
)[
0
][
1
:]
# Issue #192 will be fixed here, by making sure the loew return stat list also has real boundin boxes
# (i.e., grains are really defined)
nonConvergedGrains
=
DDIC
[
'returnStatus'
]
<
args
.
RETURN_STAT_THRESHOLD
presentGrains
=
REFlabBB
[:,
1
]
>
REFlabBB
[:,
0
]
print
(
numpy
.
where
(
nonConvergedGrains
),
presentGrains
)
self
.
nonConvergedGrains
=
numpy
.
where
(
numpy
.
logical_and
(
nonConvergedGrains
,
presentGrains
))[
0
][
0
:]
self
.
N
=
0
# Number of the current nonConvergedGrain that's being studied
print
(
"Going to work on these labels:
\n
"
,
self
.
nonConvergedGrains
)
print
(
"Going to work on these labels:
\n
"
,
self
.
nonConvergedGrains
,
"(p.s. I removed non-existent labels:"
,
numpy
.
where
(
~
presentGrains
)[
0
][
1
:],
" )"
)
if
len
(
self
.
nonConvergedGrains
)
>
0
:
self
.
alignOneLabel
()
self
.
labAndPhi
=
[]
...
...
@@ -113,7 +119,7 @@ class MainWindow(QWidget):
labelDilate
=
args
.
LABEL_DILATE
,
margin
=
args
.
margin
,
maskOtherLabels
=
args
.
MASK
)
if
RE
G
gl
is
not
None
:
if
RE
F
gl
is
not
None
:
# 2020-10-23: EA on Issue #186: using spam.helpers.slicePadded
REFsubvol
=
spam
.
helpers
.
slicePadded
(
REFgrey
,
REFgl
[
'boundingBox'
]
+
numpy
.
array
([
0
,
1
,
0
,
1
,
0
,
1
]))
...
...
@@ -136,18 +142,21 @@ class MainWindow(QWidget):
self
.
nextLabelButton
.
clicked
.
connect
(
self
.
nextLabel
)
self
.
mainWindowGrid
.
addWidget
(
self
.
nextLabelButton
,
2
,
1
)
else
:
nextLabel
()
def
nextLabel
(
self
):
#print("Phi:", self.eregWidget.output())
self
.
eregWidget
.
close
()
# Get Phi output from graphical
PhiTmp
=
self
.
eregWidget
.
output
()
# Add back in int displacement
PhiTmp
[
0
:
3
,
-
1
]
+=
self
.
diplacementInt
# nonConvergedGrain label number, eye-Phi
self
.
labAndPhi
.
append
([
self
.
nonConvergedGrains
[
self
.
N
],
PhiTmp
])
self
.
nextLabel
(
widgetOpen
=
False
)
def
nextLabel
(
self
,
widgetOpen
=
True
):
if
widgetOpen
:
self
.
eregWidget
.
close
()
# Get Phi output from graphical
PhiTmp
=
self
.
eregWidget
.
output
()
# Add back in int displacement
PhiTmp
[
0
:
3
,
-
1
]
+=
self
.
diplacementInt
# nonConvergedGrain label number, eye-Phi
self
.
labAndPhi
.
append
([
self
.
nonConvergedGrains
[
self
.
N
],
PhiTmp
])
else
:
# This grain was skipped, let's add nothing in its place
self
.
labAndPhi
.
append
([
self
.
nonConvergedGrains
[
self
.
N
],
numpy
.
eye
(
4
)])
# Move onto next grain, otherwise write and quit
self
.
N
+=
1
...
...
Write
Preview
Supports
Markdown
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