Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
FSL
fslpy
Commits
a187f9cd
Commit
a187f9cd
authored
May 19, 2022
by
Paul McCarthy
🚵
Browse files
Merge branch 'rf/nifti-xform-template-other' into 'master'
Rf/nifti xform template other See merge request fsl/fslpy!337
parents
5851e4c0
06b64a05
Pipeline
#14292
canceled with stages
in 16 minutes and 39 seconds
Changes
4
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
CHANGELOG.rst
View file @
a187f9cd
...
...
@@ -3,6 +3,18 @@ order.
3.9.2 (Friday 20th May 2022)
----------------------------
Changed
^^^^^^^
* Added the :data:`.NIFTI_XFORM_TEMPLATE_OTHER` identifier, an extension to the
NIfTI standard (!337).
3.9.1 (Friday 13th May 2022)
----------------------------
...
...
fsl/data/constants.py
View file @
a187f9cd
...
...
@@ -30,6 +30,7 @@ specification:
NIFTI_XFORM_ALIGNED_ANAT
NIFTI_XFORM_TALAIRACH
NIFTI_XFORM_MNI_152
NIFTI_XFORM_TEMPLATE_OTHER
"""
...
...
@@ -81,7 +82,14 @@ NIFTI_XFORM_MNI_152 = 4
"""MNI 152 normalized coordinates."""
NIFTI_XFORM_ANALYZE
=
5
NIFTI_XFORM_TEMPLATE_OTHER
=
5
"""Coordinates aligned to some template that is not MNI152 or Talairach.
See https://www.nitrc.org/forum/message.php?msg_id=26394 for details.
"""
NIFTI_XFORM_ANALYZE
=
6
"""Code which indicates that this is an ANALYZE image, not a NIFTI image. """
...
...
fsl/data/image.py
View file @
a187f9cd
...
...
@@ -825,6 +825,7 @@ class Nifti(notifier.Notifier, meta.Meta):
- :data:`~.constants.NIFTI_XFORM_ALIGNED_ANAT`
- :data:`~.constants.NIFTI_XFORM_TALAIRACH`
- :data:`~.constants.NIFTI_XFORM_MNI_152`
- :data:`~.constants.NIFTI_XFORM_TEMPLATE_OTHER`
- :data:`~.constants.NIFTI_XFORM_ANALYZE`
"""
...
...
@@ -852,8 +853,9 @@ class Nifti(notifier.Notifier, meta.Meta):
if
sform_code
!=
constants
.
NIFTI_XFORM_UNKNOWN
:
code
=
sform_code
elif
qform_code
!=
constants
.
NIFTI_XFORM_UNKNOWN
:
code
=
qform_code
# Invalid values
if
code
not
in
range
(
5
):
# Invalid code (the maxmimum NIFTI_XFORM_*
# code value is 5 at present)
if
code
not
in
range
(
6
):
code
=
constants
.
NIFTI_XFORM_UNKNOWN
return
int
(
code
)
...
...
fsl/wrappers/wrapperutils.py
View file @
a187f9cd
...
...
@@ -259,8 +259,9 @@ def applyArgStyle(style=None,
conventions, e.g. ``-a val``, ``--arg=val``, ``-a val1 val2``,
``--arg=val1,val2``.
The ``style`` and ``valsep`` (and ``charstyle`` and ``charsep``) arguments
control how key-value pairs are converted into command-line options:
The ``style`` and ``valsep`` options (and ``charstyle`` and ``charsep``,
for single-character/short arguments) control how key-value pairs are
converted into command-line options:
========= ========== ===========================
...
...
@@ -323,11 +324,15 @@ def applyArgStyle(style=None,
one of ``' '``, ``','`` or ``'"'``. Defaults to ``' '``
if ``'=' not in style``, ``','`` otherwise.
:arg singlechar_args: If ``True``, equivalent to ``charstyle='-'``.
:arg singlechar_args: If ``True``, equivalent to ``charstyle='-'``. This
argument remains for compatibility, but may be
removed in a future version.
:arg kwargs: Arguments to be converted into command-line options.
:returns: A list containing the generated command-line options.
:returns: A sequence containing the generated command-line options, the
same as what ``shlex.split`` would generate for a properly
quoted string.
"""
if
style
is
None
:
...
...
@@ -373,13 +378,7 @@ def applyArgStyle(style=None,
if
style
in
(
'--'
,
'--='
):
return
f
'--
{
arg
}
'
else
:
return
f
'-
{
arg
}
'
# Formt the argument value. Always returns
# a sequence. We don't add quotes around
# values - instead we just ensure that
# arguments+values are grouped correctly in
# the final result (the same as what
# shlex.split would generate for a properly
# quoted string).
# Formt the argument value.
def
fmtval
(
val
,
sep
):
if
isinstance
(
val
,
abc
.
Sequence
)
and
(
not
isinstance
(
val
,
str
)):
val
=
[
str
(
v
)
for
v
in
val
]
...
...
@@ -389,7 +388,7 @@ def applyArgStyle(style=None,
else
:
return
[
str
(
val
)]
#
Format
the argument and value together.
#
Combine
the argument and value together.
# val is assumed to be a sequence.
def
fmtargval
(
arg
,
val
,
style
):
# if '=' in style, val will
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment