Skip to content

Commit

Permalink
Merge branch 'main' into lane/vis-todos
Browse files Browse the repository at this point in the history
  • Loading branch information
lanesawyer committed Nov 20, 2024
2 parents 8262fbc + fcd200c commit 95dde23
Show file tree
Hide file tree
Showing 38 changed files with 5,447 additions and 5,192 deletions.
38 changes: 38 additions & 0 deletions .github/PULL_REQUEST_TEMPLATE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
# WIP Steps

_This section is optional if the PR is fully ready for review_

- Create the PR as a "draft" PR
- Add [WIP] to the title
- Use the template below to ask for specific feedback
- [ ] @name: Could you look at \_\_\_? I'm trying to do... (etc.)

# What

Replace this with 1-2 line Description of what feature, bugfix, chore does the PR contain the code for.

# How

Replace this txt describing what kind of technical overlaying code changes were introduced here.

# Screenshots

_This section is optional if there are no visible changes_

- If possible add screenshots of the visible additions in the UI.
- If there are changes in the UI, add **Before** and **After** Screenshots for quick overview.
- If there was a Figma design, add a link to that here as well.
- Hint : Drag and Drop any images you want to add to the PR. Also you can create a gif of an interactive version and add that!

# PR Checklist

- [ ] Is your PR title following our conventional commit naming recommendations?
- [ ] Have you filled in the PR Description Template?
- [ ] Is your branch up to date with the latest in `main`?
- [ ] Do the CI checks pass successfully?
- [ ] Have you smoke tested the example applications?
- [ ] Did you check that the changes meet accessibility standards?
- [ ] Have you tested the application on these browsers?
- [ ] Chrome (Fully supported)
- [ ] Firefox (Major bug fixes supported)
- [ ] Safari (Major bug fixes supported)
129 changes: 129 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,129 @@
name: CI

on: [pull_request]

concurrency:
# Cancels workflows that are already running when a new one is triggered for a branch
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

jobs:
build:
name: Build
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v4

- name: Install pnpm
uses: pnpm/action-setup@v4
with:
version: 9

- name: Use Node.js
uses: actions/setup-node@v4
with:
node-version: '22'

- name: Install dependencies
run: pnpm install --frozen-lockfile

- name: Build
run: pnpm build

format:
name: Format
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v4

- name: Install pnpm
uses: pnpm/action-setup@v4
with:
version: 9

- name: Use Node.js
uses: actions/setup-node@v4
with:
node-version: '22'

- name: Install dependencies
run: pnpm install --frozen-lockfile

- name: Format
run: pnpm fmt:check

lint:
name: Lint
runs-on: ubuntu-latest
# Skip job until we get a linter added
if: false

steps:
- uses: actions/checkout@v4

- name: Install pnpm
uses: pnpm/action-setup@v4
with:
version: 9

- name: Use Node.js
uses: actions/setup-node@v4
with:
node-version: '22'

- name: Install dependencies
run: pnpm install --frozen-lockfile

- name: Lint
run: echo "Add pnpm lint command here"

test:
name: Test
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v4

- name: Install pnpm
uses: pnpm/action-setup@v4
with:
version: 9

- name: Use Node.js
uses: actions/setup-node@v4
with:
node-version: '22'

- name: Install dependencies
run: pnpm install --frozen-lockfile

- name: Test
run: pnpm test

typecheck:
name: Typecheck
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v4

- name: Install pnpm
uses: pnpm/action-setup@v4
with:
version: 9

- name: Use Node.js
uses: actions/setup-node@v4
with:
node-version: '22'

- name: Install dependencies
run: pnpm install --frozen-lockfile

- name: Build
run: pnpm build

- name: Typecheck
run: pnpm typecheck
81 changes: 81 additions & 0 deletions .prettierignore
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
4 changes: 2 additions & 2 deletions LICENSE.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
Copyright 2024 Allen Institute
Copyright 2024 Allen Institute

Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:

Expand All @@ -8,4 +8,4 @@ Redistribution and use in source and binary forms, with or without modification,

3. Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS “AS IS” AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS “AS IS” AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
6 changes: 6 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,12 @@ See the `example` directory for example projects using the packages. Over time,

For details on running or adding new examples, see the `docs/examples.md` file.s

# Installation for Development

This project uses [Node.js](https://nodejs.org) and [pnpm](https://pnpm.io/). We use [Volta](https://volta.sh/) to manage the versions of each. If you're not using Volta, check the "volta" key in the root `package.json` for the Node and pnpm versions we're using when developing.

Volta has experimental support for pnpm, so [follow the steps on their docs](https://docs.volta.sh/advanced/pnpm) to get it enabled.

# Using the Libraries

See the `docs/using-packages.md` file for information on how to use the packages in your own projects.
Expand Down
1 change: 1 addition & 0 deletions examples/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
<br />
<ul>
<li><a href="/dzi">Deep Zoom Image</a><br /></li>
<li><a href="/omezarr">OMEZARR</a><br /></li>
<li><a href="/layers">Layers</a><br /></li>
</ul>
</body>
Expand Down
17 changes: 17 additions & 0 deletions examples/omezarr.html
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>
3 changes: 2 additions & 1 deletion examples/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@
"@alleninstitute/vis-geometry": "workspace:*",
"@alleninstitute/vis-scatterbrain": "workspace:*",
"@alleninstitute/vis-dzi": "workspace:*",
"@alleninstitute/vis-omezarr": "workspace:*",
"@czi-sds/components": "^20.0.1",
"@emotion/css": "^11.11.2",
"@emotion/react": "^11.11.4",
Expand All @@ -64,4 +65,4 @@
"regl": "^2.1.0",
"zarrita": "0.4.0-next.14"
}
}
}
2 changes: 1 addition & 1 deletion examples/src/common/loaders/ome-zarr/fetchSlice.worker.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// a web-worker which fetches slices of data, decodes them, and returns the result as a flat float32 array, using transferables
import type { Chunk } from 'zarrita';
import { getSlice, type ZarrDataset, type ZarrRequest } from './zarr-data';
import { type ZarrDataset, type ZarrRequest, getSlice } from '@alleninstitute/vis-omezarr';

const ctx = self;
type ZarrSliceRequest = {
Expand Down
2 changes: 1 addition & 1 deletion examples/src/common/loaders/ome-zarr/sliceWorkerPool.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { uniqueId } from 'lodash';
import type { ZarrDataset, ZarrRequest } from './zarr-data';
import type { ZarrDataset, ZarrRequest } from '@alleninstitute/vis-omezarr';

type PromisifiedMessage = {
requestCacheKey: string;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,8 @@ export function RenderServerProvider(props: PropsWithChildren<{}>) {
const server = useRef<RenderServer>();
const { children } = props;
useEffect(() => {
server.current = new RenderServer([2048, 2048], []);
server.current = new RenderServer([2048, 2048], ['oes_texture_float']);
console.log('server started...');
}, []);
return <renderServerContext.Provider value={server.current ?? null}>{children}</renderServerContext.Provider>;
}
2 changes: 1 addition & 1 deletion examples/src/data-renderers/versa-renderer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import {
sizeInUnits,
type ZarrDataset,
type ZarrRequest,
} from '~/common/loaders/ome-zarr/zarr-data';
} from '@alleninstitute/vis-omezarr';
import { getSlicePool } from '~/common/loaders/ome-zarr/sliceWorkerPool';
import type { Camera } from '~/common/camera';

Expand Down
2 changes: 1 addition & 1 deletion examples/src/data-renderers/volumeSliceRenderer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import {
sizeInVoxels,
sliceDimensionForPlane,
uvForPlane,
} from '~/common/loaders/ome-zarr/zarr-data';
} from '@alleninstitute/vis-omezarr';
import {
cacheKeyFactory,
getVisibleTiles,
Expand Down
4 changes: 2 additions & 2 deletions examples/src/data-sources/ome-zarr/planar-slice.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { type ZarrDataset, load } from '~/common/loaders/ome-zarr/zarr-data';
import { loadMetadata, type ZarrDataset } from '@alleninstitute/vis-omezarr';
import type { AxisAlignedPlane } from '~/data-renderers/versa-renderer';
import type { ColorMapping } from '../../data-renderers/types';
import type { OptionalTransform, Simple2DTransform } from '../types';
Expand Down Expand Up @@ -32,7 +32,7 @@ function assembleZarrSlice(config: ZarrSliceConfig, dataset: ZarrDataset): AxisA
}
export function createZarrSlice(config: ZarrSliceConfig): Promise<AxisAlignedZarrSlice> {
const { url } = config;
return load(url).then((dataset) => {
return loadMetadata(url).then((dataset) => {
return assembleZarrSlice(config, dataset);
});
}
4 changes: 2 additions & 2 deletions examples/src/data-sources/ome-zarr/slice-grid.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { type ZarrDataset, load } from '~/common/loaders/ome-zarr/zarr-data';
import { loadMetadata, type ZarrDataset } from '@alleninstitute/vis-omezarr';
import type { AxisAlignedPlane } from '~/data-renderers/versa-renderer';
import type { ColorMapping } from '../../data-renderers/types';
import type { OptionalTransform, Simple2DTransform } from '../types';
Expand Down Expand Up @@ -33,7 +33,7 @@ function assembleZarrSliceGrid(config: ZarrSliceGridConfig, dataset: ZarrDataset
}
export function createZarrSliceGrid(config: ZarrSliceGridConfig): Promise<AxisAlignedZarrSliceGrid> {
const { url } = config;
return load(url).then((dataset) => {
return loadMetadata(url).then((dataset) => {
return assembleZarrSliceGrid(config, dataset);
});
}
2 changes: 1 addition & 1 deletion examples/src/dzi/double.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { useContext, useEffect, useMemo, useRef, useState } from 'react';
import { RenderServerProvider } from './render-server-provider';
import { RenderServerProvider } from '../common/react/render-server-provider';
import React from 'react';
import { DziView } from './dziView';
import type { DziImage, DziRenderSettings } from '@alleninstitute/vis-dzi';
Expand Down
Loading

0 comments on commit 95dde23

Please sign in to comment.