-
Notifications
You must be signed in to change notification settings - Fork 1
chore: Cleanup & reorganization of Examples in Vis Docs #209
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
This file was deleted.
This file was deleted.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,8 @@ | ||
| --- | ||
| title: OME-Zarr | ||
| tableOfContents: false | ||
| --- | ||
|
|
||
| import { OmezarrDemo } from '../../../examples/omezarr/selectable-image-demo/omezarr-demo.tsx'; | ||
|
|
||
| <OmezarrDemo client:only="react" /> |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,8 @@ | ||
| --- | ||
| title: OME-Zarr with Priority Cache | ||
| tableOfContents: false | ||
| --- | ||
|
|
||
| import { OmezarrDemo } from '../../../examples/omezarr/priority-cache-demo/omezarr-via-priority-cache.tsx'; | ||
|
|
||
| <OmezarrDemo client:only="react" /> |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,8 @@ | ||
| --- | ||
| title: OME-Zarr Gallery (multiple views, shared data) | ||
| tableOfContents: false | ||
| --- | ||
|
|
||
| import { OmezarrGalleryDemo } from '../../../examples/omezarr/gallery-demo/omezarr-gallery.tsx'; | ||
|
|
||
| <OmezarrGalleryDemo client:only="react" /> |
This file was deleted.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,31 @@ | ||
| import { RenderServerProvider } from 'src/examples/common/react/render-server-provider'; | ||
| import { SliceView } from './sliceview'; | ||
| import { useEffect, useState } from 'react'; | ||
| import { loadMetadata, type OmeZarrMetadata } from '@alleninstitute/vis-omezarr'; | ||
| import { logger } from '@alleninstitute/vis-core'; | ||
| import { OMEZARR_DEMO_FILESETS } from 'src/examples/common/filesets/omezarr'; | ||
|
|
||
| /** | ||
| * HEY!!! | ||
| * this is an example React Component for rendering A single slice of an OMEZARR image in a react component | ||
| * This example is as bare-bones as possible! It is NOT the recommended way to do anything, its just trying to show | ||
| * one way of: | ||
| * 1. using our rendering utilities for OmeZarr data, specifically in a react component. Your needs for state-management, | ||
| * slicing logic, etc might all be different! | ||
| * | ||
| */ | ||
| export function DataPlease() { | ||
| // load our canned data for now: | ||
| const [omezarr, setfile] = useState<OmeZarrMetadata | undefined>(undefined); | ||
| useEffect(() => { | ||
| loadMetadata(OMEZARR_DEMO_FILESETS[0].res).then((dataset) => { | ||
| setfile(dataset); | ||
| logger.info('loaded!'); | ||
| }); | ||
| }, []); | ||
| return ( | ||
| <RenderServerProvider> | ||
| <SliceView omezarr={omezarr} /> | ||
| </RenderServerProvider> | ||
| ); | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,14 @@ | ||
| import type { vec2 } from '@alleninstitute/vis-geometry'; | ||
| import { SharedCacheProvider } from '../../common/react/priority-cache-provider'; | ||
| import { OmeZarrView } from './omezarr-client'; | ||
| import { OMEZARR_DEMO_FILESETS } from 'src/examples/common/filesets/omezarr'; | ||
|
|
||
| const screenSize: vec2 = [800, 800]; | ||
|
|
||
| export function OmezarrDemo() { | ||
| return ( | ||
| <SharedCacheProvider> | ||
| <OmeZarrView res={OMEZARR_DEMO_FILESETS[3].res} screenSize={screenSize} /> | ||
| </SharedCacheProvider> | ||
| ); | ||
| } | ||
|
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Not actually a "new" file, just changed so much and moved that Git apparently couldn't sort it out. 🤷🏽 |
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -3,65 +3,11 @@ import { type OmeZarrMetadata, loadMetadata, nextSliceStep, sizeInUnits } from ' | |
| import type { RenderSettings, RenderSettingsChannels } from '@alleninstitute/vis-omezarr'; | ||
| import { logger, type WebResource } from '@alleninstitute/vis-core'; | ||
| import type React from 'react'; | ||
| import { useEffect, useId, useMemo, useState } from 'react'; | ||
| import { pan, zoom } from '../common/camera'; | ||
| import { RenderServerProvider } from '../common/react/render-server-provider'; | ||
| import { useId, useMemo, useState } from 'react'; | ||
| import { pan, zoom } from '../../common/camera'; | ||
| import { RenderServerProvider } from '../../common/react/render-server-provider'; | ||
| import { OmezarrViewer } from './omezarr-viewer'; | ||
| import { SliceView } from './sliceview'; | ||
| type DemoOption = { value: string; label: string; res: WebResource }; | ||
|
|
||
| const demoOptions: DemoOption[] = [ | ||
| { | ||
| value: 'opt1', | ||
| label: 'VERSA OME-Zarr Example (HTTPS) (color channels: [R, G, B])', | ||
| res: { type: 'https', url: 'https://neuroglancer-vis-prototype.s3.amazonaws.com/VERSA/scratch/0500408166/' }, | ||
| }, | ||
| { | ||
| value: 'opt2', | ||
| label: 'VS200 Example Image (S3) (color channels: [CFP, YFP])', | ||
| res: { | ||
| type: 's3', | ||
| region: 'us-west-2', | ||
| url: 's3://allen-genetic-tools/epifluorescence/1401210938/ome_zarr_conversion/1401210938.zarr/', | ||
| }, | ||
| }, | ||
| { | ||
| value: 'opt3', | ||
| label: 'EPI Example Image (S3) (color channels: [R, G, B])', | ||
| res: { | ||
| type: 's3', | ||
| region: 'us-west-2', | ||
| url: 's3://allen-genetic-tools/epifluorescence/1383646325/ome_zarr_conversion/1383646325.zarr/', | ||
| }, | ||
| }, | ||
| { | ||
| value: 'opt4', | ||
| label: 'STPT Example Image (S3) (color channels: [R, G, B])', | ||
| res: { | ||
| type: 's3', | ||
| region: 'us-west-2', | ||
| url: 's3://allen-genetic-tools/tissuecyte/823818122/ome_zarr_conversion/823818122.zarr/', | ||
| }, | ||
| }, | ||
| { | ||
| value: 'opt5', | ||
| label: 'Smart-SPIM (experimental)', | ||
| res: { | ||
| type: 's3', | ||
| region: 'us-west-2', | ||
| url: 's3://aind-open-data/SmartSPIM_787715_2025-04-08_18-33-36_stitched_2025-04-09_22-42-59/image_tile_fusing/OMEZarr/Ex_445_Em_469.zarr', | ||
| }, | ||
| }, | ||
| { | ||
| value: 'opt6', | ||
| label: 'V3 Zarr Example Image (S3) (color channels: [R, G, B])', | ||
| res: { | ||
| type: 's3', | ||
| region: 'us-west-2', | ||
| url: 's3://h301-scanning-802451596237-us-west-2/2402091625/ome_zarr_conversion/1458501514.zarr/', | ||
| }, | ||
| }, | ||
| ]; | ||
| import { OMEZARR_DEMO_FILESETS } from 'src/examples/common/filesets/omezarr'; | ||
|
|
||
| const screenSize: vec2 = [800, 800]; | ||
|
|
||
|
|
@@ -131,7 +77,7 @@ export function OmezarrDemo() { | |
| setOmezarr(null); | ||
| setSelectedDemoOptionValue(selectedValue); | ||
| if (selectedValue && selectedValue !== 'custom') { | ||
| const option = demoOptions.find((v) => v.value === selectedValue); | ||
| const option = OMEZARR_DEMO_FILESETS.find((v) => v.value === selectedValue); | ||
| if (option) { | ||
| load(option.res); | ||
| } | ||
|
|
@@ -191,7 +137,7 @@ export function OmezarrDemo() { | |
| <option value="" key="default"> | ||
| -- Please select an option -- | ||
| </option> | ||
| {demoOptions.map((opt) => ( | ||
| {OMEZARR_DEMO_FILESETS.map((opt) => ( | ||
| <option value={opt.value} key={opt.value}> | ||
| {opt.label} | ||
| </option> | ||
|
|
@@ -288,27 +234,3 @@ export function OmezarrDemo() { | |
| </RenderServerProvider> | ||
| ); | ||
| } | ||
| /** | ||
| * HEY!!! | ||
| * this is an example React Component for rendering A single slice of an OMEZARR image in a react component | ||
| * This example is as bare-bones as possible! It is NOT the recommended way to do anything, its just trying to show | ||
| * one way of: | ||
| * 1. using our rendering utilities for OmeZarr data, specifically in a react component. Your needs for state-management, | ||
| * slicing logic, etc might all be different! | ||
| * | ||
| */ | ||
| function DataPlease() { | ||
| // load our canned data for now: | ||
| const [omezarr, setfile] = useState<OmeZarrMetadata | undefined>(undefined); | ||
| useEffect(() => { | ||
| loadMetadata(demoOptions[0].res).then((dataset) => { | ||
| setfile(dataset); | ||
| logger.info('loaded!'); | ||
| }); | ||
| }, []); | ||
| return ( | ||
| <RenderServerProvider> | ||
| <SliceView omezarr={omezarr} /> | ||
| </RenderServerProvider> | ||
| ); | ||
| } | ||
Jarbuckle marked this conversation as resolved.
Show resolved
Hide resolved
Comment on lines
-291
to
-314
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This got moved into its own example folder: |
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It thought this was the renamed version of
omezarr-via-priority-cache, but it's actually a whole new file that contains the factored-out "demo options" from all of the different demos.