Development of magnetic anisotropies in ultrathin epitaxial films of Fe(001) and Ni(001)