def parse_command_line_parameters(parser):      
    """
    @brief  Parses the command line parameters provided by the user and makes 
            sure that mandatory parameters are present.
    @param[in]  parser  argparse.ArgumentParser
    @returns an object with the parsed arguments. 
    """
    msg = {
        '--input-dir':  'Path to the input folder.',
        '--output-dir': 'Path to the output folder.',
        '--im-ext':     """Extension of the image files inside the input 
                           folder. Typically '.jpg'""",
        '--seg-suffix': """Suffix of the segmentation files. For example, if 
                           an input image is called image.jpg, and the 
                           corresponding segmentation is image_seg.png,
                           then the suffix is '_seg'.""",
        '--seg-ext':    """Extension of the segmentation mask files. 
                           Typically '.png'""",
        '--max-inst':  'Maximum number of instruments present in the image.',
        '--max-tips':   'Maximum number of instruments present in the image.',
    }
    parser.add_argument('--input-dir', required=True, help=msg['--input-dir'])
    parser.add_argument('--output-dir', required=True, help=msg['--output-dir'])
    parser.add_argument('--im-ext', required=False, default='.jpg', help=msg['--im-ext'])
    parser.add_argument('--seg-suffix', required=False, default='_seg', 
        help=msg['--seg-suffix'])
    parser.add_argument('--seg-ext', required=False, default='.png', help=msg['--seg-ext'])
    parser.add_argument('--max-inst', required=True, help=msg['--max-inst'])
    parser.add_argument('--max-tips', required=True, help=msg['--max-tips'])
    
    args = parser.parse_args()
    args.max_inst = int(args.max_inst)
    args.max_tips = int(args.max_tips)
    return args