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
Package registry
Model registry
Operate
Environments
Terraform modules
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
Evan Edmond
fslpy
Commits
d6dd21d0
Commit
d6dd21d0
authored
8 years ago
by
Paul McCarthy
Browse files
Options
Downloads
Patches
Plain Diff
Image.axisMapping is memoized (and corresponding bug-fix to memoizeMD5).
parent
e6158d86
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/data/image.py
+6
-1
6 additions, 1 deletion
fsl/data/image.py
fsl/utils/memoize.py
+1
-1
1 addition, 1 deletion
fsl/utils/memoize.py
with
7 additions
and
2 deletions
fsl/data/image.py
+
6
−
1
View file @
d6dd21d0
...
@@ -40,6 +40,7 @@ import numpy as np
...
@@ -40,6 +40,7 @@ import numpy as np
import
fsl.utils.transform
as
transform
import
fsl.utils.transform
as
transform
import
fsl.utils.notifier
as
notifier
import
fsl.utils.notifier
as
notifier
import
fsl.utils.memoize
as
memoize
import
fsl.utils.path
as
fslpath
import
fsl.utils.path
as
fslpath
import
fsl.data.constants
as
constants
import
fsl.data.constants
as
constants
import
fsl.data.imagewrapper
as
imagewrapper
import
fsl.data.imagewrapper
as
imagewrapper
...
@@ -209,7 +210,11 @@ class Nifti1(object):
...
@@ -209,7 +210,11 @@ class Nifti1(object):
return
int
(
code
)
return
int
(
code
)
# TODO Check what has worse performance - hashing
# a 4x4 array (via memoizeMD5), or the call
# to aff2axcodes. I'm guessing the latter,
# but am not 100% sure.
@memoize.memoizeMD5
def
axisMapping
(
self
,
xform
):
def
axisMapping
(
self
,
xform
):
"""
Returns the (approximate) correspondence of each axis in the source
"""
Returns the (approximate) correspondence of each axis in the source
coordinate system to the axes in the destination coordinate system,
coordinate system to the axes in the destination coordinate system,
...
...
This diff is collapsed.
Click to expand it.
fsl/utils/memoize.py
+
1
−
1
View file @
d6dd21d0
...
@@ -100,7 +100,7 @@ def memoizeMD5(func):
...
@@ -100,7 +100,7 @@ def memoizeMD5(func):
hashobj
=
hashlib
.
md5
()
hashobj
=
hashlib
.
md5
()
for
arg
in
args
:
for
arg
in
args
:
arg
=
six
.
u
(
arg
).
encode
(
'
utf-8
'
)
arg
=
six
.
u
(
str
(
arg
)
)
.
encode
(
'
utf-8
'
)
hashobj
.
update
(
arg
)
hashobj
.
update
(
arg
)
digest
=
hashobj
.
hexdigest
()
digest
=
hashobj
.
hexdigest
()
...
...
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