Skip to content
Snippets Groups Projects
Commit c0448faa authored by Paul McCarthy's avatar Paul McCarthy :mountain_bicyclist:
Browse files

Merge branch 'mnt/warnings' into 'main'

MNT: Remove some obsolete warning suppression logic, and suppress nibabel warning when converting to NIFTI2

See merge request fsl/fslpy!406
parents 27c42060 f0abbcdc
No related branches found
No related tags found
No related merge requests found
Pipeline #19977 canceled
...@@ -26,6 +26,15 @@ Changed ...@@ -26,6 +26,15 @@ Changed
(!405). (!405).
Fixed
^^^^^
* Updated the ```immv``/``imcp`` scripts to honour the ``$FSLOUTPUTTYPE``
environment variable more closely - conversions between NIFTI1 and
NIFTI2 were not being performed correctly (!405).
3.13.3 (Monday 17th July 2023) 3.13.3 (Monday 17th July 2023)
------------------------------ ------------------------------
......
...@@ -19,20 +19,9 @@ import warnings ...@@ -19,20 +19,9 @@ import warnings
import logging import logging
import numpy as np import numpy as np
# if h5py <= 2.7.1 is installed, import fsl.data.image as fslimage
# it will be imported via nibabel, import fsl.data.atlases as fslatlases
# and will cause a numpy warning import fsl.version as fslversion
# to be emitted.
with warnings.catch_warnings():
warnings.filterwarnings("ignore", category=FutureWarning)
import fsl.data.image as fslimage
# If wx is not present, then fsl.utils.platform
# will complain that it is not present.
logging.getLogger('fsl.utils.platform').setLevel(logging.ERROR)
import fsl.data.atlases as fslatlases # noqa
import fsl.version as fslversion # noqa
log = logging.getLogger(__name__) log = logging.getLogger(__name__)
......
...@@ -16,12 +16,8 @@ import warnings ...@@ -16,12 +16,8 @@ import warnings
import numpy as np import numpy as np
# See atlasq.py for explanation import fsl.data.fixlabels as fixlabels
with warnings.catch_warnings(): import fsl.data.melodicanalysis as melanalysis
warnings.filterwarnings("ignore", category=FutureWarning)
import fsl.data.fixlabels as fixlabels
import fsl.data.melodicanalysis as melanalysis
DTYPE = np.float64 DTYPE = np.float64
......
...@@ -14,15 +14,11 @@ The :func:`main` function is essentially a wrapper around the ...@@ -14,15 +14,11 @@ The :func:`main` function is essentially a wrapper around the
import os.path as op import os.path as op
import sys import sys
import warnings import logging
import fsl.utils.path as fslpath import fsl.utils.path as fslpath
import fsl.utils.imcp as imcp
# See atlasq.py for explanation import fsl.data.image as fslimage
with warnings.catch_warnings():
warnings.filterwarnings("ignore", category=FutureWarning)
import fsl.utils.imcp as imcp
import fsl.data.image as fslimage
usage = """Usage: usage = """Usage:
...@@ -57,6 +53,11 @@ def main(argv=None): ...@@ -57,6 +53,11 @@ def main(argv=None):
print(usage) print(usage)
return 1 return 1
# When converting to NIFTI2, nibabel
# emits an annoying message via log.warning:
# sizeof_hdr should be 540; set sizeof_hdr to 540
logging.getLogger('nibabel').setLevel(logging.ERROR)
try: try:
srcs = [fslimage.fixExt(s) for s in srcs] srcs = [fslimage.fixExt(s) for s in srcs]
srcs = fslpath.removeDuplicates( srcs = fslpath.removeDuplicates(
......
...@@ -15,15 +15,11 @@ The :func:`main` function is essentially a wrapper around the ...@@ -15,15 +15,11 @@ The :func:`main` function is essentially a wrapper around the
import os.path as op import os.path as op
import sys import sys
import warnings import logging
import fsl.utils.path as fslpath import fsl.utils.path as fslpath
import fsl.utils.imcp as imcp
# See atlasq.py for explanation import fsl.data.image as fslimage
with warnings.catch_warnings():
warnings.filterwarnings("ignore", category=FutureWarning)
import fsl.utils.imcp as imcp
import fsl.data.image as fslimage
usage = """Usage: usage = """Usage:
...@@ -58,6 +54,11 @@ def main(argv=None): ...@@ -58,6 +54,11 @@ def main(argv=None):
print(usage) print(usage)
return 1 return 1
# When converting to NIFTI2, nibabel
# emits an annoying message via log.warning:
# sizeof_hdr should be 540; set sizeof_hdr to 540
logging.getLogger('nibabel').setLevel(logging.ERROR)
try: try:
srcs = [fslimage.fixExt(s) for s in srcs] srcs = [fslimage.fixExt(s) for s in srcs]
srcs = fslpath.removeDuplicates( srcs = fslpath.removeDuplicates(
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment