Optical sectioning utilizes the principles of confocal microscopy or two-photon microscopy. These microscopes focus laser light onto a specific plane within a specimen, capturing images at different depths. By collecting a series of images at various focal planes, a three-dimensional reconstruction of the sample is possible.