@html.route('/<project_name>/<image_name>/annotation', methods=['GET'])
def annotation(project_name, image_name):
    project = Project.query.filter_by(name=project_name).first()
    if (not project):
        return render_template('error.html')
    image = db.session.query(Image.id, Image.projId, Image.name, Image.path, Image.height, Image.width, Image.date, Image.rois, Image.make_patches_time, Image.nobjects, db.func.count(Roi.id).label('nROIs'), (db.func.count(Roi.id) - db.func.ifnull(db.func.sum(Roi.testingROI), 0)).label('nTrainingROIs')).outerjoin(Roi, (Roi.imageId == Image.id)).filter((Image.name == image_name)).filter((Image.projId == project.id)).group_by(Image.id).first()
    x = request.args.get('startX', '#')
    y = request.args.get('startY', '#')
    defaultCropSize = config.getint('common', 'patchsize', fallback=256)
    return render_template('annotation.html', project=project, image=image, startX=x, startY=y, defaultCropSize=defaultCropSize)
@html.route('/<project_name>/<image_name>/annotation', methods=['GET'])
def annotation(project_name, image_name):
    project = Project.query.filter_by(name=project_name).first()
    if (not project):
        return render_template('error.html')
    image = db.session.query(Image.id, Image.projId, Image.name, Image.path, Image.height, Image.width, Image.date, Image.rois, Image.make_patches_time, Image.nobjects, db.func.count(Roi.id).label('nROIs'), (db.func.count(Roi.id) - db.func.ifnull(db.func.sum(Roi.testingROI), 0)).label('nTrainingROIs')).outerjoin(Roi, (Roi.imageId == Image.id)).filter((Image.name == image_name)).filter((Image.projId == project.id)).group_by(Image.id).first()
    x = request.args.get('startX', '#')
    y = request.args.get('startY', '#')
    defaultCropSize = config.getint('common', 'patchsize', fallback=256)
    return render_template('annotation.html', project=project, image=image, startX=x, startY=y, defaultCropSize=defaultCropSize)