In accordance with the present invention, a method for determining a centerline through a region of interest in a 3D image dataset is provided. The method includes identifying the boundaries of the region of interest and identifying the endpoints of the region of interest. For those points within the boundaries, a penalty value which is a function of the proximity of the point to a boundary is determined. A centerline is then identified by the path connecting the endpoints which has the minimum penalized distance wherein the penalized distance reflects the actual accumulated pathlength and the penalties associated with the points along the path. From the centerline, branches of a complete skeleton can be established by determining branch endpoints and then finding the minimum penalized distance from each endpoint the centerline or another intersecting branch.