From b048bbfd0c0f7db8080c64aa04d9256304fbb21d Mon Sep 17 00:00:00 2001 From: Emanuele Bezzi Date: Mon, 6 Dec 2021 14:57:10 -0500 Subject: [PATCH] Checkpoint --- client/src/components/graph/drawSpatialImageRegl.js | 9 +++++---- client/src/components/graph/graph.js | 2 ++ server/common/rest.py | 2 +- server/data_common/data_adaptor.py | 5 ++++- 4 files changed, 12 insertions(+), 6 deletions(-) diff --git a/client/src/components/graph/drawSpatialImageRegl.js b/client/src/components/graph/drawSpatialImageRegl.js index 6779a2a3..3046184a 100644 --- a/client/src/components/graph/drawSpatialImageRegl.js +++ b/client/src/components/graph/drawSpatialImageRegl.js @@ -56,15 +56,15 @@ export default function drawSpatialImageRegl(regl) { a_position: [ 0, 0, - 0 + 2000, + 0 + 1921, 0, 0, 0 + 2000, 0, 0 + 2000, - 0 + 2000, + 0 + 1921, 0, - 0 + 2000, + 0 + 1921, 0 + 2000, ], }, @@ -73,7 +73,8 @@ export default function drawSpatialImageRegl(regl) { projView: regl.prop("projView"), u_image: regl.prop("spatialImageAsTexture"), color: [1, 0, 0, 1], - u_resolution: [2000, 2000], + u_resolution: [1921, 2000], + // translate: }, count: 6, diff --git a/client/src/components/graph/graph.js b/client/src/components/graph/graph.js index 58d78406..43923c04 100644 --- a/client/src/components/graph/graph.js +++ b/client/src/components/graph/graph.js @@ -122,6 +122,7 @@ class Graph extends React.Component { positions[2 * i] = p[0]; positions[2 * i + 1] = p[1]; } + console.log({ transformed: positions }); return positions; }); @@ -759,6 +760,7 @@ class Graph extends React.Component { const { positions, colors, flags, height, width } = asyncProps; this.cachedAsyncProps = asyncProps; const { pointBuffer, colorBuffer, flagBuffer } = this.state; + console.log({ pos2: positions }); let needToRenderCanvas = false; if (height !== prevAsyncProps?.height || width !== prevAsyncProps?.width) { diff --git a/server/common/rest.py b/server/common/rest.py index a0fd965a..76b8d769 100644 --- a/server/common/rest.py +++ b/server/common/rest.py @@ -420,7 +420,7 @@ 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() - img = np.flipud(spatial[library_id]["images"][resolution]) + img = spatial[library_id]["images"][resolution] matplotlib.pyplot.imsave(response_image, img) response_image.seek(0) diff --git a/server/data_common/data_adaptor.py b/server/data_common/data_adaptor.py index 71feb1bc..90e07dea 100644 --- a/server/data_common/data_adaptor.py +++ b/server/data_common/data_adaptor.py @@ -363,7 +363,10 @@ class DataAdaptor(metaclass=ABCMeta): print(f"scale {scale}, translate {translate}") - normalized_layout = normalized_layout.astype(dtype=np.float32) + A = embedding * 0.17011142 + A = np.column_stack([A[:, 0] / 1921, A[:, 1] / 2000]) + + normalized_layout = A.astype(dtype=np.float32) return normalized_layout def layout_to_fbs_matrix(self, fields):