Image formation in image scanning microscopy, including the case of two-photon excitation