Permutation Tests for Complex Data: Theory, Applications and Software