Generalize decodeDim to handle arrays of specific dimensions <> 1.