Computing Casimir invariants from Pffafian systems