Theory and applications of generalized operator transforms for diagonalization of spin Hamiltonians