docs: def getParser():
      "Creates and returns the argparse parser object."
      # text
      epilog ="""
  examples:
    %(prog)s -e example.nii grid.nii 10
        Generates an empty image with the same attributes as example.nii, overlays it
        with a regular grid of width 10 voxels and saves it as grid.nii.
    %(prog)s -e example.nii grid.nii 10,11,12 -r
        Same as above, but with an irregular grid and using real world coordinates
        (i.e. taking the voxel spacing of the image into account).
    %(prog)s -s 100,200 grid.nii 10,2 -p 0.5,3 
        Generates a 10x2 spaced grid in a 100x200 image with a voxel spacing of 0.5x3.
    %(prog)s -s 100,100,50 grid.nii 5,5,0 
        Generates a 100x100x50 3D volume but fills it only with a regular 5x5 2D grid
        over the first two dimensions.  
  """
      
      # command line argument parser
      parser = argparse.ArgumentParser(formatter_class=argparse.RawDescriptionHelpFormatter, 
                                       description=__description__, epilog=epilog)
      parser.add_argument('output', help='Generated grid volume.')
      parser.add_argument('spacing', type=list_of_integers_or_int, help='The grid spacing. Can be a single digit for regular spacing in all dimensions or a colon-separated list of N integers, where N is the number of dimension in the generated volume. To skip the grid in one dimension, simply supply a 0 for it.')
      
      group = parser.add_mutually_exclusive_group(required=True)
      group.add_argument('-e', '--example', dest='example', help='Option 1/2: Supply an image to create the grid volume by example (i.e. with same shape, voxel spacing and offset).')
      group.add_argument('-s', '--shape', type=list_of_integers, dest='shape', help='Option 2/2: Supply a colon-separated list of integers that constitute the target volumes shape.')
      
      parser.add_argument('-p', '--pixel-spacing', type=list_of_floats, dest='pixelspacing', help='Set the pixel spacing of the target volume by supplying a colon-separated list of N numbers, where N is the number of dimension in the generated volume.')
      parser.add_argument('-o', '--offset', type=list_of_floats, dest='offset', help='Set offset of the target volume by supplying a colon-separated list of N numbers, where N is the number of dimension in the generated volume.')
  
      parser.add_argument('-r', '--real', dest='real', action='store_true', help='Spacing is given in real world coordinates, rather than voxels. For this to make a difference, either the -e switch or the -p switch must be set.')
      
      parser.add_argument('-v', dest='verbose', action='store_true', help='Display more information.')
      parser.add_argument('-d', dest='debug', action='store_true', help='Display debug information.')
      parser.add_argument('-f', '--force', dest='force', action='store_true', help='Silently override existing output images.')
      return parser