1. A medical system comprising: a memory storing information of a computer model of an anatomical structure; 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 computer model to the medical device 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 computer model of the anatomical structure.