code: def get_reader(data_param, image_sets_partitioner, phase):
      # Using Nifty Reader
      if phase == "training":
          image_reader = ImageReader().initialise(
              data_param,
              file_list=image_sets_partitioner.get_file_list(TRAIN),
          )
  
      elif phase == "validation":
          image_reader = ImageReader().initialise(
              data_param,
              file_list=image_sets_partitioner.get_file_list(VALID),
          )
  
      elif phase == "inference":
          image_reader = ImageReader().initialise(
              data_param,
              file_list=image_sets_partitioner.get_file_list(INFER),
          )
      else:
          raise Exception(
              "Invalid phase choice: {}".format(
                  {"phase": ["train", "validation", "inference"]}
              )
          )
  
      # Adding preprocessing layers
      mean_variance_norm_layer = MeanVarNormalisationLayer(
          image_name="image"
      )
      pad_layer = PadLayer(
          image_name=("image", "label"), border=(8, 8, 8)
      )
      image_reader.add_preprocessing_layers([mean_variance_norm_layer])
  
      if phase == "inference":
          image_reader.add_preprocessing_layers([pad_layer])
  
      return image_reader
  
imports: import argparse
  import time
  import numpy
  import torch
  import torch.optim
  from libs import dataset_niftynet
  from libs import loss
  from libs import model
  from torch.utils.data import DataLoader
  from niftynet.engine.sampler_grid_v2 import GridSampler
  from niftynet.engine.sampler_uniform_v2 import UniformSampler
  from niftynet.engine.signal import TRAIN, VALID, INFER
  from niftynet.engine.windows_aggregator_grid import GridSamplesAggregator
  from niftynet.evaluation.pairwise_measures import PairwiseMeasures
  from niftynet.io.image_reader import ImageReader
  from niftynet.io.image_sets_partitioner import ImageSetsPartitioner
  from niftynet.layer.mean_variance_normalisation import MeanVarNormalisationLayer
  from niftynet.layer.pad import PadLayer
label_desc: Use image node_id 1 for calling a global function with example usage: get_reader(data_param, image_sets_partitioner, phase) and returns: image_reader