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

New module fsl.utils.ensure, which ensures things.

parent 9715cb4c
No related branches found
No related tags found
No related merge requests found
#!/usr/bin/env python
#
# ensure.py - Functions which ensure things.
#
# Author: Paul McCarthy <pauldmccarthy@gmail.com>
#
"""This module contains a handful of utility functions which attempt to ensure
that some condition is met.
.. autosummary::
:nosignatures:
ensureIsImage
"""
import six
import nibabel as nib
def ensureIsImage(img):
"""Ensures that the given ``img`` is an in-memory ``nibabel`` object.
"""
if isinstance(img, six.string_types):
img = nib.load(img)
return img
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