def from_nibabel(nib_image):
    """
    Convert a nibabel image to an ANTsImage
    """
    tmpfile = mktemp(suffix='.nii.gz')
    nib_image.to_filename(tmpfile)
    new_img = iio2.image_read(tmpfile)
    os.remove(tmpfile)
    return new_img
def from_nibabel ( nib_image ) : tmpfile = mktemp ( suffix = '.nii.gz' ) nib_image . to_filename ( tmpfile ) new_img = iio2 . image_read ( tmpfile ) os . remove ( tmpfile ) return new_img
Convert a nibabel image to an ANTsImage