-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(element): Add compare example with linked camera
- Loading branch information
Showing
4 changed files
with
57 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
<!doctype html> | ||
<html lang="en"> | ||
<head> | ||
<meta charset="UTF-8" /> | ||
<link rel="icon" type="image/svg+xml" href="/vite.svg" /> | ||
<meta name="viewport" content="width=device-width, initial-scale=1.0" /> | ||
<title>itk-view-2d</title> | ||
<link rel="stylesheet" href="index.css" /> | ||
<script type="module" src="../src/itk-viewer-element.ts"></script> | ||
<script type="module" src="../src/itk-viewport.ts"></script> | ||
<script type="module" src="../src/itk-view-2d.ts"></script> | ||
<script type="module" src="../src/itk-view-2d-vtkjs.ts"></script> | ||
|
||
<script type="module" src="./compare.ts"></script> | ||
</head> | ||
|
||
<body> | ||
<itk-viewer class="fill" style="flex-direction: row; gap: 0.25rem"> | ||
<itk-viewport class="fill"> | ||
<itk-view-2d class="fill"> | ||
<itk-view-2d-vtkjs></itk-view-2d-vtkjs> | ||
</itk-view-2d> | ||
</itk-viewport> | ||
<itk-viewport class="fill"> | ||
<itk-view-2d class="fill"> | ||
<itk-view-2d-vtkjs></itk-view-2d-vtkjs> | ||
</itk-view-2d> | ||
</itk-viewport> | ||
</itk-viewer> | ||
</body> | ||
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
import { ZarrMultiscaleSpatialImage } from '@itk-viewer/io/ZarrMultiscaleSpatialImage.js'; | ||
import { setPipelineWorkerUrl, setPipelinesBaseUrl } from 'itk-wasm'; | ||
|
||
const pipelineWorkerUrl = '/itk/web-workers/itk-wasm-pipeline.min.worker.js'; | ||
setPipelineWorkerUrl(pipelineWorkerUrl); | ||
const pipelineBaseUrl = '/itk/pipelines'; | ||
setPipelinesBaseUrl(pipelineBaseUrl); | ||
|
||
document.addEventListener('DOMContentLoaded', async function () { | ||
const [v0, v1] = Array.from(document.querySelectorAll('itk-viewport')).map( | ||
(el) => el.getActor(), | ||
); | ||
const camera = v0?.getSnapshot()?.context?.camera; | ||
if (!camera) throw new Error('Could not get camera'); | ||
v1?.send({ type: 'setCamera', camera }); | ||
|
||
const imagePath = '/ome-ngff-prototypes/single_image/v0.4/zyx.ome.zarr'; | ||
const url = new URL(imagePath, document.location.origin); | ||
const image = await ZarrMultiscaleSpatialImage.fromUrl(url); | ||
|
||
const viewerElement = document.querySelector('itk-viewer'); | ||
if (!viewerElement) throw new Error('Could not find element'); | ||
const viewer = viewerElement.getActor(); | ||
viewer.send({ type: 'setImage', image, name: 'image' }); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters