The determination of dislocation densities in thin films