[2][3] Focus stacking can be used in any situation where individual images have a very shallow depth of field; macro photography and optical microscopy are two typical examples.
Focus stacking offers flexibility: since it is a computational technique, images with several different depths of field can be generated in post-processing and compared for best artistic merit or scientific clarity.
Alternative techniques for generating images with increased or flexible depth of field include wavefront coding, light-field cameras and tilt.
A high numerical aperture (equivalent to a low f-number) gives a very shallow depth of field.
Atomic resolution scanning transmission electron microscopy encounters similar difficulties, where specimen features are much larger than the depth of field.