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 input image
      data_input, header_input = load(args.input)
  
      # check if the supplied dimension is valid
      if args.dimension >= data_input.ndim or args.dimension < 0:
          raise ArgumentError(
              "The supplied cut-dimension {} exceeds the image dimensionality of 0 to {}.".format(
                  args.dimension, data_input.ndim - 1
              )
          )
  
      # prepare output file string
      name_output = args.output.replace("{}", "{:03d}")
  
      # compute the new the voxel spacing
      spacing = list(header.get_pixel_spacing(header_input))
      del spacing[args.dimension]
  
      # iterate over the cut dimension
      slices = data_input.ndim * [slice(None)]
      for idx in range(data_input.shape[args.dimension]):
          # cut the current slice from the original image
          slices[args.dimension] = slice(idx, idx + 1)
          data_output = scipy.squeeze(data_input[slices])
          # update the header and set the voxel spacing
          header_input.set_voxel_spacing(spacing)
          # save current slice
          save(
              data_output,
              name_output.format(idx),
              header_input,
              args.force,
          )
  
      logger.info("Successfully terminated.")
  
file_path: medpy/bin/medpy_split_xd_to_xminus1d.py
imports: import argparse
  import logging
  import scipy
  from medpy.io import load, save, header
  from medpy.core import Logger
  from medpy.core.exceptions import ArgumentError
label_desc: Use image node_id 1 for calling a global function with example usage: main() without return types