OPT: improve computation of permutations for images
OPT: improve computation of permutations for images

Former-commit-id: b75136282823935b05bd15fd2e715248ac517a60
Former-commit-id: 9837b3d63d28f90f504bdd18044bdab91474ff3d
3324fr/spinalcordtoolbox,3324fr/spinalcordtoolbox,3324fr/spinalcordtoolbox,3324fr/spinalcordtoolbox,3324fr/spinalcordtoolbox,3324fr/spinalcordtoolbox,3324fr/spinalcordtoolbox