Optical sectioning by Hadamard microscopy. a, Schematic of ultra-wide-field microscope, showing orthogonal illumination sequences in neighboring DMD pixels (P1, P2, …, Pn). The full sequences have a 50% duty cycle. b, Left, In a thick, scattering sample, the in-focus light (red) is dispersed by scattering and mixed with out-of-focus light (yellow). Right, Hadamard microscopy protocol. (1) The sample is illuminated with orthogonal functions of time at adjacent points in space. (2) The images are demodulated by matched filtering with the illumination sequence. (3) Scattered light is rejected by a software aperture. (4) The optically sectioned image is reconstructed from a sum of the demodulated images. c, Codes from a Hadamard matrix were tiled to fill image space. The number of elements in the Hadamard code determined the number of frames in the pattern sequence. A random mask was applied to invert the code in 50% of illumination pixels, yielding pseudorandom patterns with flat spatial and temporal power spectra. d, Raw images were acquired in a calibration sample (a thin homogeneous fluorescent film) and a tissue sample, one frame per Hadamard pattern. Cross-correlation maps between microscope data and Hadamard codes produced arrays of peaks corresponding to signals from distinct sample regions. Negative peaks corresponded to pixels whose Hadamard sequence was inverted. Pixel-wise multiplication of the demodulated images from the calibration sample and from the tissue sample led to multipoint confocal images. These images were summed to produce an image reconstruction. Asterisk (*) indicates matrix multiplication. Detailed description in Materials and Methods.