ndio/convert/nifti.py
def save(nifti_filename, numpy_data):
    """
    Export a numpy array to a nifti file.  TODO: currently using dummy
    headers and identity matrix affine transform. This can be expanded.

    Arguments:
        nifti_filename (str): A filename to which to save the nifti data
        numpy_data (numpy.ndarray): The numpy array to save to nifti

    Returns:
        String. The expanded filename that now holds the nifti data
    """
    # Expand filename to be absolute
    nifti_filename = os.path.expanduser(nifti_filename)

    try:
        nifti_img = nib.Nifti1Image(numpy_data, numpy.eye(4))
        nib.save(nifti_img, nifti_filename)

    except Exception as e:
        raise ValueError("Could not save file {0}.".format(nifti_filename))
    return nifti_filename
def save(nifti_filename, numpy_data):
    """
    Export a numpy array to a nifti file.  TODO: currently using dummy
    headers and identity matrix affine transform. This can be expanded.

    Arguments:
        nifti_filename (str): A filename to which to save the nifti data
        numpy_data (numpy.ndarray): The numpy array to save to nifti

    Returns:
        String. The expanded filename that now holds the nifti data
    """
    # Expand filename to be absolute
    nifti_filename = os.path.expanduser(nifti_filename)

    try:
        nifti_img = nib.Nifti1Image(numpy_data, numpy.eye(4))
        nib.save(nifti_img, nifti_filename)

    except Exception as e:
        raise ValueError("Could not save file {0}.".format(nifti_filename))
    return nifti_filename
Export a numpy array to a nifti file.  TODO: currently using dummy
    headers and identity matrix affine transform. This can be expanded.

    Arguments:
        nifti_filename (str): A filename to which to save the nifti data
        numpy_data (numpy.ndarray): The numpy array to save to nifti

    Returns:
        String. The expanded filename that now holds the nifti data