1. A medical system comprising: a memory storing information of a four-dimensional computer model of an anatomical structure of a patient, wherein the four-dimensional computer model includes information of a plurality of three-dimensional computer models of the anatomical structure of the patient, wherein each of the plurality of three-dimensional computer models is for a different point in time than others of the plurality of three-dimensional computer models so that the fourth dimension is time, wherein the plurality of three-dimensional computer models indicate movement of the anatomical structure, wherein each of the plurality of three-dimensional computer models defines a plurality of passages, and wherein each of the plurality of passages has a shape; a medical device having a flexible body and a plurality of sensors distributed along the length of the flexible body; and a processor programmed to determine the pose and shape of the flexible body while disposed in a passage of the anatomical structure using information provided by the plurality of sensors at the same point in time and register the medical device to the four-dimensional computer model of the anatomical structure by matching at least the determined shape of the flexible body to a best fitting one of the shapes of one or more potential passages in the four-dimensional computer model of the anatomical structure.