-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'main' into lane/DT-5996-issue-templates
- Loading branch information
Showing
28 changed files
with
5,221 additions
and
5,150 deletions.
There are no files selected for viewing
Validating CODEOWNERS rules …
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 @@ | ||
* @AllenInstitute/app-dev |
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,81 @@ | ||
### dependencies | ||
node_modules | ||
|
||
### production | ||
build | ||
dist | ||
|
||
### boilerplate below ### | ||
|
||
# Visual Studio Code | ||
.vscode/* | ||
!.vscode/settings.json | ||
!.vscode/tasks.json | ||
!.vscode/launch.json | ||
!.vscode/extensions.json | ||
*.code-workspace | ||
|
||
# Local History for Visual Studio Code | ||
.history/ | ||
|
||
# Jet Brains | ||
.idea | ||
|
||
### macos | ||
# General | ||
.DS_Store | ||
.AppleDouble | ||
.LSOverride | ||
|
||
# Icon must end with two \r | ||
Icon | ||
|
||
# Thumbnails | ||
._* | ||
|
||
# Files that might appear in the root of a volume | ||
.DocumentRevisions-V100 | ||
.fseventsd | ||
.Spotlight-V100 | ||
.TemporaryItems | ||
.Trashes | ||
.VolumeIcon.icns | ||
.com.apple.timemachine.donotpresent | ||
|
||
# Directories potentially created on remote AFP share | ||
.AppleDB | ||
.AppleDesktop | ||
Network Trash Folder | ||
Temporary Items | ||
.apdisk | ||
|
||
# Logs | ||
logs | ||
*.log | ||
npm-debug.log* | ||
|
||
# Diagnostic reports (https://nodejs.org/api/report.html) | ||
report.[0-9]*.[0-9]*.[0-9]*.[0-9]*.json | ||
|
||
# Runtime data | ||
pids | ||
*.pid | ||
*.seed | ||
*.pid.lock | ||
|
||
# TypeScript cache | ||
*.tsbuildinfo | ||
|
||
# Output of 'npm pack' | ||
*.tgz | ||
|
||
# dotenv environment variables file | ||
.env | ||
.env.test | ||
|
||
# code coverage | ||
coverage | ||
|
||
# Lock files | ||
package-lock.json | ||
pnpm-lock.yaml |
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
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,17 @@ | ||
<!doctype html> | ||
<html> | ||
<body> | ||
<div | ||
id="sidebar" | ||
style="top: 0; left: 0; width: 15%; height: 100%; position: absolute" | ||
></div> | ||
<div | ||
id="main" | ||
style="top: 0; left: 15%; width: 85%; height: 100%; position: absolute" | ||
/> | ||
</body> | ||
</html> | ||
<script | ||
type="module" | ||
src="./src/omezarr/omezarr.ts" | ||
></script> |
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
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
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
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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
import React, { useEffect, useState } from 'react'; | ||
import { RenderServerProvider } from '~/common/react/render-server-provider'; | ||
import { SliceView } from './sliceview'; | ||
import { type OmeZarrDataset, loadOmeZarr } from '@alleninstitute/vis-omezarr'; | ||
|
||
const demo_versa = 'https://neuroglancer-vis-prototype.s3.amazonaws.com/VERSA/scratch/0500408166/'; | ||
|
||
export function AppUi() { | ||
return <DataPlease />; | ||
} | ||
|
||
function DataPlease() { | ||
// load our canned data for now: | ||
const [omezarr, setfile] = useState<OmeZarrDataset | undefined>(undefined); | ||
useEffect(() => { | ||
loadOmeZarr(demo_versa).then((dataset) => { | ||
setfile(dataset); | ||
console.log('loaded!'); | ||
}); | ||
}, []); | ||
return ( | ||
<RenderServerProvider> | ||
<SliceView omezarr={omezarr} /> | ||
</RenderServerProvider> | ||
); | ||
} |
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,5 @@ | ||
import { createRoot } from 'react-dom/client'; | ||
import { AppUi } from './app'; | ||
|
||
const uiroot = createRoot(document.getElementById('main')!); | ||
uiroot.render(AppUi()); |
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,99 @@ | ||
import { type box2D, Box2D, Vec2 } from '@alleninstitute/vis-geometry'; | ||
import { | ||
buildAsyncOmezarrRenderer, | ||
defaultDecoder, | ||
type VoxelTile, | ||
type ZarrDataset, | ||
type RenderSettings, | ||
} from '@alleninstitute/vis-omezarr'; | ||
import type { RenderFrameFn } from '@alleninstitute/vis-scatterbrain'; | ||
import React, { useState } from 'react'; | ||
import { useContext, useEffect, useRef } from 'react'; | ||
import { renderServerContext } from '~/common/react/render-server-provider'; | ||
type Props = { | ||
omezarr: ZarrDataset | undefined; | ||
}; | ||
const settings: RenderSettings = { | ||
tileSize: 256, | ||
gamut: { | ||
R: { gamut: { min: 0, max: 80 }, index: 0 }, | ||
G: { gamut: { min: 0, max: 100 }, index: 1 }, | ||
B: { gamut: { min: 0, max: 100 }, index: 2 }, | ||
}, | ||
plane: 'xy', | ||
planeIndex: 0, | ||
camera: { | ||
view: Box2D.create([0, 0], [250, 120]), | ||
screenSize: [500, 500], | ||
}, | ||
}; | ||
function compose(ctx: CanvasRenderingContext2D, image: ImageData) { | ||
ctx.putImageData(image, 0, 0); | ||
} | ||
|
||
export function SliceView(props: Props) { | ||
const { omezarr } = props; | ||
const server = useContext(renderServerContext); | ||
const cnvs = useRef<HTMLCanvasElement>(null); | ||
const renderer = useRef<ReturnType<typeof buildAsyncOmezarrRenderer>>(); | ||
const [view, setView] = useState<box2D>(Box2D.create([0, 0], [250, 120])); | ||
useEffect(() => { | ||
if (server && server.regl) { | ||
renderer.current = buildAsyncOmezarrRenderer(server.regl, defaultDecoder); | ||
} | ||
return () => { | ||
if (cnvs.current) { | ||
server?.destroyClient(cnvs.current); | ||
} | ||
}; | ||
}, [server]); | ||
|
||
useEffect(() => { | ||
if (server && renderer.current && cnvs.current && omezarr) { | ||
const hey: RenderFrameFn<ZarrDataset, VoxelTile> = (target, cache, callback) => { | ||
if (renderer.current) { | ||
return renderer.current( | ||
omezarr, | ||
{ ...settings, camera: { ...settings.camera, view } }, | ||
callback, | ||
target, | ||
cache | ||
); | ||
} | ||
return null; | ||
}; | ||
server.beginRendering( | ||
hey, | ||
(e) => { | ||
switch (e.status) { | ||
case 'begin': | ||
server.regl?.clear({ framebuffer: e.target, color: [0, 0, 0, 0], depth: 1 }); | ||
break; | ||
case 'progress': | ||
// wanna see the tiles as they arrive? | ||
e.server.copyToClient(compose); | ||
break; | ||
case 'finished': { | ||
e.server.copyToClient(compose); | ||
} | ||
} | ||
}, | ||
cnvs.current | ||
); | ||
} | ||
}, [server, renderer.current, cnvs.current, omezarr, view]); | ||
return ( | ||
<canvas | ||
id={'hey there'} | ||
ref={cnvs} | ||
onWheel={(e) => { | ||
const scale = e.deltaY > 0 ? 1.1 : 0.9; | ||
const m = Box2D.midpoint(view); | ||
const v = Box2D.translate(Box2D.scale(Box2D.translate(view, Vec2.scale(m, -1)), [scale, scale]), m); | ||
setView(v); | ||
}} | ||
width={settings.camera.screenSize[0]} | ||
height={settings.camera.screenSize[1]} | ||
></canvas> | ||
); | ||
} |
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
Oops, something went wrong.