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)
  
      # check if output image exists (will also be performed before saving, but as the smoothing might be very time intensity, a initial check can save frustration)
      if not args.force:
          if os.path.exists(args.output1):
              raise parser.error(
                  "The output image {} already exists.".format(
                      args.output1
                  )
              )
          if os.path.exists(args.output2):
              raise parser.error(
                  "The output image {} already exists.".format(
                      args.output2
                  )
              )
  
      # loading images
      data_input1, header_input1 = load(args.input1)
      data_input2, header_input2 = load(args.input2)
      logger.debug(
          "Original image sizes are {} and {}.".format(
              data_input1.shape, data_input2.shape
          )
      )
  
      # compute intersection volumes (punch)
      logger.info("Computing the intersection.")
      inters1, inters2, new_offset = intersection(
          data_input1, header_input1, data_input2, header_input2
      )
      logger.debug(
          "Punched images are of sizes {} and {} with new offset {}.".format(
              inters1.shape, inters2.shape, new_offset
          )
      )
  
      # check if any intersection could be found at all
      if 0 == inters1.size:
          logger.warning(
              "No intersection could be found between the images. Please check their meta-data e.g. with medpy_info"
          )
  
      # update header informations
      header.set_offset(header_input1, new_offset)
      header.set_offset(header_input2, new_offset)
  
      # save punched images
      save(inters1, args.output1, header_input1, args.force)
      save(inters2, args.output2, header_input2, args.force)
  
      logger.info("Successfully terminated.")
  
file_path: medpy/bin/medpy_intersection.py
imports: import argparse
  import logging
  import os
  from medpy.io import load, save, header
  from medpy.core import Logger
  from medpy.filter.utilities import intersection
label_desc: Use image node_id 1 for calling a global function with example usage: main() without return types