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

Expanded mghimage unit test

parent 526cfdee
No related branches found
No related tags found
No related merge requests found
...@@ -31,8 +31,16 @@ def test_MGHImage(): ...@@ -31,8 +31,16 @@ def test_MGHImage():
datadir = op.join(op.dirname(__file__), 'testdata') datadir = op.join(op.dirname(__file__), 'testdata')
testfile = op.join(datadir, 'example.mgz') testfile = op.join(datadir, 'example.mgz')
# Load from a file
img = fslmgh.MGHImage(testfile) img = fslmgh.MGHImage(testfile)
nbimg = nib.load(testfile) nbimg = nib.load(testfile)
assert np.all(np.isclose(img[:], nbimg.get_data())) assert np.all(np.isclose(img[:], nbimg.get_data()))
assert np.all(np.isclose(img.voxToWorldMat, nbimg.affine)) assert np.all(np.isclose(img.voxToWorldMat, nbimg.affine))
assert img.mghImageFile == testfile
# Load from an in-memory nibabel object
img = fslmgh.MGHImage(nbimg)
assert np.all(np.isclose(img[:], nbimg.get_data()))
assert np.all(np.isclose(img.voxToWorldMat, nbimg.affine))
assert img.mghImageFile is None
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