Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
F
fslpy
Manage
Activity
Members
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Operate
Environments
Analyze
Contributor analytics
CI/CD 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
FSL
fslpy
Commits
b9185892
Commit
b9185892
authored
6 years ago
by
Paul McCarthy
Browse files
Options
Downloads
Patches
Plain Diff
BF: Fix various issues in Image.save method.
parent
4e63aac4
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
fsl/data/image.py
+4
-4
4 additions, 4 deletions
fsl/data/image.py
with
4 additions
and
4 deletions
fsl/data/image.py
+
4
−
4
View file @
b9185892
...
...
@@ -34,7 +34,6 @@ and file names:
import
os
import
os.path
as
op
import
shutil
import
string
import
logging
import
tempfile
...
...
@@ -1106,6 +1105,8 @@ class Image(Nifti):
if ``filename`` is ``None``.
"""
import
fsl.utils.imcp
as
imcp
if
self
.
__dataSource
is
None
and
filename
is
None
:
raise
ValueError
(
'
A file name must be specified
'
)
...
...
@@ -1124,7 +1125,7 @@ class Image(Nifti):
# then close the old image, move the
# temp file to the real destination,
# then re-open the file.
tmphd
,
tmpfname
=
tempfile
.
mkstemp
(
suffix
=
op
.
splite
xt
(
filename
)
[
1
]
)
tmphd
,
tmpfname
=
tempfile
.
mkstemp
(
suffix
=
getE
xt
(
filename
))
os
.
close
(
tmphd
)
try
:
...
...
@@ -1136,14 +1137,13 @@ class Image(Nifti):
self
.
__nibImage
=
None
self
.
header
=
None
shutil
.
copy
(
tmpfname
,
filename
)
imcp
.
imcp
(
tmpfname
,
filename
,
overwrite
=
True
)
self
.
__nibImage
=
nib
.
load
(
filename
)
self
.
header
=
self
.
__nibImage
.
header
finally
:
os
.
remove
(
tmpfname
)
raise
# Because we've created a new nibabel image,
# we have to create a new ImageWrapper
...
...
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