def compareVersions(v1, v2):
    """Compares two ``dcm2niix`` versions ``v1`` and ``v2``.  The versions are
    assumed to be in the format returned by :func:`installedVersion`.

    :returns: - 1 if ``v1`` is newer than ``v2``
              - -1 if ``v1`` is older than ``v2``
              - 0 if ``v1`` the same as ``v2``.
    """
    for iv1, iv2 in zip(v1, v2):
        if iv1 > iv2:
            return 1
        elif iv1 < iv2:
            return -1
    return 0
