xfmToIdx works for 2d and 3d images