code: def main():
      # parse cmd arguments
      parser = getParser()
      parser.parse_args()
      args = getArguments(parser)
  
      # prepare logger
      logger = Logger.getInstance()
      if args.debug:
          logger.setLevel(logging.DEBUG)
      elif args.verbose:
          logger.setLevel(logging.INFO)
  
      # load first image as result image
      logger.info("Loading {}...".format(args.images[0]))
      result_data, result_header = load(args.images[0])
  
      # check dimension argument
      if args.dimension >= result_data.ndim:
          raise argparse.ArgumentError(
              "The supplied stack-dimension {} exceeds the image dimensionality of 0 to {}.".format(
                  args.dimension, result_data.ndim - 1
              )
          )
  
      # reduce the image dimensions
      if args.zero and result_data.all():
          result_data = numpy.zeros(
              result_data.shape, result_data.dtype
          )
  
      # iterate over remaining images and concatenate
      for image_name in args.images[1:]:
          logger.info("Loading {}...".format(image_name))
          image_data, _ = load(image_name)
  
          # change to zero matrix if requested
          if args.zero and image_data.all():
              image_data = numpy.zeros(
                  image_data.shape, image_data.dtype
              )
  
          # concatenate
          if args.reversed:
              result_data = numpy.concatenate(
                  (image_data, result_data), args.dimension
              )
          else:
              result_data = numpy.concatenate(
                  (result_data, image_data), args.dimension
              )
  
      logger.debug(
          "Final image is of shape {}.".format(result_data.shape)
      )
  
      # save results in same format as input image
      logger.info(
          "Saving concatenated image as {}...".format(args.output)
      )
  
      save(result_data, args.output, result_header, args.force)
  
      logger.info("Successfully terminated.")
  
file_path: medpy/bin/medpy_stack_sub_volumes.py
imports: from argparse import RawTextHelpFormatter
  import argparse
  import logging
  import numpy
  from medpy.core import Logger
  from medpy.io import load, save
label_desc: Use image node_id 1 for calling a global function with example usage: main() without return types