Combining scanning electron microscopy with serial slicing by a focused ion beam yields spatial image data of materials structures at the nanometer scale. However, the depth of field of the scanning electron microscopic images causes unwanted effects when highly porous structures are imaged. Proper spatial reconstruction of such porous structures from the stack of microscopic images is a tough and in general yet unsolved segmentation problem. Recently, machine learning methods have proven to yield solutions to a variety of image segmentation problems. However, their use is hindered by the need of large amounts of annotated data in the training phase. Here, we therefore replace annotated real image data by simulated image stacks of synthetic structures-realizations of stochastic germ-grain models and random packings. This strategy yields the annotations for free, but shifts the effort to choosing appropriate stochastic geometry models and generating sufficiently realistic scanning electron microscopic images.