ProfilePathFinding: handle imp of ndims > 3

Signed-off-by: Jean-Yves Tinevez <jean-yves.tinevez@pasteur.fr>