An implant includes a shape-memory material having a transformation temperature. The implantable element is configured to be implanted, and to perform a first therapeutic function when the shape-memory material is in a first shape. An energy applicator is configured to change the shape-memory material from the first shape to a second shape by raising a temperature of the shape-memory material to the transformation temperature by radiating energy to the implant from outside the body. The implant is configured to perform a second therapeutic function while the shape-memory material is in the second shape, the second therapeutic function being qualitatively different from the first therapeutic function. Other embodiments are also described.