In this paper we introduce a new algorithm for segmentation of medical images of any dimension. The segmentation is based on geometric methods and multiscale analysis. A sequence of increasingly blurred images is created by Gaussian blurring. Each blurred image is segmented by locating its ridges, decomposing the ridges into curvilinear segments and assigning a unique label to each, and constructing a region for each ridge segment based on a flow model which uses vector fields naturally associated with the ridge finding. The regions from the initial image are leaf nodes in a tree. The regions from the blurred images are interior nodes of the tree. Arcs of the tree are constructed based on how regions at one scale merge via blurring into regions at the next scale. Objects in the image are represented by unions and differences of subtrees of the full tree. The tree is used as input to a visualization program which allows the user to interactively explore the hierarchy and define objects. Some results are provided for a 3D magnetic resonance image of a head.