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
4e0acb87
Commit
4e0acb87
authored
5 years ago
by
Paul McCarthy
Browse files
Options
Downloads
Patches
Plain Diff
RF: Minor refactor
parent
552f07d7
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
fsl/utils/image/__init__.py
+16
-0
16 additions, 0 deletions
fsl/utils/image/__init__.py
fsl/utils/image/resample.py
+4
-4
4 additions, 4 deletions
fsl/utils/image/resample.py
with
20 additions
and
4 deletions
fsl/utils/image/__init__.py
+
16
−
0
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
"""
This diff is collapsed.
Click to expand it.
fsl/utils/image/resample.py
+
4
−
4
View file @
4e0acb87
...
@@ -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
)
old
Pixdims
=
image
.
pixdim
old
Shape
=
np
.
array
(
image
.
shape
)
fac
=
[
o
/
float
(
n
)
for
o
,
n
in
zip
(
oldPixdims
,
newP
ixdim
s
)]
oldPixdims
=
np
.
array
(
image
.
p
ixdim
)
newShape
=
[
p
*
f
for
p
,
f
in
zip
(
oldShape
,
fac
)]
newShape
=
oldShape
*
(
oldPixdims
/
newPixdims
)
return
resample
(
image
,
newShape
,
**
kwargs
)
return
resample
(
image
,
newShape
,
**
kwargs
)
...
...
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