Commit ff3e8133 authored by Paul McCarthy's avatar Paul McCarthy 🚵
Browse files

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

parent 9715cb4c
#!/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
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