Optimizing ultrafast illumination for multiphoton-excited fluorescence imaging