def get_image_ids(roi_seg, args):
    """Get the image ids to which ROIs will be attached
    
    :param roi_seg: an ROI segmentation object
    :type roi_seg: ``sfftkplus.formats.roi.ROISegmentation``
    :param args: command line arguments
    :type args: ``argparse.Namespace``
    :return dict image_ids: dictionary of image ids index by orientation ('x', 'y', 'z')  
    """
    image_ids = dict()
    if args.x_image_id or args.y_image_id or args.z_image_id:
        if args.x_image_id:
            image_ids['x'] = args.x_image_id
        if args.y_image_id:
            image_ids['y'] = args.y_image_id
        if args.z_image_id:
            image_ids['z'] = args.z_image_id
    else:  # check for image_ids in the roi file
        image_ids['x'] = roi_seg.header.front_id
        image_ids['y'] = roi_seg.header.right_id
        image_ids['z'] = roi_seg.header.top_id
    #  make sure we have some image_ids to use
    if len(image_ids) == 0:
        raise ValueError("No image identifiers specified. Aborting...")
    return image_ids