Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 20 additions & 0 deletions .npmignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# Source files (only ship compiled dist/)
src/
tsconfig.json
tsconfig.lib.json
vite.config.ts

# Development files
.git/
.github/
node_modules/
docs/
public/

# Web app specific (PoC only)
index.html
src/style.css
src/app.ts

# Build artifacts from web app
*.map
72 changes: 72 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,78 @@ Current OME-NGFF (i.e. OME-Zarr) tools tend to support different aspects of the

Each tool could optionally publish a "capability manifest" which describes the tool's implementd capabilities with regards to the current and former NGFF Specifications. This manifest could simply live in the tool's Github repo, to be updated whenever relevant changes are made to the code. This manifest can then be interpreted computationally by any platform that wants to launch OME-NGFF tools (OMERO, BFF, Fileglancer, etc.)

## Library Usage

This package can be used as a library to determine which OME-Zarr viewers are compatible with a given dataset.

### Installation

```bash
npm install @bioimagetools/capability-manifest
```

### Usage

```typescript
import {
initialize,
getCompatibleViewers,
type OmeZarrMetadata
} from '@bioimagetools/capability-manifest';

// Initialize once at application startup
await initialize();

// For each dataset, pass pre-parsed metadata
const metadata: OmeZarrMetadata = {
version: '0.4',
axes: [
{ name: 'z', type: 'space' },
{ name: 'y', type: 'space' },
{ name: 'x', type: 'space' }
],
// ... other metadata
};

// Get list of compatible viewer names
const viewers = getCompatibleViewers(metadata);
// Returns: ['Avivator', 'Neuroglancer']
```

### API

#### `initialize(): Promise<void>`

Loads all viewer capability manifests. Must be called once at application startup before using other functions.

Throws an error if no manifests can be loaded.

#### `getCompatibleViewers(metadata: OmeZarrMetadata): string[]`

Returns array of viewer names that are compatible with the given dataset metadata.

- **Parameters:**
- `metadata`: Pre-parsed OME-Zarr metadata object (use ome-zarr.js or similar to parse from Zarr stores)

- **Returns:** Array of viewer names (e.g., `['Avivator', 'Neuroglancer']`)

- **Throws:** Error if library not initialized

#### `getCompatibleViewersWithDetails(metadata: OmeZarrMetadata): Array<{name: string, validation: ValidationResult}>`

Returns detailed compatibility information including validation errors and warnings for each compatible viewer.

Useful for debugging or displaying why certain viewers work/don't work.

### Types

The library exports TypeScript types for all data structures:

- `OmeZarrMetadata` - Structure of OME-Zarr metadata
- `ViewerManifest` - Structure of viewer capability manifests
- `ValidationResult` - Validation outcome with errors/warnings
- `ValidationError`, `ValidationWarning` - Detailed validation messages

## Manifest Specification (DRAFT)

| Attribute | Description |
Expand Down
2 changes: 1 addition & 1 deletion index.html
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,6 @@ <h1>OME-NGFF Tool Capabilities</h1>
</div>
</div>

<script type="module" src="/src/main.ts"></script>
<script type="module" src="/src/app.ts"></script>
</body>
</html>
Loading