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
d635bdae
Commit
d635bdae
authored
7 years ago
by
Paul McCarthy
Browse files
Options
Downloads
Patches
Plain Diff
If an xform and header are provided, make sure they are consistent.
parent
7b9768fa
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
fsl/data/image.py
+14
-1
14 additions, 1 deletion
fsl/data/image.py
with
14 additions
and
1 deletion
fsl/data/image.py
+
14
−
1
View file @
d635bdae
...
@@ -753,7 +753,9 @@ class Image(Nifti):
...
@@ -753,7 +753,9 @@ class Image(Nifti):
coordinates. If not provided, and a ``header`` is
coordinates. If not provided, and a ``header`` is
provided, the transformation in the header is used.
provided, the transformation in the header is used.
If neither a ``xform`` nor a ``header`` are provided,
If neither a ``xform`` nor a ``header`` are provided,
an identity matrix is used.
an identity matrix is used. If both a ``xform`` and a
``header`` are provided, the ``xform`` is used in
preference to the header transformation.
:arg loadData: If ``True`` (the default) the image data is loaded
:arg loadData: If ``True`` (the default) the image data is loaded
in to memory. Otherwise, only the image header
in to memory. Otherwise, only the image header
...
@@ -799,6 +801,17 @@ class Image(Nifti):
...
@@ -799,6 +801,17 @@ class Image(Nifti):
if
header
is
not
None
:
if
header
is
not
None
:
header
=
header
.
copy
()
header
=
header
.
copy
()
# if a header and xform are provided,
# make sure the xform gets used. Does
# not apply to ANALYZE images,
if
header
is
not
None
and
\
xform
is
not
None
and
\
isinstance
(
header
,
nib
.
nifti1
.
Nifti1Header
):
sform
=
int
(
header
.
get_sform
(
True
)[
1
])
qform
=
int
(
header
.
get_qform
(
True
)[
1
])
header
.
set_sform
(
xform
,
code
=
sform
)
header
.
set_qform
(
xform
,
code
=
qform
)
# The image parameter may be the name of an image file
# The image parameter may be the name of an image file
if
isinstance
(
image
,
six
.
string_types
):
if
isinstance
(
image
,
six
.
string_types
):
...
...
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