class_docstr: This class is responsible for the search of the appropriate files to use
  as input based on the constraints given in the config file.
docstr: This function returns a list of potential subject names from a given
  filename, knowing the imposed constraints. Constraints strings are
  removed from the filename to provide the list of possible names. If
  after reduction of the filename from the constraints the name is
  empty the initial filename is returned.
  if remove is not empty, will remove only the strings indicated in
  remove. Otherwise, by default will remove all those in filename_contains
  
  :param fullname:
  :return name_pot: list of potential subject name given the constraint
   list and the initial filename
docstr_tok: ["This","function","returns","a","list","of","potential","subject","names","from","a","given","filename",",","knowing","the","imposed","constraints",".","Constraints","strings","are","removed","from","the","filename","to","provide","the","list","of","possible","names",".","If","after","reduction","of","the","filename","from","the","constraints","the","name","is","empty","the","initial","filename","is","returned",".","if","remove","is","not","empty",",","will","remove","only","the","strings","indicated","in","remove",".","Otherwise",",","by","default","will","remove","all","those","in","filename_contains",":","param","fullname",":",":","return","name_pot",":","list","of","potential","subject","name","given","the","constraint","list","and","the","initial","filename"]
code: def __extract_subject_id_from(self, fullname):
      """
      This function returns a list of potential subject names from a given
      filename, knowing the imposed constraints. Constraints strings are
      removed from the filename to provide the list of possible names. If
      after reduction of the filename from the constraints the name is
      empty the initial filename is returned.
      if remove is not empty, will remove only the strings indicated in
      remove. Otherwise, by default will remove all those in filename_contains
  
      :param fullname:
      :return name_pot: list of potential subject name given the constraint
       list and the initial filename
      """
      _, name, _ = util.split_filename(fullname)
      # split name into parts that might be the subject_id
      potential_names = [name]
      if not self.filename_toremove_fromid:
          #  regular expression not specified,
          #   removing the matched file_contains keywords
          #   use the rest of the string as subject id
          noncapturing_regex_delimiters = [
              "(?:{})".format(re.escape(c))
              for c in self.filename_contains
          ]
          if noncapturing_regex_delimiters:
              potential_names = re.split(
                  "|".join(noncapturing_regex_delimiters), name
              )
          # filter out non-alphanumeric characters and blank strings
          potential_names = [
              re.sub(r"\W+", "", name) for name in potential_names
          ]
      else:
          potential_names = [
              re.sub(self.filename_toremove_fromid, "", name)
          ]
      potential_names = list(filter(bool, potential_names))
      if len(potential_names) > 1:
          potential_names.append("".join(potential_names))
      return potential_names
  
file_path: NiftyNet/niftynet/utilities/filename_matching.py
imports: from __future__ import absolute_import, print_function
  import os
  import re
  import six
  import niftynet.io.misc_io
  import tensorflow
label_desc: Use image node_id 5 for calling the KeywordsMatching obj's underlying member method code with example usage: obj.__extract_subject_id_from(fullname) and returns: potential_names