A tree structure extraction apparatus that extracts, from medical image data including a first linear structure and a second linear structure, each repeatedly branching from an origin and extending in directions away from the origin in such a manner to become wider, the first linear structure and the second linear structure as a first tree structure and a second tree structure respectively, each being defined by a plurality of nodes including a root node corresponding to the origin and a plurality of edges connecting the plurality of nodes, wherein among edges to be connected to each node, edges extending away from a root node are oriented substantially in the same direction away from the root node, the apparatus comprising: a structure region detection means that extracts a candidate region (Rc) of the two linear structures; and a tree structure candidate extraction means that performs thinning of the obtained candidate region, divides the thinned lines at branching points and defines the branching point and end points, as plural nodes, and extracts a candidate of the tree structure representing the first and second linear structure, as plural edges; a tree structure creation means that creates the first tree structure and the second tree structure starting at a first root node (NA 0) corresponding to the origin of the first linear structure and a second root node (NB 0) corresponding to the origin of the second linear structure, respectively, by determining the first root node (NA 0), and by determining the second root node (NB 0), wherein the creation of the first tree structure and the second tree structure is characterized by repeatedly performing the following steps until all nodes have been determined as belonging to the first tree structure or the second tree structure: - comparing costs representing probabilities of connection of edges that connect each node that has been already determined to constitute the first tree structure or the second tree structure with nodes that have not been determined to constitute the first tree structure or the second tree structure; - determining the connection of an edge the probability of connection of which is the highest among said edges; and - considering the node connectable via said edge as belonging to the first tree structure or the second tree structure; wherein the costs are weighted in such a manner that a probability of connection of a root-node-side edge of a node extending from the node toward the first root node (NA 0) or the second root node (NB 0) is lower as an angle between a plurality of edges that are connectable to the node and extend away from the first root node (NA 0) or the second root node (NB 0) is larger. a structure region detection means that extracts a candidate region (Rc) of the two linear structures; and a tree structure candidate extraction means that performs thinning of the obtained candidate region, divides the thinned lines at branching points and defines the branching point and end points, as plural nodes, and extracts a candidate of the tree structure representing the first and second linear structure, as plural edges; a tree structure creation means that creates the first tree structure and the second tree structure starting at a first root node (NA 0) corresponding to the origin of the first linear structure and a second root node (NB 0) corresponding to the origin of the second linear structure, respectively, by determining the first root node (NA 0), and by determining the second root node (NB 0), wherein the creation of the first tree structure and the second tree structure is characterized by repeatedly performing the following steps until all nodes have been determined as belonging to the first tree structure or the second tree structure: - comparing costs representing probabilities of connection of edges that connect each node that has been already determined to constitute the first tree structure or the second tree structure with nodes that have not been determined to constitute the first tree structure or the second tree structure; - determining the connection of an edge the probability of connection of which is the highest among said edges; and - considering the node connectable via said edge as belonging to the first tree structure or the second tree structure; wherein the costs are weighted in such a manner that a probability of connection of a root-node-side edge of a node extending from the node toward the first root node (NA 0) or the second root node (NB 0) is lower as an angle between a plurality of edges that are connectable to the node and extend away from the first root node (NA 0) or the second root node (NB 0) is larger. - comparing costs representing probabilities of connection of edges that connect each node that has been already determined to constitute the first tree structure or the second tree structure with nodes that have not been determined to constitute the first tree structure or the second tree structure; - determining the connection of an edge the probability of connection of which is the highest among said edges; and - considering the node connectable via said edge as belonging to the first tree structure or the second tree structure;