Commit 4e0acb87 authored by Paul McCarthy's avatar Paul McCarthy 🚵
Browse files

RF: Minor refactor

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