The nonrandom positioning of genes inside eukaryotic cell nuclei is implicated in central nuclear functions. However, the spatial organization of the genome remains largely uncharted, owing to limited resolution of optical microscopy, paucity of nuclear landmarks and moderate cell sampling. We developed a computational imaging approach that creates high-resolution probabilistic maps of subnuclear domains occupied by individual loci in budding yeast through automated analysis of thousands of living cells. After validation, we applied the technique to genes involved in galactose metabolism and ribosome biogenesis. We found that genomic loci are confined to 'gene territories' much smaller than the nucleus, which can be remodeled during transcriptional activation, and that the nucleolus is an important landmark for gene positioning. The technique can be used to visualize and quantify territory positions relative to each other and to nuclear landmarks, and should advance studies of nuclear architecture and function.