-
Notifications
You must be signed in to change notification settings - Fork 3
/
view-2d.ts
27 lines (21 loc) · 954 Bytes
/
view-2d.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
import './assetPathSetup.js';
import { ZarrMultiscaleSpatialImage } from '@itk-viewer/io/ZarrMultiscaleSpatialImage.js';
import { ItkViewer2d } from '../src/itk-viewer-2d.js';
document.addEventListener('DOMContentLoaded', async function () {
const imagePath = '/ome-ngff-prototypes/single_image/v0.4/tczyx.ome.zarr';
const url = new URL(imagePath, document.location.origin);
const zarrImage = await ZarrMultiscaleSpatialImage.fromUrl(url);
const viewerElement = document.querySelector('#viewer')! as ItkViewer2d;
const viewer = viewerElement.getActor();
viewer!.send({ type: 'setImage', image: zarrImage, name: 'image' });
const imageActor = viewer!
.getSnapshot()
.context.viewports[0].getSnapshot()
.context.views[0].getSnapshot().context.imageActor;
imageActor.send({ type: 'colorMap', colorMap: '2hot', component: 0 });
imageActor.send({
type: 'colorRange',
range: [300, 1500],
component: 0,
});
});