diff --git a/tests/test_image.py b/tests/test_image.py index 6d1ed0cfd6b3158574420bafb5d046d32a226b84..00a2cc749fa056288de6164648f8b82763205e35 100644 --- a/tests/test_image.py +++ b/tests/test_image.py @@ -284,7 +284,7 @@ def _test_Image_atts(imgtype): dims, pixdims, dtype = atts - expdims = imagewrapper.canonicalShape(dims) + expdims = fslimage.canonicalShape(dims) expndims = len(expdims) ndims = len(dims) pixdims = pixdims[:ndims] @@ -340,6 +340,33 @@ def _test_Image_atts2(imgtype): assert img.intent == intent +def test_canonicalShape(): + + # (input, expected) + tests = [ + ((10,), (10, 1, 1)), + ((10, 1), (10, 1, 1)), + ((10, 1, 1), (10, 1, 1)), + ((10, 1, 1, 1), (10, 1, 1)), + ((10, 1, 1, 1, 1), (10, 1, 1)), + ((10, 10), (10, 10, 1)), + ((10, 10, 1), (10, 10, 1)), + ((10, 10, 1, 1), (10, 10, 1)), + ((10, 10, 1, 1, 1), (10, 10, 1)), + ((10, 10, 10), (10, 10, 10)), + ((10, 10, 10, 1), (10, 10, 10)), + ((10, 10, 10, 1, 1), (10, 10, 10)), + ((10, 10, 10, 10), (10, 10, 10, 10)), + ((10, 10, 10, 10, 1), (10, 10, 10, 10)), + ((10, 10, 10, 10, 1, 1), (10, 10, 10, 10)), + ((10, 10, 10, 10, 10), (10, 10, 10, 10, 10)), + ((10, 10, 10, 10, 10, 1), (10, 10, 10, 10, 10)), + ] + + for input, expected in tests: + assert tuple(fslimage.canonicalShape(input)) == expected + + def test_looksLikeImage(): """Test the looksLikeImage function. """