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
f9200840
Commit
f9200840
authored
7 years ago
by
Paul McCarthy
Browse files
Options
Downloads
Patches
Plain Diff
Compose function accepts either three axis-angles, or a rotation matrix.
parent
de27baf0
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
fsl/utils/transform.py
+10
-2
10 additions, 2 deletions
fsl/utils/transform.py
with
10 additions
and
2 deletions
fsl/utils/transform.py
+
10
−
2
View file @
f9200840
...
@@ -92,7 +92,8 @@ def compose(scales, offsets, rotations, origin=None):
...
@@ -92,7 +92,8 @@ def compose(scales, offsets, rotations, origin=None):
:arg offsets: Sequence of three offset values.
:arg offsets: Sequence of three offset values.
:arg rotations: Sequence of three rotation values, in radians.
:arg rotations: Sequence of three rotation values, in radians, or
a rotation matrix of shape ``(3, 3)``.
:arg origin: Origin of rotation - must be scaled by the ``scales``.
:arg origin: Origin of rotation - must be scaled by the ``scales``.
If not provided, the rotation origin is ``(0, 0, 0)``.
If not provided, the rotation origin is ``(0, 0, 0)``.
...
@@ -100,6 +101,12 @@ def compose(scales, offsets, rotations, origin=None):
...
@@ -100,6 +101,12 @@ def compose(scales, offsets, rotations, origin=None):
preRotate
=
np
.
eye
(
4
)
preRotate
=
np
.
eye
(
4
)
postRotate
=
np
.
eye
(
4
)
postRotate
=
np
.
eye
(
4
)
rotations
=
np
.
array
(
rotations
)
if
rotations
.
shape
==
(
3
,):
rotations
=
axisAnglesToRotMat
(
*
rotations
)
if
origin
is
not
None
:
if
origin
is
not
None
:
preRotate
[
0
,
3
]
=
-
origin
[
0
]
preRotate
[
0
,
3
]
=
-
origin
[
0
]
preRotate
[
1
,
3
]
=
-
origin
[
1
]
preRotate
[
1
,
3
]
=
-
origin
[
1
]
...
@@ -118,7 +125,8 @@ def compose(scales, offsets, rotations, origin=None):
...
@@ -118,7 +125,8 @@ def compose(scales, offsets, rotations, origin=None):
offset
[
0
,
3
]
=
offsets
[
0
]
offset
[
0
,
3
]
=
offsets
[
0
]
offset
[
1
,
3
]
=
offsets
[
1
]
offset
[
1
,
3
]
=
offsets
[
1
]
offset
[
2
,
3
]
=
offsets
[
2
]
offset
[
2
,
3
]
=
offsets
[
2
]
rotate
[:
3
,
:
3
]
=
axisAnglesToRotMat
(
*
rotations
)
rotate
[:
3
,
:
3
]
=
rotations
return
concat
(
offset
,
postRotate
,
rotate
,
preRotate
,
scale
)
return
concat
(
offset
,
postRotate
,
rotate
,
preRotate
,
scale
)
...
...
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