CDI is recording a diffraction pattern (reciprocal space) generated by a coherent beam. Using either several CDI images from overlapping positions of the sample or additional information (support), you can then reconstruct a real space model of the sample.
It is not so different from normal x-ray diffraction for crystallography: You record diffracted intensities, but cannot measure the phase. Therefore it is not possible to do a direct inverse Fourier transform of the complex structure factors. Instead you make a model of the sample, using the additional information that crystals are periodic and have to belong to one of the 230 crystallographic space groups, probably you know something about the composition... Then you record many more intensities than there are parameters in your model - the model being lattice parameters and atomic positions. With that you have (hopefully) enough information to reconstruct the real-space crystal structure.
CDI is often done in just 2D, but 3D is also possible.