Skip to content

Commit f427b41

Browse files
committed
NGPre WASM tile source: assume we only deal with a single channel
Therefore, the size of a block is now reported as an array of the form [x, y, z], including no channel information anymore. Having a 4D array as size, lead to different problems in the front-end.
1 parent 956b141 commit f427b41

File tree

2 files changed

+8
-4
lines changed

2 files changed

+8
-4
lines changed

django/applications/catmaid/static/js/tile-source.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -754,7 +754,7 @@
754754
.then(block => {
755755
if (block) {
756756
let etag = block.get_etag();
757-
let size = block.get_size(); // [x, y, z, channel]
757+
let size = block.get_size(); // [x, y, z]
758758
let n = 1;
759759
let stride = size.map(s => { let rn = n; n *= s; return rn; });
760760
return {
@@ -1195,7 +1195,7 @@
11951195
block = block_data[i];
11961196
if (block) {
11971197
let etag = block.get_etag();
1198-
let size = block.get_size(); // [x, y, z, channel]
1198+
let size = block.get_size(); // [x, y, z]
11991199
let gridPosition = block.get_grid_position();
12001200
let n = 1;
12011201
let stride = size.map(s => { let rn = n; n *= s; return rn; });

django/applications/catmaid/static/libs/ngpre-wasm/ngpre_wasm_worker.js

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,9 @@ onmessage = function(e) {
4040
// transferrable and therefore zero-copy.
4141
loadedBlocks.push({
4242
etag: block.get_etag(),
43-
size: block.get_size(),
43+
// We receive [x, y, z, ch] as size and expect only a single
44+
// channel at the moment.
45+
size: block.get_size().slice(0, 3),
4446
gridPosition: block.get_grid_position(),
4547
// Needs to be last, due to the block being consumed (into)
4648
data: block.into_data(),
@@ -118,7 +120,9 @@ onmessage = function(e) {
118120
// transferrable and therefore zero-copy.
119121
let desBlock = {
120122
etag: block.get_etag(),
121-
size: block.get_size(),
123+
// We receive [x, y, z, ch] as size and expect only a single
124+
// channel at the moment.
125+
size: block.get_size().slice(0, 3),
122126
data: block.into_data(),
123127
};
124128
postMessage([messageId, desBlock], [desBlock.data.buffer]);

0 commit comments

Comments
 (0)