niftynet.utilities.util_csv module

match_first_degree(name_list1, name_list2)[source]

First immediate matching between two possible name lists (exact equality between one item of list1 and of list2 :param name_list1: First list of names to match :param name_list2: Second list of names where to find a match :return init_match1: :return init_match2: :return ind_match1: Indices of second list that correspond to each given item of list 1 if exists (-1 otherwise) :return ind_match2: Indices of first list that correspond to each given item of list 2 if exists (-1) otherwise

match_second_degree(name_list1, name_list2)[source]

Perform the double matching between two lists of possible names. First find the direct matches, remove them from the ones still to match and match the remaining ones using the maximum overlap. Returns the name match for each list, and the index correspondences.

More subtle matching with first direct matching and then secondary overlap matching between list of list of potential names :param name_list1: :param name_list2: :return init_match1: :return ind_match1: Index of corresponding match in name_list2 :return init_match2: Matching string in list2 :return ind_match2: Index of corresponding match in name_list1

join_subject_id_and_filename_list(name_list, list_files)[source]

From the list of list of names and the list of list of files corresponding to each constraint find the association between a single name id and the different file lists :param name_list: list of list of names :param list_files: list of list of files (one list per constraint) :return list_combined: List per subject of name and list of files given by the constraints

remove_duplicated_names(name_list)[source]

From a list of list of names remove the items that are duplicated :param name_list: list of list of names to investigate :return duplicates_removed: list of list of names freed of duplicates

write_csv(csv_file, list_combined)[source]
match_and_write_filenames_to_csv(list_constraints, csv_file)[source]

Combine all elements of file searching until finally writing the names :param list_constraints: list of constraints (defined by list of paths to search, list of elements the filename should contain and of those that are forbidden :param csv_file: file on which to write the final list of files. :return: