code: def add_network_args(parser):
      """
      keywords defined for network specification
  
      :param parser:
      :return:
      """
      import niftynet.layer.binary_masking
      import niftynet.layer.activation
      import niftynet.utilities.histogram_standardisation as hist_std_module
  
      parser.add_argument(
          "--name",
          help="Choose a net from NiftyNet/niftynet/network/ or from "
          "user specified module string",
          metavar="",
      )
  
      parser.add_argument(
          "--activation_function",
          help="Specify activation function types",
          choices=list(niftynet.layer.activation.SUPPORTED_OP),
          metavar="TYPE_STR",
          default="relu",
      )
  
      parser.add_argument(
          "--batch_size",
          metavar="",
          help="Set batch size of the net",
          type=int,
          default=2,
      )
  
      parser.add_argument(
          "--smaller_final_batch_mode",
          metavar="TYPE_STR",
          help="If True, allow the final batch to be smaller "
          "if there are insufficient items left in the queue, "
          "and the batch size will be undetermined during "
          "graph construction.",
          choices=list(SMALLER_FINAL_BATCH_MODE),
          default="pad",
      )
  
      parser.add_argument(
          "--decay",
          help="[Training only] Set weight decay",
          type=float,
          default=0.0,
      )
  
      parser.add_argument(
          "--reg_type",
          metavar="TYPE_STR",
          help="[Training only] Specify regulariser type_str",
          type=str,
          default="L2",
      )
  
      parser.add_argument(
          "--volume_padding_size",
          metavar="",
          help="Set padding size of each volume (in all dimensions)",
          type=spatialnumarray,
          default=(0, 0, 0),
      )
  
      parser.add_argument(
          "--volume_padding_mode",
          metavar="",
          help="Set which type of numpy padding to do, see "
          "https://docs.scipy.org/doc/numpy-1.14.0/"
          "reference/generated/numpy.pad.html "
          "for details",
          type=str,
          default="minimum",
      )
  
      parser.add_argument(
          "--volume_padding_to_size",
          help="Choose size to pad all input volumes to. Any dimensions "
          "that exceed the desired size will be kept the same. Default: "
          "(0, ) which indicates not to use this mode. ",
          type=spatialnumarray,
          default=(0,),
      )
  
      parser.add_argument(
          "--window_sampling",
          metavar="TYPE_STR",
          help="How to sample patches from each loaded image:"
          " 'uniform': fixed size uniformly distributed,"
          " 'resize': resize image to the patch size.",
          choices=[
              "uniform",
              "resize",
              "balanced",
              "weighted",
              "patch",
          ],
          default="uniform",
      )
  
      parser.add_argument(
          "--force_output_identity_resizing",
          metavar=str2boolean,
          help="Forces the shape of the inferred output to match the "
          "input label shape rather than be resized to input image shape.",
          default=False,
      )
  
      parser.add_argument(
          "--queue_length",
          help="Set size of preprocessing buffer queue",
          metavar="",
          type=int,
          default=5,
      )
  
      parser.add_argument(
          "--multimod_foreground_type",
          choices=list(
              niftynet.layer.binary_masking.SUPPORTED_MULTIMOD_MASK_TYPES
          ),
          help="Way of combining the foreground masks from different "
          "modalities. 'and' is the intersection, 'or' is the union "
          "and 'multi' permits each modality to use its own mask.",
          default="and",
      )
  
      parser.add_argument(
          "--histogram_ref_file",
          metavar="",
          type=str,
          help="A reference file of histogram for intensity normalisation",
          default=DEFAULT_HISTOGRAM_REF_FILE,
      )
  
      parser.add_argument(
          "--norm_type",
          help="Type of normalisation to perform",
          type=str,
          default="percentile",
          choices=list(hist_std_module.SUPPORTED_CUTPOINTS),
      )
  
      parser.add_argument(
          "--cutoff",
          help="Cutoff values for the normalisation process",
          type=float_array,
          default=(0.01, 0.99),
      )
  
      parser.add_argument(
          "--foreground_type",
          choices=list(
              niftynet.layer.binary_masking.SUPPORTED_MASK_TYPES
          ),
          help="type_str of foreground masking strategy used",
          default="otsu_plus",
      )
  
      parser.add_argument(
          "--normalisation",
          help="Indicates if the normalisation must be performed",
          type=str2boolean,
          default=False,
      )
  
      parser.add_argument(
          "--rgb_normalisation",
          help="Indicates if RGB histogram equilisation should be performed",
          type=str2boolean,
          default=False,
      )
  
      parser.add_argument(
          "--whitening",
          help="Indicates if the whitening of the data should be applied",
          type=str2boolean,
          default=False,
      )
  
      parser.add_argument(
          "--normalise_foreground_only",
          help="Indicates whether a foreground mask should be applied when"
          " normalising volumes",
          type=str2boolean,
          default=False,
      )
  
      parser.add_argument(
          "--weight_initializer",
          help="Set the initializer for the weight parameters",
          type=str,
          default="he_normal",
      )
  
      parser.add_argument(
          "--bias_initializer",
          help="Set the initializer for the bias parameters",
          type=str,
          default="zeros",
      )
  
      parser.add_argument(
          "--keep_prob",
          help="Probability that each element is kept "
          "if dropout is supported by the network",
          type=float,
          default=1.0,
      )
  
      yaml = require_module("yaml", mandatory=False)
      if yaml:
          parser.add_argument(
              "--weight_initializer_args",
              help="Pass arguments to the initializer for the weight parameters",
              type=yaml.load,
              default={},
          )
          parser.add_argument(
              "--bias_initializer_args",
              help="Pass arguments to the initializer for the bias parameters",
              type=yaml.load,
              default={},
          )
  
      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 5 for calling a global function with example usage: add_network_args(parser) and returns: parser