Same remark than before of ndim not existing for niimgs. Use "number of dimensions" instead.