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
FSL
fslpy
Commits
7c72afde
Commit
7c72afde
authored
Sep 03, 2019
by
Paul McCarthy
🚵
Browse files
BF: Handle present but empty elements
parent
e3f6c86f
Changes
1
Hide whitespace changes
Inline
Side-by-side
fsl/data/atlases.py
View file @
7c72afde
...
...
@@ -521,28 +521,19 @@ class AtlasDescription(object):
if
self
.
atlasType
==
'statistic'
:
statistic
=
header
.
find
(
'statistic'
)
units
=
header
.
find
(
'units'
)
lower
=
header
.
find
(
'lower'
)
upper
=
header
.
find
(
'upper'
)
precision
=
header
.
find
(
'precision'
)
if
statistic
is
None
:
statistic
=
''
else
:
statistic
=
statistic
.
text
.
strip
()
if
units
is
None
:
units
=
''
else
:
units
=
units
.
text
.
strip
()
if
lower
is
None
:
lower
=
0
else
:
lower
=
float
(
lower
.
text
.
strip
())
if
upper
is
None
:
upper
=
100
else
:
upper
=
float
(
upper
.
text
.
strip
())
if
precision
is
None
:
precision
=
2
else
:
precision
=
float
(
precision
.
text
.
strip
())
self
.
statistic
=
statistic
self
.
units
=
units
self
.
lower
=
lower
self
.
upper
=
upper
self
.
precision
=
precision
fields
=
[
'statistic'
,
'units'
,
'lower'
,
'upper'
,
'precision'
]
values
=
{}
for
field
in
fields
:
elem
=
header
.
find
(
field
)
if
elem
is
not
None
and
elem
.
text
is
not
None
:
values
[
field
]
=
elem
.
text
.
strip
()
self
.
statistic
=
values
.
get
(
'statistic'
,
''
)
self
.
units
=
values
.
get
(
'units'
,
''
)
self
.
lower
=
float
(
values
.
get
(
'lower'
,
0
))
self
.
upper
=
float
(
values
.
get
(
'upper'
,
100
))
self
.
precision
=
int
(
values
.
get
(
'precision'
,
2
))
elif
self
.
atlasType
==
'probabilistic'
:
self
.
statistic
=
''
...
...
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