Checkpoint

This commit is contained in:
Emanuele Bezzi
2021-12-05 12:58:21 -05:00
parent db0f50d011
commit b1ff638879
4 changed files with 76 additions and 19 deletions
+3 -1
View File
@@ -4,6 +4,7 @@ import sys
from http import HTTPStatus
import zlib
import json
import numpy as np
from flask import make_response, jsonify, current_app, abort, send_file
from werkzeug.urls import url_unquote
@@ -419,7 +420,8 @@ def spatial_image_get(request, data_adaptor):
return abort_and_log(HTTPStatus.BAD_REQUEST, f"spatial information does not contain requested resolution '{resolution}'")
response_image = io.BytesIO()
matplotlib.pyplot.imsave(response_image, spatial[library_id]["images"][resolution])
img = np.flipud(spatial[library_id]["images"][resolution])
matplotlib.pyplot.imsave(response_image, img)
response_image.seek(0)
try:
+4
View File
@@ -361,6 +361,8 @@ class DataAdaptor(metaclass=ABCMeta):
translate = 0.5 - ((max - min) / scale / 2)
normalized_layout = normalized_layout + translate
print(f"scale {scale}, translate {translate}")
normalized_layout = normalized_layout.astype(dtype=np.float32)
return normalized_layout
@@ -388,6 +390,8 @@ class DataAdaptor(metaclass=ABCMeta):
df = pd.concat(layout_data, axis=1, copy=False)
else:
df = pd.DataFrame()
# print("##########DF")
# print(df)
fbs = encode_matrix_fbs(df, col_idx=df.columns, row_idx=None)
return fbs