1. 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, the apparatus comprising: a tree structure creation unit that connects, based on the characteristic that each of the first linear structure and the second linear structure repeatedly branches from the origin and extends in directions away from the origin in such a manner to become wider, each of a first root node corresponding to the root node in the first tree structure and a second root node corresponding to the root node in the second tree structure to the plurality of nodes by using, with respect to each of the plurality of nodes, a cost function that weights a cost representing a probability of connection of each of a plurality of edges connectable to each of the plurality of nodes.