def zero_variance(func, mask):
    '\n    Mask out voxels with zero variance across t-axis\n\n    :param numpy.ndarray func: input fMRI dataset, after motion correction\n    :param numpy.ndarray mask: 3D brain mask\n    :return: the 3D mask of voxels with nonzero variance across :math:`t`.\n    :rtype: numpy.ndarray\n\n    '
    idx = np.where((mask > 0))
    func = func[idx[0], idx[1], idx[2], :]
    tvariance = func.var(axis=1)
    tv_mask = np.zeros_like(tvariance)
    tv_mask[(tvariance > 0)] = 1
    newmask = np.zeros_like(mask)
    newmask[idx] = tv_mask
    return newmask
Mask out voxels with zero variance across t-axis

:param numpy.ndarray func: input fMRI dataset, after motion correction
:param numpy.ndarray mask: 3D brain mask
:return: the 3D mask of voxels with nonzero variance across :math:`t`.
:rtype: numpy.ndarray
def zero_variance(func, mask):
    '\n    Mask out voxels with zero variance across t-axis\n\n    :param numpy.ndarray func: input fMRI dataset, after motion correction\n    :param numpy.ndarray mask: 3D brain mask\n    :return: the 3D mask of voxels with nonzero variance across :math:`t`.\n    :rtype: numpy.ndarray\n\n    '
    idx = np.where((mask > 0))
    func = func[idx[0], idx[1], idx[2], :]
    tvariance = func.var(axis=1)
    tv_mask = np.zeros_like(tvariance)
    tv_mask[(tvariance > 0)] = 1
    newmask = np.zeros_like(mask)
    newmask[idx] = tv_mask
    return newmask