Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
F
fslpy
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Deploy
Releases
Container Registry
Model registry
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Michiel Cottaar
fslpy
Commits
6009879c
Commit
6009879c
authored
6 years ago
by
Paul McCarthy
Browse files
Options
Downloads
Patches
Plain Diff
RF: Do not try to load files of unsupported type
parent
1ced27eb
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
fsl/wrappers/wrapperutils.py
+16
-7
16 additions, 7 deletions
fsl/wrappers/wrapperutils.py
with
16 additions
and
7 deletions
fsl/wrappers/wrapperutils.py
+
16
−
7
View file @
6009879c
...
...
@@ -624,12 +624,15 @@ class _FileOrThing(object):
log
.
debug
(
'
Loading prefixed output %s [%s]: %s
'
,
prefPat
,
prefName
,
filename
)
fval
=
self
.
__load
(
filename
)
basename
=
self
.
__removeExt
(
basename
)
basename
=
basename
.
replace
(
prefPat
,
prefName
)
result
[
basename
]
=
fval
break
# if the load function returns
# None, this file is probably
# not of the correct type.
fval
=
self
.
__load
(
filename
)
if
fval
is
not
None
:
basename
=
self
.
__removeExt
(
basename
)
basename
=
basename
.
replace
(
prefPat
,
prefName
)
result
[
basename
]
=
fval
break
# if file did not match any pattern,
# move it into the real prefix, where
...
...
@@ -807,6 +810,10 @@ def fileOrImage(*args, **kwargs):
return
op
.
join
(
workdir
,
'
{}.nii.gz
'
.
format
(
name
))
def
load
(
path
):
if
not
fslimage
.
looksLikeImage
(
path
):
return
None
# create an independent in-memory
# copy of the image file
img
=
nib
.
load
(
path
)
...
...
@@ -863,7 +870,9 @@ def fileOrArray(*args, **kwargs):
def
prepOut
(
workdir
,
name
,
val
):
return
op
.
join
(
workdir
,
'
{}.txt
'
.
format
(
name
))
load
=
np
.
loadtxt
def
load
(
path
):
try
:
return
np
.
loadtxt
(
path
)
except
Exception
:
return
None
def
decorator
(
func
):
fot
=
_FileOrThing
(
func
,
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment