From 426befe551d563f7394f67e9053705a2bdd21126 Mon Sep 17 00:00:00 2001 From: cjd24 Date: Thu, 29 Mar 2018 12:47:59 +0100 Subject: Small changes to fix up last type stuff --- src/conversion/czi/czi.ts | 13 ++++++++----- src/conversion/czi/pyramidWorker.ts | 1 + src/conversion/types/helperCZITypes.ts | 11 ++++++----- 3 files changed, 15 insertions(+), 10 deletions(-) (limited to 'src/conversion') diff --git a/src/conversion/czi/czi.ts b/src/conversion/czi/czi.ts index c2d88ab..5682586 100644 --- a/src/conversion/czi/czi.ts +++ b/src/conversion/czi/czi.ts @@ -3,7 +3,7 @@ import { CZIHeightMap, CZITile, import { Dimension, Segment } from '../types/cziBinaryTypings'; import * as fs from 'fs'; import { SupportedViews, TileBounds } from '../types/helperCZITypes'; -import { logger } from '../../logging'; +import { logger } from '../../logger'; import * as sharp from 'sharp'; // tslint:disable-next-line:no-duplicate-imports import { SharpInstance } from 'sharp'; @@ -351,7 +351,9 @@ const cleanSupportedViews: (view: SupportedViews) => void = ( view: SupportedViews ): void => { for (const channel of view.scalable_image.channels) { - channel.metadata = cleanSupportedViewObject(channel.metadata); + channel.metadata = cleanSupportedViewObject( + channel.metadata as parsexml.Node[] + ); } }; @@ -553,7 +555,8 @@ const zoomTier: ( height: previousHeightMap.plane[ys][xs].height * 2, file: `img-${filecounter++}` }); - finalCZIJson.total_files++; + // tslint:disable-next-line:no-non-null-assertion + finalCZIJson.total_files!++; } newZoomTier.plane.push(cziRow); @@ -695,7 +698,7 @@ const writeJSONToFile: (filePath: string, obj: object) => void = ( JSON.stringify(obj, null, 2), (err: Error) => { if (err) { - logger.error(err); + logger.error(err.message); throw err; } } @@ -750,7 +753,7 @@ const buildCustomPyramids: () => Promise = async(): Promise => { }).catch((err: Error) => { // On error, write the error to console and set an error true. if (err) { - logger.error(err); + logger.error(err.message); } errorOccurred = true; } diff --git a/src/conversion/czi/pyramidWorker.ts b/src/conversion/czi/pyramidWorker.ts index 459f8f9..81110e7 100644 --- a/src/conversion/czi/pyramidWorker.ts +++ b/src/conversion/czi/pyramidWorker.ts @@ -4,6 +4,7 @@ import { TileBounds } from '../types/helperCZITypes'; import * as sharp from 'sharp'; import { SharpInstance } from 'sharp'; import { isTileRelated, regionToExtract } from './tileExtraction'; +import { logger } from '../../logger'; const processedDirname: string = '/cs/scratch/cjd24/0701-extraction-processed/'; const processedImages: string = `${processedDirname}data/`; diff --git a/src/conversion/types/helperCZITypes.ts b/src/conversion/types/helperCZITypes.ts index 5403bf3..51d5d85 100644 --- a/src/conversion/types/helperCZITypes.ts +++ b/src/conversion/types/helperCZITypes.ts @@ -8,13 +8,12 @@ export interface SupportedViews { scalable_image: { width: number; height: number; - channels: [ + channels: { channel_id: string; channel_name: string; - metadata?: Node[]; - } - ]; + metadata?: {}; + }[]; real_width?: { value?: number; units?: string; @@ -27,7 +26,9 @@ export interface SupportedViews { }; } -// Interface used to define the pixel-bounds of a 'section' within the image +/** + * Interface used to define the pixel-bounds of a 'section' within the image + */ export class TileBounds { public left: number; public right: number; -- cgit v1.2.1