aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorcs3099group-be-42018-04-26 09:19:19 +0100
committercs3099group-be-42018-04-26 09:19:19 +0100
commit7896690dd7ec8cbe7c5a24ce132add13871a163a (patch)
tree6a5dafc5886addd0d6a896efd21f3953afbde7fd /src
parentadding additional options for file mimetype for scalable_image (diff)
downloadmedicine-7896690dd7ec8cbe7c5a24ce132add13871a163a.tar.gz
medicine-7896690dd7ec8cbe7c5a24ce132add13871a163a.zip

Fix critical live image tile serving bug

Diffstat (limited to 'src')
-rw-r--r--src/conversion/czi/pyramidWorker.ts6
-rw-r--r--src/conversion/types/helpers.ts14
2 files changed, 10 insertions, 10 deletions
diff --git a/src/conversion/czi/pyramidWorker.ts b/src/conversion/czi/pyramidWorker.ts
index 7adb747..00cb8b4 100644
--- a/src/conversion/czi/pyramidWorker.ts
+++ b/src/conversion/czi/pyramidWorker.ts
@@ -43,7 +43,7 @@ const findRelatedTiles: Function = function(plane: CZIHeightMap, desired: TileBo
};
export const getTile: Function = async function(imageDir: string, cVal: string, x:number = 0, y:number = 0, w:number = 1024, h:number = 1024, zoom: number = 1): Promise<CZITileRequest> {
- log = logger.for({component: "CZI Live Server", req: {imageDir: imageDir, cVal: cVal, x:x = 0, y:y = 0, w:w, h:h, zoom: zoom}});
+ log = logger.for({component: "CZI Live Server", req: {imageDir: imageDir, cVal: cVal, x:x, y:y, w:w, h:h, zoom: zoom}});
let layout: WholeCZIHierarchy = JSON.parse(await jobQueue.enqueue(2, readFile, null, imageDir + "layout.json", 'utf8'));
if (!layout.complete) {
@@ -85,7 +85,7 @@ const getFinalTile: Function = async function(imageDir: string, imageTier: CZIHe
let outputFileName: string = `${imageDir}tmp/${id}-out.png`
try {
await new Promise((res) => {
- shell.exec(`${execpaths} vips arrayjoin "${involvedTiles}" ${intermediateFileName} --across ${imageTier.plane[0].length} --vips-concurrency=2`);
+ shell.exec(`${execpaths} vips arrayjoin "${involvedTiles}" ${intermediateFileName} --across ${relatedTiles[0].length} --vips-concurrency=2`);
res();
});
} catch (err) {
@@ -118,7 +118,7 @@ const getFinalTile: Function = async function(imageDir: string, imageTier: CZIHe
}
})
- log.info(`Gen new Tile: ${outputFileName} X:${desiredRegion.left} Y:${desiredRegion.top} W:${desiredRegion.width()} H:${desiredRegion.height()} Z:${cVal}`);
+ log.debug(`Gen new Tile: X:${desiredRegion.left} Y:${desiredRegion.top} W:${desiredRegion.width()} H:${desiredRegion.height()} Z:${cVal}`);
return {
dimensions: new TileBounds(
0, extractionRegion.width(),
diff --git a/src/conversion/types/helpers.ts b/src/conversion/types/helpers.ts
index 4621bf6..6fd3be0 100644
--- a/src/conversion/types/helpers.ts
+++ b/src/conversion/types/helpers.ts
@@ -58,16 +58,16 @@ export class TileBounds {
return this.bottom - this.top;
}
public scaleDown(level: number) {
- this.left = Math.ceil(this.left / level),
- this.right = Math.ceil(this.right / level),
- this.top = Math.ceil(this.top / level),
- this.bottom = Math.ceil(this.bottom / level)
+ this.left = Math.floor(this.left / level),
+ this.right = Math.floor(this.right / level),
+ this.top = Math.floor(this.top / level),
+ this.bottom = Math.floor(this.bottom / level)
}
public scaleUp(level: number) {
this.left = Math.floor(this.left * level),
- this.right = Math.ceil(this.right * level),
- this.top = Math.ceil(this.top * level),
- this.bottom = Math.ceil(this.bottom * level)
+ this.right = Math.floor(this.right * level),
+ this.top = Math.floor(this.top * level),
+ this.bottom = Math.floor(this.bottom * level)
}
}