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
8f9bed31
Commit
8f9bed31
authored
7 years ago
by
Paul McCarthy
Browse files
Options
Downloads
Patches
Plain Diff
Using nibabel version of axcodes2ornt instead of dcmstack version, as the
latter is buggy. Didn't bother to figure out the bug.
parent
d4ce30ae
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
fsl/data/dcmstack/dcmstack.py
+1
-41
1 addition, 41 deletions
fsl/data/dcmstack/dcmstack.py
with
1 addition
and
41 deletions
fsl/data/dcmstack/dcmstack.py
+
1
−
41
View file @
8f9bed31
...
@@ -12,6 +12,7 @@ from nibabel.nifti1 import Nifti1Extensions
...
@@ -12,6 +12,7 @@ from nibabel.nifti1 import Nifti1Extensions
from
nibabel.spatialimages
import
HeaderDataError
from
nibabel.spatialimages
import
HeaderDataError
from
nibabel.orientations
import
(
io_orientation
,
from
nibabel.orientations
import
(
io_orientation
,
apply_orientation
,
apply_orientation
,
axcodes2ornt
,
inv_ornt_aff
)
inv_ornt_aff
)
import
numpy
as
np
import
numpy
as
np
from
.dcmmeta
import
DcmMetaExtension
,
NiftiWrapper
from
.dcmmeta
import
DcmMetaExtension
,
NiftiWrapper
...
@@ -132,47 +133,6 @@ def ornt_transform(start_ornt, end_ornt):
...
@@ -132,47 +133,6 @@ def ornt_transform(start_ornt, end_ornt):
end_out_idx
)
end_out_idx
)
return
result
return
result
def
axcodes2ornt
(
axcodes
,
labels
=
None
):
"""
Convert axis codes `axcodes` to an orientation
Parameters
----------
axcodes : (N,) tuple
axis codes - see ornt2axcodes docstring
labels : optional, None or sequence of (2,) sequences
(2,) sequences are labels for (beginning, end) of output axis. That
is, if the first element in `axcodes` is ``front``, and the second
(2,) sequence in `labels` is (
'
back
'
,
'
front
'
) then the first
row of `ornt` will be ``[1, 1]``. If None, equivalent to
``((
'
L
'
,
'
R
'
),(
'
P
'
,
'
A
'
),(
'
I
'
,
'
S
'
))`` - that is - RAS axes.
Returns
-------
ornt : (N,2) array-like
oritation array - see io_orientation docstring
Examples
--------
>>>
axcodes2ornt
((
'
F
'
,
'
L
'
,
'
U
'
),
((
'
L
'
,
'
R
'
),(
'
B
'
,
'
F
'
),(
'
D
'
,
'
U
'
)))
[[
1
,
1
],[
0
,
-
1
],[
2
,
1
]]
"""
if
labels
is
None
:
labels
=
zip
(
'
LPI
'
,
'
RAS
'
)
n_axes
=
len
(
axcodes
)
ornt
=
np
.
ones
((
n_axes
,
2
),
dtype
=
np
.
int8
)
*
np
.
nan
for
code_idx
,
code
in
enumerate
(
axcodes
):
for
label_idx
,
codes
in
enumerate
(
labels
):
if
code
is
None
:
continue
if
code
in
codes
:
if
code
==
codes
[
0
]:
ornt
[
code_idx
,
:]
=
[
label_idx
,
-
1
]
else
:
ornt
[
code_idx
,
:]
=
[
label_idx
,
1
]
break
return
ornt
def
reorder_voxels
(
vox_array
,
affine
,
voxel_order
):
def
reorder_voxels
(
vox_array
,
affine
,
voxel_order
):
'''
Reorder the given voxel array and corresponding affine.
'''
Reorder the given voxel array and corresponding 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