A craniectomy is an emergency procedure used to relieve swelling in the brain due to a stroke or a traumatic brain injury. A craniotomy is done in order to allow a surgeon to remove a brain tumor. In both cases, a bone flap, or section of the skull, is removed. With a craniotomy, this bone flap is replaced right away, while in a craniectomy the flap is often preserved and put back at a later time.