Spin canonical invariants of 4-manifolds and algebraic surfaces