Commit 00eabbe1 authored by Paul McCarthy's avatar Paul McCarthy 🚵
Browse files

TEST: Test for fileOrImage. Fixed parse_data test - depends on FSL

parent c68da9a3
......@@ -15,6 +15,7 @@ from fsl.data.atlases import Atlas
from pytest import raises
from .test_image import make_image
import os
import pytest
datadir = op.join(op.dirname(__file__), 'testdata')
......@@ -115,6 +116,7 @@ def test_image_out():
assert args.image_out == 'test.surf.gii' + extension
@pytest.mark.fsltest
def test_atlas():
atlas_parser = argparse.ArgumentParser('reads an atlas')
atlas_parser.add_argument('atlas', type=parse_data.Atlas)
......@@ -123,4 +125,4 @@ def test_atlas():
assert isinstance(args.atlas, Atlas)
with raises(SystemExit):
atlas_parser.parse_args(['fake'])
\ No newline at end of file
atlas_parser.parse_args(['fake'])
......@@ -21,6 +21,7 @@ import nibabel as nib
import fsl.utils.tempdir as tempdir
import fsl.utils.run as run
import fsl.utils.fslsub as fslsub
import fsl.data.image as fslimage
import fsl.wrappers.wrapperutils as wutils
......@@ -284,6 +285,28 @@ def test_fileOrImage():
assert np.all(nib.load('output.nii').get_data() == expected)
os.remove('output.nii')
# fslimage, file, load
result = func(fslimage.Image(img1), img2='img2.nii',
output=wutils.LOAD)['output']
assert isinstance(result, fslimage.Image)
assert np.all(result[:].squeeze() == expected)
# fslimage, fslimage, load
result = func(fslimage.Image(img1), img2=fslimage.Image(img2),
output=wutils.LOAD)['output']
assert isinstance(result, fslimage.Image)
assert np.all(result[:].squeeze() == expected)
# fslimage, nib.image, load
result = func(fslimage.Image(img1), img2=img2,
output=wutils.LOAD)['output']
assert isinstance(result, fslimage.Image)
assert np.all(result[:].squeeze() == expected)
# nib.image, nib.image, load
result = func(img1, img2=img2, output=wutils.LOAD)['output']
assert isinstance(result, nib.nifti1.Nifti1Image)
assert np.all(result.get_data()[:] == expected)
def test_chained_fileOrImageAndArray():
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment