code: def _filename_to_image_list(file_list, mod_dict, data_param):
      """
      Converting a list of filenames to a list of image objects,
      Properties (e.g. interp_order) are added to each object
      """
      volume_list = []
      valid_idx = []
      for idx in range(len(file_list)):
          # create image instance for each subject
          print_progress_bar(
              idx,
              len(file_list),
              prefix="reading datasets headers",
              decimals=1,
              length=10,
              fill="*",
          )
  
          # combine fieldnames and volumes as a dictionary
          _dict = {}
          for field, modalities in mod_dict.items():
              _dict[field] = _create_image(
                  file_list, idx, modalities, data_param
              )
  
          # skipping the subject if there're missing image components
          if _dict and None not in list(_dict.values()):
              volume_list.append(_dict)
              valid_idx.append(idx)
  
      if not volume_list:
          tf.logging.fatal(
              "Empty filename lists, please check the csv "
              "files. (removing csv_file keyword if it is"
              " in the config file "
              "to automatically search folders and generate new csv "
              "files again)\n\n"
              "Please note in the matched file names, each subject id are "
              "created by removing all keywords listed `filename_contains` "
              "in the config.\n\n"
              "E.g., `filename_contains=foo, bar` will match file "
              "foo_subject42_bar.nii.gz, and the subject id is _subject42_."
          )
          raise IOError
      return volume_list, file_list.iloc[valid_idx]
  
imports: from __future__ import absolute_import, division, print_function
  from copy import deepcopy
  import argparse
  import numpy
  import pandas
  import tensorflow
  from six import string_types
  from niftynet.io.misc_io import dtype_casting
  from niftynet.io.image_sets_partitioner import COLUMN_UNIQ_ID
  from niftynet.io.image_type import ImageFactory
  from niftynet.layer.base_layer import Layer, DataDependentLayer, RandomisedLayer
  from niftynet.utilities.user_parameters_helper import make_input_tuple
  from niftynet.utilities.util_common import print_progress_bar, ParserNamespace
  from niftynet.io.image_sets_partitioner import ImageSetsPartitioner
  from niftynet.utilities.util_common import look_up_operations
label_desc: Use image node_id 2 for calling a global function with example usage: _filename_to_image_list(file_list, mod_dict, data_param) and returns: volume_list,  file_list