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
4e0acb87
Commit
4e0acb87
authored
May 03, 2019
by
Paul McCarthy
🚵
Browse files
RF: Minor refactor
parent
552f07d7
Changes
2
Hide whitespace changes
Inline
Side-by-side
fsl/utils/image/__init__.py
View file @
4e0acb87
#!/usr/bin/env python
#
# __init__.py - The fsl.utils.image package
#
# Author: Paul McCarthy <pauldmccarthy@gmail.com>
#
"""The :mod:`fsl.utils.image` oackage contains algorithms and utilities for
manipulating and working with :class:`.Image` objects.
The following modules are available:
.. autosumary::
:nosignature
.image.resample
"""
fsl/utils/image/resample.py
View file @
4e0acb87
...
...
@@ -32,10 +32,10 @@ def resampleToPixdims(image, newPixdims, **kwargs):
:arg image: :class:`.Image` to resample
:arg pixdims: New voxel dimensions to resample ``image`` to.
"""
oldShape
=
image
.
shape
old
Pixdims
=
image
.
pixdim
fac
=
[
o
/
float
(
n
)
for
o
,
n
in
zip
(
oldPixdims
,
newP
ixdim
s
)]
newShape
=
[
p
*
f
for
p
,
f
in
zip
(
oldShape
,
fac
)]
newPixdims
=
np
.
array
(
newPixdims
)
old
Shape
=
np
.
array
(
image
.
shape
)
oldPixdims
=
np
.
array
(
image
.
p
ixdim
)
newShape
=
oldShape
*
(
oldPixdims
/
newPixdims
)
return
resample
(
image
,
newShape
,
**
kwargs
)
...
...
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