code: def add_training_args(parser):
      """
      keywords defined for the training action
  
      :param parser:
      :return:
      """
      parser.add_argument(
          "--optimiser",
          help="Choose an optimiser for computing graph gradients and applying",
          type=str,
          default="adam",
      )
  
      parser.add_argument(
          "--sample_per_volume",
          help="[Training only] Set number of samples to take from "
          "each image that was loaded in a given training epoch",
          metavar="",
          type=int,
          default=1,
      )
  
      parser.add_argument(
          "--rotation_angle",
          help="The min/max angles of rotation when rotation "
          "augmentation is enabled",
          type=float_array,
          default=(),
      )
  
      parser.add_argument(
          "--rotation_angle_x",
          help="The min/max angles of the x rotation when rotation "
          "augmentation is enabled",
          type=float_array,
          default=(),
      )
  
      parser.add_argument(
          "--rotation_angle_y",
          help="The min/max angles of the y rotation when rotation "
          "augmentation is enabled",
          type=float_array,
          default=(),
      )
  
      parser.add_argument(
          "--rotation_angle_z",
          help="The min/max angles of the z rotation when rotation "
          "augmentation is enabled",
          type=float_array,
          default=(),
      )
  
      parser.add_argument(
          "--scaling_percentage",
          help="The spatial scaling factor in [min_percentage, max_percentage]",
          type=float_array,
          default=(),
      )
  
      parser.add_argument(
          "--isotropic_scaling",
          help="Indicates if the same random scaling factor should be applied "
          "to each dimension",
          type=str2boolean,
          default=False,
      )
  
      parser.add_argument(
          "--antialiasing",
          help="Indicates if antialiasing must be performed "
          "when randomly scaling the input images",
          type=str2boolean,
          default=True,
      )
  
      parser.add_argument(
          "--bias_field_range",
          help="[Training only] The range of bias field coeffs in [min_coeff, "
          "max_coeff]",
          type=float_array,
          default=(),
      )
  
      parser.add_argument(
          "--bf_order",
          help="[Training only] maximal polynomial order to use for the "
          "creation of the bias field augmentation",
          metavar="",
          type=int,
          default=3,
      )
  
      parser.add_argument(
          "--random_flipping_axes",
          help="The axes which can be flipped to augment the data. Supply as "
          "comma-separated values within single quotes, e.g. '0,1'. Note "
          "that these are 0-indexed, so choose some combination of 0, 1.",
          type=int_array,
          default=-1,
      )
  
      # elastic deformation
      parser.add_argument(
          "--do_elastic_deformation",
          help="Enables elastic deformation",
          type=str2boolean,
          default=False,
      )
  
      parser.add_argument(
          "--num_ctrl_points",
          help="Number of control points for the elastic deformation",
          type=int,
          default=4,
      )
  
      parser.add_argument(
          "--deformation_sigma",
          help="The standard deviation for elastic deformation.",
          type=float,
          default=15,
      )
  
      parser.add_argument(
          "--proportion_to_deform",
          help="What fraction of samples to deform elastically.",
          type=float,
          default=0.5,
      )
  
      parser.add_argument(
          "--lr",
          help="[Training only] Set learning rate",
          type=float,
          default=0.01,
      )
  
      parser.add_argument(
          "--loss_type",
          metavar="TYPE_STR",
          help="[Training only] Specify loss type_str",
          default="Dice",
      )
  
      parser.add_argument(
          "--starting_iter",
          metavar="",
          help="[Training only] Resume from iteration n",
          type=int,
          default=0,
      )
  
      parser.add_argument(
          "--save_every_n",
          metavar="",
          help="[Training only] Model saving frequency",
          type=int,
          default=500,
      )
  
      parser.add_argument(
          "--tensorboard_every_n",
          metavar="",
          help="[Training only] Tensorboard summary frequency",
          type=int,
          default=20,
      )
  
      parser.add_argument(
          "--max_iter",
          metavar="",
          help="[Training only] Total number of iterations",
          type=int,
          default=10000,
      )
  
      parser.add_argument(
          "--max_checkpoints",
          help="Maximum number of model checkpoints that will be saved",
          type=int,
          default=100,
      )
  
      parser.add_argument(
          "--validation_every_n",
          help="Validate every n iterations",
          type=int,
          default=-1,
      )
  
      parser.add_argument(
          "--validation_max_iter",
          help="Number of validation batches to run",
          type=int,
          default=1,
      )
  
      parser.add_argument(
          "--exclude_fraction_for_validation",
          help="Fraction of dataset to use for validation",
          type=float,
          default=0.0,
      )
  
      parser.add_argument(
          "--exclude_fraction_for_inference",
          help="Fraction of dataset to use for inference",
          type=float,
          default=0.0,
      )
  
      parser.add_argument(
          "--vars_to_restore",
          help="regex strings matching variable names to restore",
          type=str,
          default="",
      )
  
      parser.add_argument(
          "--vars_to_freeze",
          help="regex strings matching variable to be fixed during training",
          type=str,
          default="",
      )
  
      parser.add_argument(
          "--patience",
          metavar="",
          help="Number of iterations to wait before starting "
          "performance monitoring",
          type=int,
          default=100,
      )
  
      parser.add_argument(
          "--early_stopping_mode",
          metavar="",
          help="Choose between {'mean', 'robust_mean', 'median', "
          "'generalisation_loss', 'median_smoothing', 'validation_up'}",
          type=str,
          default="mean",
      )
  
      return parser
  
file_path: NiftyNet/niftynet/utilities/user_parameters_default.py
imports: from __future__ import absolute_import, division, print_function, unicode_literals
  import os
  from niftynet.engine.image_window_dataset import SMALLER_FINAL_BATCH_MODE
  from niftynet.io.image_loader import SUPPORTED_LOADERS
  from niftynet.io.image_sets_partitioner import SUPPORTED_PHASES
  from niftynet.utilities.user_parameters_helper import float_array, int_array, spatial_atleast3d, spatialnumarray, str2boolean, str_array
  from niftynet.utilities.util_import import require_module
label_desc: Use image node_id 6 for calling a global function with example usage: add_training_args(parser) and returns: parser