Multibeam two-photon excitation with diffractive optical elements (DOE) or spatial light modulators (SLM). Both the DOE and the SLM use diffraction to create an output pattern of multiple beamlets of light from a single input beam. (A) DOE is a static diffraction grating which creates a single particular output pattern, in this case a linear array of evenly spaced beamlets. These beamlets can be used to increase speed and/or increase sampling of imaging given that they allow for simultaneous exposure of multiple full power excitation points either in parallel or in series over portions of the field. (B) The SLM is dynamically controllable via computer and can create arbitrary patterns of output light to fit the spatial aspects of particular imaging fields (i.e., targeting particular neurites or cells). Furthermore, the SLM can have a new diffraction grating pattern thereby creating a new output pattern of beamlets every 16.7 ms (or even faster depending on type of the used SLM). SLMs allow scanless microscopy for both imaging as well as photostimulation experiments all at multiple spatial points simultaneously.