So in the case of a 2D array, you can have 2 coordinates to describe a location in that array. You can also describe the data as a 1D array by calculating the raw index by x + y * width. If you have the raw index, you can get the y coordinate with an integer divide like so: y = i/width. Then you can get the x coordinate with the modulus operator x = i % width.
This should also be possible to get the coordinates for a 3D array, but I can't figure it out. If you know the width(maxX), height(maxY) and depth(maxZ) of a 3D array, you should be able to convert a raw index into coordinates... right?