Skip to content
Snippets Groups Projects
Commit 4e0acb87 authored by Paul McCarthy's avatar Paul McCarthy :mountain_bicyclist:
Browse files

RF: Minor refactor

parent 552f07d7
No related branches found
No related tags found
No related merge requests found
#!/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
"""
...@@ -32,10 +32,10 @@ def resampleToPixdims(image, newPixdims, **kwargs): ...@@ -32,10 +32,10 @@ def resampleToPixdims(image, newPixdims, **kwargs):
:arg image: :class:`.Image` to resample :arg image: :class:`.Image` to resample
:arg pixdims: New voxel dimensions to resample ``image`` to. :arg pixdims: New voxel dimensions to resample ``image`` to.
""" """
oldShape = image.shape newPixdims = np.array(newPixdims)
oldPixdims = image.pixdim oldShape = np.array(image.shape)
fac = [o / float(n) for o, n in zip(oldPixdims, newPixdims)] oldPixdims = np.array(image.pixdim)
newShape = [p * f for p, f in zip(oldShape, fac)] newShape = oldShape * (oldPixdims / newPixdims)
return resample(image, newShape, **kwargs) return resample(image, newShape, **kwargs)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment