Skip to content
Snippets Groups Projects

Compare revisions

Changes are shown as if the source revision was being merged into the target revision. Learn more about comparing revisions.

Source

Select target project
No results found

Target

Select target project
  • paulmc/fslpy
  • ndcn0236/fslpy
  • seanf/fslpy
3 results
Show changes
Showing
with 558 additions and 85 deletions
...@@ -10,8 +10,8 @@ Freesurfer ``mgh``/``mgz`` image files. ...@@ -10,8 +10,8 @@ Freesurfer ``mgh``/``mgz`` image files.
import os.path as op import os.path as op
import pathlib
import six
import numpy as np import numpy as np
import nibabel as nib import nibabel as nib
...@@ -47,7 +47,7 @@ class MGHImage(fslimage.Image): ...@@ -47,7 +47,7 @@ class MGHImage(fslimage.Image):
All other arguments are passed through to :meth:`Image.__init__` All other arguments are passed through to :meth:`Image.__init__`
""" """
if isinstance(image, six.string_types): if isinstance(image, (str, pathlib.Path)):
filename = op.abspath(image) filename = op.abspath(image)
name = op.basename(filename) name = op.basename(filename)
image = nib.load(image) image = nib.load(image)
......
...@@ -11,9 +11,14 @@ ...@@ -11,9 +11,14 @@
looksLikeVestLutFile looksLikeVestLutFile
loadVestLutFile loadVestLutFile
loadVestFile
generateVest
""" """
import textwrap as tw
import io
import numpy as np import numpy as np
...@@ -76,3 +81,70 @@ def loadVestLutFile(path, normalise=True): ...@@ -76,3 +81,70 @@ def loadVestLutFile(path, normalise=True):
else: else:
return colours return colours
def loadVestFile(path, ignoreHeader=True):
"""Loads numeric data from a VEST file, returning it as a ``numpy`` array.
:arg ignoreHeader: if ``True`` (the default), the matrix shape specified
in the VEST header information is ignored, and the shape
inferred from the data. Otherwise, if the number of
rows/columns specified in the VEST header information
does not match the matrix shape, a ``ValueError`` is
raised.
:returns: a ``numpy`` array containing the matrix data in the
VEST file.
"""
data = np.loadtxt(path, comments=['#', '/'])
if not ignoreHeader:
nrows, ncols = None, None
with open(path, 'rt') as f:
for line in f:
if 'NumWaves' in line: ncols = int(line.split()[1])
elif 'NumPoints' in line: nrows = int(line.split()[1])
else: continue
if (ncols is not None) and (nrows is not None):
break
if tuple(data.shape) != (nrows, ncols):
raise ValueError(f'Invalid VEST file ({path}) - data shape '
f'({data.shape}) does not match header '
f'({nrows}, {ncols})')
return data
def generateVest(data):
"""Generates VEST-formatted text for the given ``numpy`` array.
:arg data: A 1D or 2D numpy array.
:returns: A string containing a VEST header, and the ``data``.
"""
data = np.asanyarray(data)
if len(data.shape) not in (1, 2):
raise ValueError(f'unsupported number of dimensions: {data.shape}')
data = np.atleast_2d(data)
if np.issubdtype(data.dtype, np.integer): fmt = '%d'
else: fmt = '%0.12f'
sdata = io.StringIO()
np.savetxt(sdata, data, fmt=fmt)
sdata = sdata.getvalue()
nrows, ncols = data.shape
vest = tw.dedent(f"""
/NumWaves {ncols}
/NumPoints {nrows}
/Matrix
""").strip() + '\n' + sdata
return vest.strip()
#!/usr/bin/env python
#
# Text2Vest.py - Convert an ASCII text matrix file into a VEST file.
#
# Author: Paul McCarthy <pauldmccarthy@gmail.com>
#
"""``Text2Vest`` simply takes a plain text ASCII text matrix file, and
adds a VEST header.
"""
import sys
import numpy as np
import fsl.data.vest as fslvest
usage = "Usage: Text2Vest <text_file> <vest_file>"
def main(argv=None):
"""Convert a plain text file to a VEST file. """
if argv is None:
argv = sys.argv[1:]
if len(argv) != 2:
print(usage)
return 0
infile, outfile = argv
data = np.loadtxt(infile, ndmin=2)
vest = fslvest.generateVest(data)
with open(outfile, 'wt') as f:
f.write(vest)
return 0
if __name__ == '__main__':
sys.exit(main())
#!/usr/bin/env python
#
# Vest2Text.py - Convert a VEST matrix file into a plain text ASCII file.
#
# Author: Paul McCarthy <pauldmccarthy@gmail.com>
#
"""``Vest2Text`` takes a VEST file containing a 2D matrix, and converts it
into a plain-text ASCII file.
"""
import sys
import numpy as np
import fsl.data.vest as fslvest
usage = "Usage: Vest2Text <vest_file> <text_file>"
def main(argv=None):
"""Convert a VEST file to a plain text file. """
if argv is None:
argv = sys.argv[1:]
if len(argv) != 2:
print(usage)
return 0
infile, outfile = argv
data = fslvest.loadVestFile(infile)
if np.issubdtype(data.dtype, np.integer): fmt = '%d'
else: fmt = '%0.12f'
np.savetxt(outfile, data, fmt=fmt)
return 0
if __name__ == '__main__':
sys.exit(main())
#!/usr/bin/env python
#
# __init__.py - The fsl.scripts package.
#
# Author: Paul McCarthy <pauldmccarthy@gmail.com>
#
"""The ``fsl.scripts`` package contains all of the executable scripts provided
by ``fslpy``.
"""
...@@ -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__)
...@@ -569,10 +558,10 @@ def parseArgs(args): ...@@ -569,10 +558,10 @@ def parseArgs(args):
usages = { usages = {
'main' : 'usage: atlasq [-h] command [options]', 'main' : 'usage: atlasq [-h] command [options]',
'ohi' : textwrap.dedent(""" 'ohi' : textwrap.dedent("""
usage: atlasq ohi -h usage: atlasquery -h
atlasq ohi --dumpatlases atlasquery --dumpatlases
atlasq ohi -a atlas -c X,Y,Z atlasquery -a atlas -c X,Y,Z
atlasq ohi -a atlas -m mask atlasquery -a atlas -m mask
""").strip(), """).strip(),
'list' : 'usage: atlasq list [-e]', 'list' : 'usage: atlasq list [-e]',
'summary' : 'usage: atlasq summary atlas', 'summary' : 'usage: atlasq summary atlas',
......
#!/usr/bin/env python
#
# fsl_abspath.py - Make a path absolute
#
# Author: Paul McCarthy <pauldmccarthy@gmail.com>
#
"""The fsl_abspath command - makes relative paths absolute.
"""
import os.path as op
import sys
usage = """
usage: fsl_abspath path
""".strip()
def main(argv=None):
"""fsl_abspath - make a relative path absolute. """
if argv is None:
argv = sys.argv[1:]
if len(argv) != 1:
print(usage)
return 1
print(op.realpath(argv[0]))
return 0
if __name__ == '__main__':
sys.exit(main())
...@@ -55,7 +55,7 @@ def parseArgs(args): ...@@ -55,7 +55,7 @@ def parseArgs(args):
choices=('nearest', 'linear', 'cubic'), choices=('nearest', 'linear', 'cubic'),
default='linear'), default='linear'),
'ref' : dict(help=helps['ref'], 'ref' : dict(help=helps['ref'],
type=ft.partial(parse_data.Image, loadData=False)), type=parse_data.Image),
} }
parser.add_argument(*flags['input'], **opts['input']) parser.add_argument(*flags['input'], **opts['input'])
......
...@@ -56,7 +56,7 @@ def parseArgs(args): ...@@ -56,7 +56,7 @@ def parseArgs(args):
subparsers = parser.add_subparsers(dest='ctype') subparsers = parser.add_subparsers(dest='ctype')
flirt = subparsers.add_parser('flirt', epilog=epilog) flirt = subparsers.add_parser('flirt', epilog=epilog)
fnirt = subparsers.add_parser('fnirt', epilog=epilog) fnirt = subparsers.add_parser('fnirt', epilog=epilog)
imgtype = ft.partial(parse_data.Image, loadData=False) imgtype = parse_data.Image
flirt.add_argument('input', help=helps['input']) flirt.add_argument('input', help=helps['input'])
flirt.add_argument('output', help=helps['output']) flirt.add_argument('output', help=helps['output'])
......
...@@ -9,8 +9,6 @@ time series from a MELODIC ``.ica`` directory. ...@@ -9,8 +9,6 @@ time series from a MELODIC ``.ica`` directory.
""" """
from __future__ import print_function
import os.path as op import os.path as op
import sys import sys
import argparse import argparse
...@@ -18,12 +16,8 @@ import warnings ...@@ -18,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
......
...@@ -12,19 +12,13 @@ The :func:`main` function is essentially a wrapper around the ...@@ -12,19 +12,13 @@ The :func:`main` function is essentially a wrapper around the
""" """
from __future__ import print_function
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:
...@@ -59,6 +53,11 @@ def main(argv=None): ...@@ -59,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(
......
...@@ -9,17 +9,11 @@ NIFTI/ANALYZE image files. ...@@ -9,17 +9,11 @@ NIFTI/ANALYZE image files.
""" """
from __future__ import print_function import itertools as it
import glob
import sys import sys
import warnings
import fsl.utils.path as fslpath import fsl.utils.path as fslpath
# See atlasq.py for explanation
with warnings.catch_warnings():
warnings.filterwarnings("ignore", category=FutureWarning)
import fsl.data.image as fslimage
usage = """ usage = """
Usage: imglob [-extension/extensions] <list of names> Usage: imglob [-extension/extensions] <list of names>
...@@ -27,8 +21,17 @@ Usage: imglob [-extension/extensions] <list of names> ...@@ -27,8 +21,17 @@ Usage: imglob [-extension/extensions] <list of names>
-extensions for image list with full extensions -extensions for image list with full extensions
""".strip() """.strip()
exts = fslimage.ALLOWED_EXTENSIONS
groups = fslimage.FILE_GROUPS # The lists below are defined in the
# fsl.data.image class, but are duplicated
# here for performance (to avoid import of
# nibabel/numpy/etc).
exts = ['.nii.gz', '.nii', '.img', '.hdr', '.img.gz', '.hdr.gz']
"""List of supported image file extensions. """
groups = [('.hdr', '.img'), ('.hdr.gz', '.img.gz')]
"""List of known image file groups (image/header file pairs). """
def imglob(paths, output=None): def imglob(paths, output=None):
...@@ -61,12 +64,38 @@ def imglob(paths, output=None): ...@@ -61,12 +64,38 @@ def imglob(paths, output=None):
imgfiles = [] imgfiles = []
# Expand any wildcard paths if provided.
# Depending on the way that imglob is
# invoked, this may not get done by the
# calling shell.
#
# We also have to handle incomplete
# wildcards, e.g. if the user provides
# "img_??", we need to add possible
# file suffixes before it can be
# expanded.
expanded = []
for path in paths:
if any(c in path for c in '*?[]'):
if fslpath.hasExt(path, exts):
globs = [path]
else:
globs = [f'{path}{ext}' for ext in exts]
globs = [glob.glob(g) for g in globs]
expanded.extend(it.chain(*globs))
else:
expanded.append(path)
paths = expanded
# Build a list of all image files (both # Build a list of all image files (both
# hdr and img and otherwise) that match # hdr and img and otherwise) that match
for path in paths: for path in paths:
try: try:
path = fslimage.removeExt(path) path = fslpath.removeExt(path, allowedExts=exts)
imgfiles.extend(fslimage.addExt(path, unambiguous=False)) imgfiles.extend(fslpath.addExt(path,
allowedExts=exts,
unambiguous=False))
except fslpath.PathError: except fslpath.PathError:
continue continue
......
#!/usr/bin/env python
#
# imln.py - Create symbolic links to image files.
#
# Author: Paul McCarthy <pauldmccarthy@gmail.com>
#
"""This module defines the ``imln`` application, for creating sym-links
to NIFTI image files.
.. note:: When creating links to relative paths, ln requires that the path is
relative to the link location, rather than the invocation
location. This is *not* currently supported by imln, and possibly
never will be.
"""
import os.path as op
import os
import sys
import fsl.utils.path as fslpath
# The lists below are defined in the
# fsl.data.image class, but are duplicated
# here for performance (to avoid import of
# nibabel/numpy/etc).
exts = ['.nii.gz', '.nii',
'.img', '.hdr',
'.img.gz', '.hdr.gz',
'.mnc', '.mnc.gz']
"""List of file extensions that are supported by ``imtest``.
"""
groups = [('.hdr', '.img'), ('.hdr.gz', '.img.gz')]
"""List of known image file groups (image/header file pairs). """
usage = """
Usage: imln <file1> <file2>
Makes a link (called file2) to file1
NB: filenames can be basenames or include an extension
""".strip()
def main(argv=None):
"""``imln`` - create sym-links to images. """
if argv is None:
argv = sys.argv[1:]
if len(argv) != 2:
print(usage)
return 1
target, linkbase = argv
target = fslpath.removeExt(target, exts)
linkbase = fslpath.removeExt(linkbase, exts)
# Target must exist, so we can
# infer the correct extension(s).
# Error on incomplete file groups
# (e.g. a.img without a.hdr).
try:
targets = fslpath.getFileGroup(target,
allowedExts=exts,
fileGroups=groups,
unambiguous=True)
except Exception as e:
print(f'Error: {e}')
return 1
for target in targets:
if not op.exists(target):
continue
ext = fslpath.getExt(target, exts)
link = f'{linkbase}{ext}'
try:
# emulate old imln behaviour - if
# link already exists, it is removed
if op.exists(link):
os.remove(link)
os.symlink(target, link)
except Exception as e:
print(f'Error: {e}')
return 1
return 0
if __name__ == '__main__':
sys.exit(main())
...@@ -13,19 +13,13 @@ The :func:`main` function is essentially a wrapper around the ...@@ -13,19 +13,13 @@ The :func:`main` function is essentially a wrapper around the
""" """
from __future__ import print_function
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:
...@@ -60,6 +54,11 @@ def main(argv=None): ...@@ -60,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(
......
#!/usr/bin/env python
#
# imrm.py - Remove image files.
#
# Author: Paul McCarthy <paulmc@fmrib.ox.ac.uk>
#
"""This module defines the ``imrm`` application, for removing NIFTI image
files.
"""
import os.path as op
import os
import sys
import fsl.scripts.imglob as imglob
usage = """Usage: imrm <list of image names to remove>
NB: filenames can be basenames or not
""".strip()
def main(argv=None):
"""Removes all images which are specified on the command line. """
if argv is None:
argv = sys.argv[1:]
if len(argv) < 1:
print(usage)
return 1
paths = imglob.imglob(argv, 'all')
for path in paths:
if op.exists(path):
os.remove(path)
return 0
if __name__ == '__main__':
sys.exit(main())
#!/usr/bin/env python
#
# imtest.py - Test whether an image file exists or not.
#
# Author: Paul McCarthy <pauldmccarthy@gmail.com>
#
"""The ``imtest`` script can be used to test whether an image file exists or
not, without having to know the file suffix (.nii, .nii.gz, etc).
"""
import os.path as op
import sys
import fsl.utils.path as fslpath
# The lists below are defined in the
# fsl.data.image class, but are duplicated
# here for performance (to avoid import of
# nibabel/numpy/etc).
exts = ['.nii.gz', '.nii',
'.img', '.hdr',
'.img.gz', '.hdr.gz',
'.mnc', '.mnc.gz']
"""List of file extensions that are supported by ``imtest``.
"""
groups = [('.hdr', '.img'), ('.hdr.gz', '.img.gz')]
"""List of known image file groups (image/header file pairs). """
def imtest(path):
"""Returns ``True`` if the given image path exists, False otherwise. """
path = fslpath.removeExt(path, exts)
path = op.realpath(path)
# getFileGroup will raise an error
# if the image (including all
# components - i.e. header and
# image) does not exist
try:
fslpath.getFileGroup(path,
allowedExts=exts,
fileGroups=groups,
unambiguous=True)
return True
except fslpath.PathError:
return False
def main(argv=None):
"""Test if an image path exists, and prints ``'1'`` if it does or ``'0'``
if it doesn't.
"""
if argv is None:
argv = sys.argv[1:]
# emulate old fslio/imtest - always return 0
if len(argv) != 1:
print('0')
return 0
if imtest(argv[0]):
print('1')
else:
print('0')
return 0
if __name__ == '__main__':
sys.exit(main())
#!/usr/bin/env python
#
# remove_ext.py - Remove file extensions from NIFTI image paths
#
# Author: Paul McCarthy <pauldmccarthy@gmail.com>
#
import sys
import fsl.utils.path as fslpath
usage = """Usage: remove_ext <list of image paths to remove extension from>
""".strip()
# This list is defined in the
# fsl.data.image class, but are duplicated
# here for performance (to avoid import of
# nibabel/numpy/etc).
exts = ['.nii.gz', '.nii',
'.img', '.hdr',
'.img.gz', '.hdr.gz',
'.mnc', '.mnc.gz']
"""List of file extensions that are removed by ``remove_ext``. """
def main(argv=None):
"""Removes file extensions from all paths which are specified on the
command line.
"""
if argv is None:
argv = sys.argv[1:]
if len(argv) < 1:
print(usage)
return 1
removed = []
for path in argv:
removed.append(fslpath.removeExt(path, exts))
print(' '.join(removed))
return 0
if __name__ == '__main__':
sys.exit(main())
...@@ -10,6 +10,7 @@ ...@@ -10,6 +10,7 @@
import os import os
import sys import sys
import glob import glob
import hashlib
import shutil import shutil
import fnmatch import fnmatch
import logging import logging
...@@ -20,14 +21,12 @@ import os.path as op ...@@ -20,14 +21,12 @@ import os.path as op
import numpy as np import numpy as np
import nibabel as nib import nibabel as nib
from six import StringIO from io import StringIO
from unittest import mock
try: from unittest import mock
except ImportError: import mock
import fsl.data.image as fslimage import fsl.data.image as fslimage
from fsl.utils.tempdir import tempdir from fsl.utils.tempdir import tempdir
from fsl.utils.platform import platform as fslplatform from fsl.utils.platform import platform as fslplatform
...@@ -71,7 +70,7 @@ def touch(fname): ...@@ -71,7 +70,7 @@ def touch(fname):
pass pass
class CaptureStdout(object): class CaptureStdout:
"""Context manager which captures stdout and stderr. """ """Context manager which captures stdout and stderr. """
def __init__(self): def __init__(self):
...@@ -90,6 +89,7 @@ class CaptureStdout(object): ...@@ -90,6 +89,7 @@ class CaptureStdout(object):
sys.stdout = self.__mock_stdout sys.stdout = self.__mock_stdout
sys.stderr = self.__mock_stderr sys.stderr = self.__mock_stderr
return self
def __exit__(self, *args, **kwargs): def __exit__(self, *args, **kwargs):
...@@ -148,6 +148,8 @@ def testdir(contents=None, suffix=""): ...@@ -148,6 +148,8 @@ def testdir(contents=None, suffix=""):
shutil.rmtree(self.testdir) shutil.rmtree(self.testdir)
return ctx(contents) return ctx(contents)
testdir.__test__ = False
def make_dummy_files(paths): def make_dummy_files(paths):
"""Creates dummy files for all of the given paths. """ """Creates dummy files for all of the given paths. """
...@@ -287,7 +289,8 @@ def make_mock_feat_analysis(featdir, ...@@ -287,7 +289,8 @@ def make_mock_feat_analysis(featdir,
copes=True, copes=True,
zstats=True, zstats=True,
residuals=True, residuals=True,
clustMasks=True): clustMasks=True,
zfstats=True):
if xform is None: if xform is None:
xform = np.eye(4) xform = np.eye(4)
...@@ -320,6 +323,7 @@ def make_mock_feat_analysis(featdir, ...@@ -320,6 +323,7 @@ def make_mock_feat_analysis(featdir,
data = np.ravel_multi_index(data, shape) data = np.ravel_multi_index(data, shape)
data = data.reshape(list(shape) + [1]).repeat(timepoints, axis=3) data = data.reshape(list(shape) + [1]).repeat(timepoints, axis=3)
data[..., :] += range(i, i + timepoints) data[..., :] += range(i, i + timepoints)
data = data.astype(np.int32)
img = nib.nifti1.Nifti1Image(data, xform) img = nib.nifti1.Nifti1Image(data, xform)
...@@ -344,6 +348,11 @@ def make_mock_feat_analysis(featdir, ...@@ -344,6 +348,11 @@ def make_mock_feat_analysis(featdir,
otherFiles .extend(files) otherFiles .extend(files)
otherShapes.extend([shape] * len(files)) otherShapes.extend([shape] * len(files))
if zfstats:
files = glob.glob(op.join(featdir, 'stats', 'zfstat*nii.gz'))
otherFiles .extend(files)
otherShapes.extend([shape] * len(files))
if residuals: if residuals:
files = glob.glob(op.join(featdir, 'stats', 'res4d.nii.gz')) files = glob.glob(op.join(featdir, 'stats', 'res4d.nii.gz'))
otherFiles .extend(files) otherFiles .extend(files)
...@@ -431,3 +440,10 @@ def make_random_mask(filename, shape, xform, premask=None, minones=1): ...@@ -431,3 +440,10 @@ def make_random_mask(filename, shape, xform, premask=None, minones=1):
img.save(filename) img.save(filename)
return img return img
def sha256(filename):
hashobj = hashlib.sha256()
with open(filename, 'rb') as f:
hashobj.update(f.read())
return hashobj.hexdigest()
...@@ -14,8 +14,8 @@ import pytest ...@@ -14,8 +14,8 @@ import pytest
import fsl.utils.assertions as assertions import fsl.utils.assertions as assertions
import fsl.utils.tempdir as tempdir import fsl.utils.tempdir as tempdir
from . import make_random_image from fsl.tests import make_random_image
from . import testdir from fsl.tests import testdir
def test_assertFileExists(): def test_assertFileExists():
......
...@@ -17,7 +17,7 @@ import numpy as np ...@@ -17,7 +17,7 @@ import numpy as np
from unittest import mock from unittest import mock
import pytest import pytest
import tests import fsl.tests as tests
import fsl.utils.image.resample as resample import fsl.utils.image.resample as resample
import fsl.data.atlases as atlases import fsl.data.atlases as atlases
import fsl.data.image as fslimage import fsl.data.image as fslimage
...@@ -252,8 +252,7 @@ def test_load_atlas(): ...@@ -252,8 +252,7 @@ def test_load_atlas():
reg = atlases.registry reg = atlases.registry
reg.rescanAtlases() reg.rescanAtlases()
probatlas = reg.loadAtlas('harvardoxford-cortical', probatlas = reg.loadAtlas('harvardoxford-cortical')
calcRange=False, loadData=False)
probsumatlas = reg.loadAtlas('harvardoxford-cortical', loadSummary=True) probsumatlas = reg.loadAtlas('harvardoxford-cortical', loadSummary=True)
lblatlas = reg.loadAtlas('talairach') lblatlas = reg.loadAtlas('talairach')
...@@ -287,8 +286,7 @@ def test_find(): ...@@ -287,8 +286,7 @@ def test_find():
reg = atlases.registry reg = atlases.registry
reg.rescanAtlases() reg.rescanAtlases()
probatlas = reg.loadAtlas('harvardoxford-cortical', probatlas = reg.loadAtlas('harvardoxford-cortical')
calcRange=False, loadData=False)
probsumatlas = reg.loadAtlas('harvardoxford-cortical', loadSummary=True) probsumatlas = reg.loadAtlas('harvardoxford-cortical', loadSummary=True)
lblatlas = reg.loadAtlas('talairach') lblatlas = reg.loadAtlas('talairach')
...@@ -335,8 +333,7 @@ def test_prepareMask(): ...@@ -335,8 +333,7 @@ def test_prepareMask():
reg = atlases.registry reg = atlases.registry
reg.rescanAtlases() reg.rescanAtlases()
probatlas = reg.loadAtlas('harvardoxford-cortical', probatlas = reg.loadAtlas('harvardoxford-cortical')
loadData=False, calcRange=False)
probsumatlas = reg.loadAtlas('harvardoxford-cortical', loadSummary=True) probsumatlas = reg.loadAtlas('harvardoxford-cortical', loadSummary=True)
lblatlas = reg.loadAtlas('talairach') lblatlas = reg.loadAtlas('talairach')
......