niftynet.utilities.filename_matching module

Matching file names by configuration options.

class KeywordsMatching(list_paths=(), list_contain=(), list_not_contain=(), regex_remove=())[source]

Bases: object

This class is responsible for the search of the appropriate files to use as input based on the constraints given in the config file.

classmethod from_dict(input_dict, default_folder=None)[source]

In the config file, constraints for a given search can be of three types: path_to_search, filename_contains and filename_not_contains. Each associated value is a string. Multiple constraints are delimited by a ,. This function creates the corresponding matching object with the list of constraints for each of these subtypes.

  • default_folder – relative paths are first tested against the current folder, and then against this default folder.
  • input_dict – set of searching parameters.


This function perform the search of the relevant files (stored in filename_list) and extract the corresponding possible list of subject names (stored in subjectname_list).

Returns:filename_list, subjectname_list

Formatting the class as an intuitive string for printing.