Tree structures (T1, T2) corresponding to first and second linear structures (M1, M2) are accurately constructed from medical image data including the first and second linear structures (M1, M2), each repeatedly branching from an origin and extending in directions away from the origin in such a manner to become wider. Each of a first root node (NA 0 ) in the first tree structure (T1) and a second root node (NB 0 ) in the second tree structure (T2) is connected to each node, based on the characteristic that each of the first and second linear structures (M1, M2) repeatedly branches from the origin and extends in directions away from the origin in such a manner to become wider, by using, with respect to each node, a cost function that weights a cost representing a probability of connection of each of a plurality of edges connectable to each node.