Skip to content

Commit

Permalink
Revert changes to ome.ts, removing isNested duplication
Browse files Browse the repository at this point in the history
  • Loading branch information
will-moore committed Apr 8, 2021
1 parent 3cdabea commit 7545a5c
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 14 deletions.
1 change: 1 addition & 0 deletions src/io.ts
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,7 @@ function isNested(attrs: Ome.Attrs) {
} else if ('well' in attrs) {
version = attrs.well.version;
}
// OME-Zarr uses nested chunks since version 0.2
return version && version !== '0.1';
}

Expand Down
15 changes: 1 addition & 14 deletions src/ome.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,10 @@ import { ZarrPixelSource } from '@hms-dbmi/viv';
import pMap from 'p-map';
import { Group as ZarrGroup, HTTPStore, openGroup, ZarrArray } from 'zarr';
import type { ImageLayerConfig, SourceData } from './state';
import { guessTileSize, join, loadMultiscales, nested, parseMatrix, range } from './utils';
import { join, loadMultiscales, guessTileSize, range, parseMatrix } from './utils';

// OME-Zarr uses nested chunks since version 0.2
function isNested(version: String | undefined): boolean {
return version != undefined && version !== '0.1';
}

export async function loadWell(config: ImageLayerConfig, grp: ZarrGroup, wellAttrs: Ome.Well): Promise<SourceData> {
if (isNested(wellAttrs.version)) {
grp.store = nested(grp.store);
}
// Can filter Well fields by URL query ?acquisition=ID
const acquisitionId: number | undefined = config.acquisition ? parseInt(config.acquisition) : undefined;
let acquisitions: Ome.Acquisition[] = [];
Expand Down Expand Up @@ -113,9 +106,6 @@ export async function loadWell(config: ImageLayerConfig, grp: ZarrGroup, wellAtt
}

export async function loadPlate(config: ImageLayerConfig, grp: ZarrGroup, plateAttrs: Ome.Plate): Promise<SourceData> {
if (isNested(plateAttrs.version)) {
grp.store = nested(grp.store);
}
if (!('columns' in plateAttrs) || !('rows' in plateAttrs)) {
throw Error(`Plate .zattrs missing columns or rows`);
}
Expand Down Expand Up @@ -204,9 +194,6 @@ export async function loadOmeroMultiscales(
grp: ZarrGroup,
attrs: { multiscales: Ome.Multiscale[]; omero: Ome.Omero }
): Promise<SourceData> {
if (isNested(attrs.multiscales[0]?.version)) {
grp.store = nested(grp.store);
}
const { name, opacity = 1, colormap = '' } = config;
const data = await loadMultiscales(grp, attrs.multiscales);
const meta = parseOmeroMeta(attrs.omero);
Expand Down

0 comments on commit 7545a5c

Please sign in to comment.