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
30a248dc
Commit
30a248dc
authored
5 years ago
by
Paul McCarthy
Browse files
Options
Downloads
Patches
Plain Diff
RF: Include identity transforms in image affines. Basic flirt matrix
read/write routines
parent
dbaa3029
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
+3
-0
3 additions, 0 deletions
fsl/data/image.py
fsl/utils/transform/flirt.py
+12
-0
12 additions, 0 deletions
fsl/utils/transform/flirt.py
with
15 additions
and
0 deletions
fsl/data/image.py
+
3
−
0
View file @
30a248dc
...
...
@@ -376,6 +376,9 @@ class Nifti(notifier.Notifier, meta.Meta):
[
x
,
0
,
0
])
voxToScaledVoxMat
=
transform
.
concat
(
flip
,
voxToScaledVoxMat
)
affines
[
'
fsl
'
,
'
fsl
'
]
=
np
.
eye
(
4
)
affines
[
'
voxel
'
,
'
voxel
'
]
=
np
.
eye
(
4
)
affines
[
'
world
'
,
'
world
'
]
=
np
.
eye
(
4
)
affines
[
'
voxel
'
,
'
world
'
]
=
voxToWorldMat
affines
[
'
world
'
,
'
voxel
'
]
=
transform
.
invert
(
voxToWorldMat
)
affines
[
'
voxel
'
,
'
fsl
'
]
=
voxToScaledVoxMat
...
...
This diff is collapsed.
Click to expand it.
fsl/utils/transform/flirt.py
+
12
−
0
View file @
30a248dc
...
...
@@ -17,9 +17,21 @@ matrices. The following functions are available:
"""
import
numpy
as
np
from
.affine
import
concat
def
readFlirt
(
fname
):
"""
Reads a FLIRT matrix from a file.
"""
return
np
.
loadtxt
(
fname
)
def
writeFlirt
(
xform
,
fname
):
"""
Writes the given FLIRT matrix to a file.
"""
np
.
savetxt
(
fname
,
xform
,
fmt
=
'
%1.15g
'
)
def
fromFlirt
(
xform
,
src
,
ref
,
from_
=
'
voxel
'
,
to
=
'
world
'
):
"""
Convert a FLIRT affine matrix into another affine.
...
...
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