Watching a butterfly emerge from its chrysalis is enough to evoke wonder even from the most world-weary of souls. But rarely do we get to see behind the scenes of the pupa’s transformation. Current methods rely on dissection of the chrysalis, or at best, staining the critter (thereby killing it) and using X-rays to look inside.

Now scientists have worked out how to use a CT scanner, used in medical settings for high-powered X-rays, to look inside a living chrysalis. And they’ve produced this impressive time-lapse video revealing just what goes on in that hidden interior.

The pupae studied wereVanessa cardui, destined to become Painted Lady butterflies. Each of the nine pupae was scanned a few times over its 13-16 day pupation period. Because the insects are naturally highly tolerant of radiation, and the dosages were low, more than half survived to hatching.

One specimen stood out as having the most complete set of scans. Here are two views of its development.

First, the actual X-ray images. By day 15 the shape of the adult butterfly can be discerned. Its eyes are at the bottom; its antennae, proboscis and legs are folded up along its stomach.

And second, an animation of the development of two of its organ systems—for breathing and eating.

In blue is the insect’s respiratory system. Caterpillars and adult butterflies both breathe through tiny pores called spiracles. From each spiracle, the blue tubes, called trachea, carry oxygen into the chrysalis. In green is the insect’s air lumen, which functions like lungs in concert with the tracheae.

The midgut, the equivalent of an insect’s stomach, is seen in red. Caterpillars need a big midgut to digest the large amounts of plant material they consume, while butterflies, which eat only nectar and other liquids, require a much smaller midgut. In the video you can see the midgut shrink quickly from its caterpillar size and, by day 7, has reached the final, smaller shape present in the adult butterfly.

Finally, appearing late in development in orange at the hind end of the pupa is its Malphigian tubules—aka, its excretory system.

The scans can’t yet see muscles or the nervous system of the pupa, which would give lots of additional insight into what goes on inside the chrysalis. For that, we’ll have to wait for the sequel. The results are published today in Journal of the Royal Society Interface.