|
207 | 207 |
|
208 | 208 | // Convert screen coordinates to voxel coordinates. Convert voxel |
209 | 209 | // coordinates into block coordinates. |
| 210 | + let zoom = this.stackViewer.s; |
210 | 211 | const screenPosition = this.stackViewer.screenPosition(); |
211 | | - const voxelPosX = screenPosition.left + |
212 | | - x / this.stackViewer.scale / this.stackViewer.primaryStack.anisotropy(0).x; |
213 | | - const voxelPosY = screenPosition.top + |
214 | | - y / this.stackViewer.scale / this.stackViewer.primaryStack.anisotropy(0).y; |
| 212 | + const voxelPosX = (screenPosition.left + |
| 213 | + x * Math.pow(2, zoom) / this.stackViewer.primaryStack.anisotropy(0).x) / Math.pow(2, zoom); |
| 214 | + const voxelPosY = (screenPosition.top + |
| 215 | + y * Math.pow(2, zoom) / this.stackViewer.primaryStack.anisotropy(0).y) / Math.pow(2, zoom); |
215 | 216 | const voxelPosZ = this.stackViewer.z; |
216 | 217 |
|
217 | | - const datasetSize = activeWritableStack.metadata.dataset_size; |
218 | | - if (!datasetSize) { |
219 | | - throw new CATMAID.ValueError('Need writable stacke metadata field: dataset_size'); |
220 | | - } |
221 | | - |
222 | | - let zoom = this.stackViewer.s; |
223 | 218 | var mag = 1.0; |
224 | 219 |
|
225 | 220 | //var anisotropy = this.dataLayer.stack.anisotropy(zoom); |
|
255 | 250 | } |
256 | 251 | } |
257 | 252 |
|
258 | | - // TODO: Maybe better get from active writable stack? |
259 | | - const blockSize = this.dataLayer.tileSource.blockSize(this.stackViewer.s); |
| 253 | + // Use meta data from data layer, because it actually shows the |
| 254 | + // server-side N5 file. |
260 | 255 | const dataType = this.dataLayer.tileSource.dataType(); |
| 256 | + const blockSize = this.dataLayer.tileSource.blockSize(this.stackViewer.s); |
| 257 | + const blockCoordBounds = this.dataLayer.tileSource.blockCoordBounds(zoom); |
| 258 | + // The +1 is needed, because the bounds are inclusice. |
| 259 | + const datasetSize = [ |
| 260 | + (blockCoordBounds.max[0] - blockCoordBounds.min[0] + 1) * blockSize[0], |
| 261 | + (blockCoordBounds.max[1] - blockCoordBounds.min[1] + 1) * blockSize[1], |
| 262 | + (blockCoordBounds.max[2] - blockCoordBounds.min[2] + 1) * blockSize[2], |
| 263 | + ]; |
261 | 264 | const blockShape = [ |
262 | 265 | datasetSize[0] / blockSize[0], |
263 | 266 | datasetSize[1] / blockSize[1], |
|
300 | 303 | method: 'POST', |
301 | 304 | parallel: true, |
302 | 305 | data: { |
303 | | - // TODO: Allow other scale levels |
304 | | - scale_level: 0, |
| 306 | + scale_level: bS, |
305 | 307 | //compression: 'raw', |
306 | 308 | //data: mostRecentBlock.tolist().join(','), |
307 | 309 | compression: 'msgpack', |
|
0 commit comments