OPT: updated algo to take into account slices of interest
OPT: updated algo to take into account slices of interest

Former-commit-id: df3c3114376dee5ae3ba60ad893781c427fb8089
Former-commit-id: 112752a06786c9933d94b559022d0340550b0fca
3324fr/spinalcordtoolbox,3324fr/spinalcordtoolbox,3324fr/spinalcordtoolbox,3324fr/spinalcordtoolbox,3324fr/spinalcordtoolbox,3324fr/spinalcordtoolbox,3324fr/spinalcordtoolbox