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
Istvan N. Huszar, MD
tirl
Commits
8c09117a
Commit
8c09117a
authored
Aug 14, 2020
by
inhuszar
Browse files
Bugfix: mask combination if both masks are specified.
parent
bc50fbfb
Changes
1
Hide whitespace changes
Inline
Side-by-side
src/tirl/costs/cost.py
View file @
8c09117a
...
...
@@ -455,15 +455,21 @@ class Cost(TIRLObject):
if
not
sm
and
not
tm
:
return
None
# Return target mask if source mask is not defined
elif
tm
:
elif
tm
and
not
sm
:
return
target_mask
# Return source mask if target mask is not defined
elif
sm
:
elif
sm
and
not
tm
:
return
source_mask
# Create composite mask if both masks are defined
else
:
mm
=
self
.
metaparameters
.
get
(
"maskmode"
)
# Enforce the "and" match mode if need to mask missing data. With
# the "or" method, the mask values may end up 0.5 instead of 0.
if
ts
.
TIMAGE_MASK_MISSING_DATA
:
mm
=
"and"
else
:
mm
=
self
.
metaparameters
.
get
(
"maskmode"
)
if
mm
==
"and"
:
# Negative values are impossible, hence NaNs are not expected.
return
(
source_mask
*
target_mask
)
**
0.5
...
...
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