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
      logger.info("Loading image {}...".format(args.input))
      image_labels_data, _ = load(args.image)
  
      # load mask image
      logger.info("Loading mask {}...".format(args.mask))
      image_mask_data, image_mask_data_header = load(args.mask)
  
      # check if output image exists
      if not args.force:
          if os.path.exists(args.output):
              logger.warning(
                  "The output image {} already exists. Skipping this image.".format(
                      args.output
                  )
              )
  
      # create a mask from the label image
      logger.info("Reducing the label image...")
      image_reduced_data = fit_labels_to_mask(
          image_labels_data, image_mask_data
      )
  
      # save resulting mask
      logger.info(
          "Saving resulting mask as {} in the same format as input mask, only with data-type int8...".format(
              args.output
          )
      )
      image_reduced_data = image_reduced_data.astype(
          numpy.bool_, copy=False
      )  # bool sadly not recognized
      save(
          image_reduced_data,
          args.output,
          image_mask_data_header,
          args.force,
      )
  
      logger.info("Successfully terminated.")
  
file_path: medpy/bin/medpy_label_fit_to_mask.py
imports: import argparse
  import logging
  import os
  import numpy
  from medpy.io import load, save
  from medpy.core import Logger
  from medpy.filter import fit_labels_to_mask
label_desc: Use image node_id 1 for calling a global function with example usage: main() without return types