Single-ion anisotropy and magnetic field response in the spin-ice materials Ho2Ti2O7 and Dy2Ti2O7