polyTEM.tomography.alignment.sort_marker_labels

polyTEM.tomography.alignment.sort_marker_labels(coo_list)

used to sort the outputs from find_markers so that the labels match for each marker

find_markers uses kmeans, so the markers are returned in an inconsistent order between images. this function solves the assignment problem by using euclidean distance between the points as the cost matrix The first image in the input list is used as the reference (or the “worker”) and the subsequent images will be reordered (treated as the “jobs” in the assignment problem definition)

Parameters:

coo_list – list where each element of the list is a np.array of x and y coordinates. The shape of each array is expected to be (num_markers,2)

Returns:

numpy array with shape (num_images,num_particles,2)

Return type:

sorted_coo_arr