文档服务地址:http://47.92.0.57:3000/ 周报索引地址:http://47.92.0.57:3000/s/NruNXRYmV

Commit b94623d7 by convivae

image

parent 9b81eec9
from flask import Flask
from flask_cors import CORS
from dao import Image
# from views.uploadDownload import uploadDownload
# from views.textAnnotation import textAnnotation
from views.user import user
from views.task import task
from views.slice import slice
from views.imageAnnotation import image
from config.config import DevelopmentConfig
app = Flask(__name__)
CORS(app)
app.config.from_object(DevelopmentConfig)
Image.db.init_app(app)
# app.register_blueprint(textAnnotation)
# app.register_blueprint(uploadDownload)
app.register_blueprint(user)
app.register_blueprint(task)
app.register_blueprint(slice)
app.register_blueprint(image)
if __name__ == '__main__':
app.run(debug=True, host='127.0.0.1', port=9100)
# 配置文件
import os
class DevelopmentConfig(object):
"""Base config class."""
# Flask app config
DEBUG = False
TESTING = False
SECRET_KEY = "sample_key"
# Root path of project
PROJECT_PATH = os.path.abspath(os.path.join(os.path.dirname(__file__), '..'))
# MongoEngine config
MONGODB_SETTINGS = {
"db": "test",
'host': 'localhost',
'port': 27017
}
......@@ -48,6 +48,8 @@ fastcache==1.0.2
filelock==3.0.8
Flask==1.0.2
Flask-Cors==3.0.8
flask-mongoengine==0.9.5
Flask-WTF==0.14.3
gevent==1.3.6
glob2==0.6
greenlet==0.4.15
......@@ -92,6 +94,7 @@ menuinst==1.4.14
mistune==0.8.3
mkl-fft==1.0.4
mkl-random==1.0.1
mongoengine==0.20.0
more-itertools==4.3.0
mpmath==1.0.0
msgpack==0.5.6
......@@ -143,6 +146,7 @@ pycurl==7.43.0.2
pyflakes==2.0.0
Pygments==2.2.0
pylint==2.1.1
pymongo==3.10.1
PyMySQL==0.9.3
pyodbc==4.0.24
pyOpenSSL==18.0.0
......@@ -206,6 +210,7 @@ win-inet-pton==1.0.1
win-unicode-console==0.5
wincertstore==0.2
wrapt==1.10.11
WTForms==2.3.1
xlrd==1.1.0
XlsxWriter==1.1.0
xlwings==0.11.8
......
import json
from flask import Blueprint
from flask import request
from flask import Blueprint, jsonify, request
from ..Dao import Image
from dao import Image
image = Blueprint("image", __name__, url_prefix="")
# 获取图片
@image.route("/image", methods=["GET"])
def get_image():
relation_list = request.args.get('relationList')
data = json.loads(request.data)
relation_list = data['relationList']
image = Image.getImage(relation_list)
res = {
'code': image.code,
......@@ -19,9 +20,11 @@ def get_image():
return json.dumps(res)
# 保存图片标注结果
@image.route("/image", methods=["POST"])
def save_image():
image_list = request.args.get('imageList')
data = json.loads(request.data)
image_list = data['imageList']
ret = Image.saveImage(image_list)
res = {
'code': ret.code,
......@@ -31,23 +34,27 @@ def save_image():
return json.dumps(res)
# 获取图层
@image.route("/layer", methods=["GET"])
def get_fragment():
relation_list = request.args.get('relationList')
fragment = Image.getFragment(relation_list)
def get_layer():
data = json.loads(request.data)
relation_list = data['relationList']
layer = Image.getLayer(relation_list)
res = {
'code': fragment.code,
'message': fragment.message,
'data': fragment.data
'code': layer.code,
'message': layer.message,
'data': layer.data
}
return json.dumps(res)
# 保存图层标注结果
@image.route("/layer", methods=["POST"])
def save_fragment():
fragment_list = request.args.get('layerList')
mark_list = request.args.get['markList']
ret = Image.saveFragment(fragment_list, mark_list)
def save_layer():
data = json.loads(request.data)
layer_list = data['layerList']
landmark_list = data['landmarkList']
ret = Image.saveLayer(layer_list, landmark_list)
res = {
'code': ret.code,
'message': ret.message,
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment