original_docstring: 
      Create a df from a given list of files
      and a list of patient which are used to filter the file names
  
      :param x:
      :param patient_ids:
      :param modality:
      :param columns:
      :param f:
      :param pathology:
      :return:
      
docstring: Create a df from a given list of files
  and a list of patient which are used to filter the file names
docstring_tokens: Create a df from a given list of files and a list of patient which are used to filter the file names
code: def filter_x_by_patient_ids(x, patient_ids, modality='test',
                              columns=['x_path', 'y_path', 'fold', 'modality', 'patient', 'pathology'], fold=0,
                              pathology=None, filter=True):
      """
      Create a df from a given list of files
      and a list of patient which are used to filter the file names
  
      :param x:
      :param patient_ids:
      :param modality:
      :param columns:
      :param f:
      :param pathology:
      :return:
      """
      # create a dataframe from x (list of filenames) filter by patient ids
      # returns a dataframe
      df = pd.DataFrame(columns=columns)
      if filter:
          df['x_path'] = [elem for elem in x if get_patient(elem) in patient_ids]
      else:
          df['x_path'] = [elem for elem in x]
      df['y_path'] = [elem.replace('img', 'msk') for elem in df['x_path']]
      df['fold'] = [fold] * len(df['x_path'])
      df['modality'] = [modality] * len(df['x_path'])
      df['patient'] = [get_patient(elem) for elem in df['x_path']]
      df['pathology'] = [pathology] * len(df['x_path'])
  
      return df
code_tokens: def filter_x_by_patient_ids ( x , patient_ids , modality = 'test' , columns = [ 'x_path' , 'y_path' , 'fold' , 'modality' , 'patient' , 'pathology' ] , fold = 0 , pathology = None , filter = True ) : df = pd . DataFrame ( columns = columns ) if filter : df [ 'x_path' ] = [ elem for elem in x if get_patient ( elem ) in patient_ids ] else : df [ 'x_path' ] = [ elem for elem in x ] df [ 'y_path' ] = [ elem . replace ( 'img' , 'msk' ) for elem in df [ 'x_path' ] ] df [ 'fold' ] = [ fold ] * len ( df [ 'x_path' ] ) df [ 'modality' ] = [ modality ] * len ( df [ 'x_path' ] ) df [ 'patient' ] = [ get_patient ( elem ) for elem in df [ 'x_path' ] ] df [ 'pathology' ] = [ pathology ] * len ( df [ 'x_path' ] ) return df
short_docstring: Create a df from a given list of files
  and a list of patient which are used to filter the file names
short_docstring_tokens: Create a df from a given list of files and a list of patient which are used to filter the file names
comment: """
      Create a df from a given list of files
      and a list of patient which are used to filter the file names
  
      :param x:
      :param patient_ids:
      :param modality:
      :param columns:
      :param f:
      :param pathology:
      :return:
      """$SEP$# create a dataframe from x (list of filenames) filter by patient ids$SEP$# returns a dataframe