### Setup Pixi Environment Source: https://github.com/fideus-labs/ngff-zarr/blob/main/mcp/README.md Clone the repository and set up the development environment using pixi. This includes installing dependencies and activating the development shell. ```bash # Clone and setup environment git clone cd mcp/ pixi install ``` -------------------------------- ### Install Dependencies Source: https://github.com/fideus-labs/ngff-zarr/blob/main/docs/development.md Install project dependencies using pixi. Ensure pixi is installed first. Then, install pre-commit hooks. ```shell pixi install -a pixi run pre-commit-install ``` -------------------------------- ### Install and Run ngff-zarr-mcp with uvx Source: https://github.com/fideus-labs/ngff-zarr/blob/main/mcp/README.md Install the uvx package and then run the ngff-zarr-mcp server directly from PyPI. This is the recommended quick installation method. ```bash pip install uvx uvx ngff-zarr-mcp ``` -------------------------------- ### Handle Installation Permission Issues Source: https://github.com/fideus-labs/ngff-zarr/blob/main/mcp/README.md Address permission issues during installation by using user installation with pip or creating and activating a virtual environment. This ensures that packages can be installed without system-level conflicts. ```bash # Use user installation pip install --user uvx # Or create a virtual environment python -m venv venv source venv/bin/activate # On Windows: venv\Scripts\activate pip install ngff-zarr-mcp ``` -------------------------------- ### Development Installation with pixi Source: https://github.com/fideus-labs/ngff-zarr/blob/main/mcp/README.md Commands for installing pixi, cloning the repository, setting up the development environment, and running development servers or tests. ```bash # Install pixi if not already installed curl -fsSL https://pixi.sh/install.sh | bash # Clone and setup environment git clone cd mcp/ pixi install # Development environment (includes all dev tools) pixi shell -e dev # Run development server pixi run dev-server # Run tests and checks pixi run test pixi run lint pixi run typecheck ``` -------------------------------- ### Development Installation with pip Source: https://github.com/fideus-labs/ngff-zarr/blob/main/mcp/README.md Commands for cloning the repository and installing the package in development mode using pip, followed by instructions to run the server. ```bash # Clone and install in development mode git clone cd mcp/ pip install -e ".[all]" # Run the server ngff-zarr-mcp ``` -------------------------------- ### Install Pre-commit Hooks (Bash) Source: https://github.com/fideus-labs/ngff-zarr/blob/main/CONTRIBUTING.md Install pre-commit hooks for the Python package. Ensure you are in the 'py' directory. ```bash cd py && pixi run pre-commit-install ``` -------------------------------- ### Install ngff-zarr with 'all' Optional Dependencies Source: https://github.com/fideus-labs/ngff-zarr/blob/main/docs/installation.md An alternative method to install ngff-zarr with all optional dependencies using the shorthand '[all]'. ```shell pip install "ngff-zarr[all]" ``` -------------------------------- ### Install ngff-zarr TypeScript Package Source: https://github.com/fideus-labs/ngff-zarr/blob/main/README.md Installation instructions for the TypeScript package in Deno, Node.js/npm, and browser environments. ```bash # Deno import * as ngffZarr from "jsr:@fideus-labs/ngff-zarr"; # Node.js / npm ``` ```bash npm install @fideus-labs/ngff-zarr # Browser (CDN) ``` ```bash import * as ngffZarr from "https://esm.sh/@fideus-labs/ngff-zarr"; ``` -------------------------------- ### Install ngff-zarr with CLI Source: https://github.com/fideus-labs/ngff-zarr/blob/main/docs/quick_start.md Install the ngff-zarr library with command-line interface support. This is required for using the `ngff-zarr` command. ```shell pip install "ngff-zarr[cli]" ``` -------------------------------- ### Install ngff-zarr-mcp in Zed (uvx) Source: https://github.com/fideus-labs/ngff-zarr/blob/main/mcp/README.md Add this configuration to your Zed `settings.json` to use uvx for installing ngff-zarr-mcp. ```json { "context_servers": { "ngff-zarr": { "command": "uvx", "args": ["ngff-zarr-mcp"] } } } ``` -------------------------------- ### Install ngff-zarr-mcp in Claude Desktop (direct) Source: https://github.com/fideus-labs/ngff-zarr/blob/main/mcp/README.md Add this configuration to your Claude Desktop `claude_desktop_config.json` file for direct installation of ngff-zarr-mcp. ```json { "mcpServers": { "ngff-zarr": { "command": "ngff-zarr-mcp" } } } ``` -------------------------------- ### Install ngff-zarr for Node.js/npm Source: https://github.com/fideus-labs/ngff-zarr/blob/main/ts/README.md Install the ngff-zarr package using npm for Node.js environments. ```bash npm install @fideus-labs/ngff-zarr ``` ```typescript import * as ngffZarr from "@fideus-labs/ngff-zarr"; ``` -------------------------------- ### Conventional Commit Examples (Bash) Source: https://github.com/fideus-labs/ngff-zarr/blob/main/CONTRIBUTING.md Examples of commit messages following the Conventional Commits format for different types and scopes. ```bash feat(py): add support for zarr v3 sharding fix(mcp): handle missing metadata gracefully docs: update installation instructions chore(ts): update dependencies ``` -------------------------------- ### Install NGFF-Zarr with JSR (Deno/Node.js) Source: https://github.com/fideus-labs/ngff-zarr/blob/main/docs/typescript.md Import the library using JSR for Deno or modern Node.js environments. ```typescript import * as ngffZarr from "jsr:@fideus-labs/ngff-zarr"; ``` ```bash npx jsr add @fideus-labs/ngff-zarr ``` ```typescript import * as ngffZarr from "@fideus-labs/ngff-zarr"; ``` -------------------------------- ### Install vkfft for GPU-accelerated ITK Source: https://github.com/fideus-labs/ngff-zarr/blob/main/docs/methods.md Install the itk-vkfft package to enable GPU-accelerated, FFT-based filtering for ITK-based downsampling methods. This is applied by default after installation. ```sh pip install itk-vkfft ``` -------------------------------- ### Install ngff-zarr with Tensorstore Support Source: https://github.com/fideus-labs/ngff-zarr/blob/main/docs/python.md Install the 'ngff-zarr' package with the 'tensorstore' extra to enable writing OME-Zarr stores using Tensorstore for potentially better performance. ```shell pip install "ngff-zarr[tensorstore]" ``` -------------------------------- ### Conventional Commit Examples Source: https://github.com/fideus-labs/ngff-zarr/blob/main/AGENTS.md Examples of valid commit messages following the conventional commits specification for different scopes and types. ```bash feat(py): add support for RFC-9 OME-Zarr format fix(ts): resolve memory leak in multiscale generation docs: update installation instructions chore(mcp): update dependencies ``` -------------------------------- ### Install TIFF Support Source: https://github.com/fideus-labs/ngff-zarr/blob/main/docs/tiff.md Install ngff-zarr with CLI optional dependencies to enable TIFF support. This includes the 'tifffile' library. ```shell pip install 'ngff-zarr[cli]' ``` -------------------------------- ### Read OME-Zarr Basic Example Source: https://github.com/fideus-labs/ngff-zarr/blob/main/docs/typescript.md Perform a basic read operation on an OME-Zarr file using the fromNgffZarr function. ```typescript // Basic reading const ms = await fromNgffZarr("data.ome.zarr"); // With validation const validatedMs = await fromNgffZarr("data.ome.zarr", { validate: true, version: "0.5", }); // From URL const remoteMs = await fromNgffZarr("https://example.com/data.ome.zarr"); ``` -------------------------------- ### Install ngff-zarr with All Optional Dependencies Source: https://github.com/fideus-labs/ngff-zarr/blob/main/docs/installation.md Install ngff-zarr along with all available optional dependencies for comprehensive functionality, including CLI tools, dask-image, ITK, TensorStore, and validation. ```shell pip install "ngff-zarr[cli,dask-image,itk,tensorstore,validate]" ``` -------------------------------- ### Install ngff-zarr via pip Source: https://github.com/fideus-labs/ngff-zarr/blob/main/docs/installation.md Use this command to install the ngff-zarr library for general use on your system. ```shell pip install ngff-zarr ``` -------------------------------- ### Install ngff-zarr with Validation Support Source: https://github.com/fideus-labs/ngff-zarr/blob/main/docs/python.md Install the 'ngff-zarr' package with the 'validate' extra to enable OME-Zarr metadata validation. ```shell pip install "ngff-zarr[validate]" ``` -------------------------------- ### Create and Write OME-Zarr Files Source: https://github.com/fideus-labs/ngff-zarr/blob/main/docs/typescript.md Construct OME-Zarr data from scratch, including image data, axes, scales, and metadata, then write it to a Zarr store. This example creates a simple grayscale image. ```typescript import { createAxis, createDataset, createMetadata, createMultiscales, createNgffImage, toNgffZarr, } from "@fideus-labs/ngff-zarr"; // Create image data (256x256 grayscale) const data = new Uint8Array(256 * 256); for (let i = 0; i < data.length; i++) { data[i] = Math.floor(Math.random() * 256); } // Create an NgffImage with metadata const image = createNgffImage( data.buffer, [256, 256], // shape "uint8", // dtype ["y", "x"], // dimension names { y: 1.0, x: 1.0 }, // scale (pixel spacing) { y: 0.0, x: 0.0 } // translation (origin) ); // Create OME-Zarr metadata const axes = [ createAxis("y", "space", "micrometer"), createAxis("x", "space", "micrometer"), ]; const datasets = [ createDataset( "0", // path [1.0, 1.0], // scale [0.0, 0.0] // translation ), ]; const metadata = createMetadata(axes, datasets, "my_image"); // Create multiscales container const multiscales = createMultiscales([image], metadata); // Write to OME-Zarr await toNgffZarr("output.ome.zarr", multiscales); ``` -------------------------------- ### Configure ngff-zarr MCP Server in VS Code (pip install) Source: https://github.com/fideus-labs/ngff-zarr/blob/main/mcp/README.md Configuration for ngff-zarr MCP server in VS Code using pip install. This method installs the package and then runs the server directly. ```json "mcp": { "servers": { "ngff-zarr": { "command": "python", "args": ["-c", "import subprocess; subprocess.run(['pip', 'install', 'ngff-zarr-mcp']); import ngff_zarr_mcp.server; ngff_zarr_mcp.server.main()"] } } } ``` -------------------------------- ### Install NGFF-Zarr for Browser (CDN) Source: https://github.com/fideus-labs/ngff-zarr/blob/main/docs/typescript.md Include the library directly in the browser using a CDN. ```html ``` -------------------------------- ### Convert Image to OME-Zarr with Metadata via MCP Client Source: https://github.com/fideus-labs/ngff-zarr/blob/main/mcp/README.md Example demonstrating how to convert a NIfTI-GZ image to OME-Zarr, including specifying dimensions, scale, units, and name. ```python result = await convert_images_to_ome_zarr( input_paths=["image.nii.gz"], output_path="brain.ome.zarr", dims=["z", "y", "x"], scale={"z": 2.0, "y": 0.5, "x": 0.5}, units={"z": "micrometer", "y": "micrometer", "x": "micrometer"}, name="Brain MRI", scale_factors=[2, 4] ) ``` -------------------------------- ### OpenCode MCP Server Configuration Source: https://github.com/fideus-labs/ngff-zarr/blob/main/docs/mcp.md Example JSON configuration for integrating the ngff-zarr-mcp server with OpenCode. Adjust 'command' and 'environment' for other agents. ```json { "$schema": "https://opencode.ai/config.json", "mcp": { "ngff-zarr": { "type": "local", "command": ["uvx", "ngff-zarr-mcp"], "enabled": true } } } ``` -------------------------------- ### Install ngff-zarr for Deno Source: https://github.com/fideus-labs/ngff-zarr/blob/main/ts/README.md Import the ngff-zarr library for use in Deno projects. ```typescript import * as ngffZarr from "@fideus-labs/ngff-zarr"; ``` -------------------------------- ### Install fsspec and s3fs Source: https://github.com/fideus-labs/ngff-zarr/blob/main/docs/faq.md Required packages for reading from S3, GCS, and other remote storage using fsspec. ```bash pip install fsspec s3fs ``` -------------------------------- ### Changelog Filtering Example (Markdown) Source: https://github.com/fideus-labs/ngff-zarr/blob/main/AGENTS.md Example of a changelog entry with a clickable GitHub commit link. This format is generated by the custom Commitizen plugin. ```markdown - **py**: add feature ([abc1234](https://github.com/fideus-labs/ngff-zarr/commit/abc1234...)) ``` -------------------------------- ### Debug Browser Tests with Deno Source: https://github.com/fideus-labs/ngff-zarr/blob/main/ts/README.md Use this command to start a debugging session for browser tests. Ensure you are in the project root. ```bash deno task test:browser:debug ``` -------------------------------- ### Convert Image to OME-Zarr with itk-wasm Source: https://github.com/fideus-labs/ngff-zarr/blob/main/docs/typescript.md This example demonstrates loading an image using itk-wasm, converting it to NgffImage format, generating a multiscale pyramid, and writing it to an OME-Zarr store. ```typescript import { itkImageToNgffImage, toMultiscales, toNgffZarr, } from "@fideus-labs/ngff-zarr"; // Load image using itk-wasm const itkImage = await loadImageFromFile("input.png"); // Convert to NgffImage const ngffImage = await itkImageToNgffImage(itkImage); // Generate pyramid const multiscales = await toMultiscales(ngffImage); // Write to OME-Zarr await toNgffZarr("output.ome.zarr", multiscales); ``` -------------------------------- ### Install ngff-zarr-mcp in Claude Code (uvx) Source: https://github.com/fideus-labs/ngff-zarr/blob/main/mcp/README.md Run this command in Claude Code to add ngff-zarr using uvx. ```sh claude mcp add ngff-zarr -- uvx ngff-zarr-mcp ``` -------------------------------- ### Install ngff-zarr with Traditional Tools Source: https://github.com/fideus-labs/ngff-zarr/blob/main/mcp/README.md Install ngff-zarr in development mode using pip and traditional tools. This method is an alternative to pixi for managing dependencies and running development tasks. ```bash # Clone and install in development mode git clone cd mcp/ pip install -e ".[all]" # Run tests pytest # Lint code black . ruff check . ``` -------------------------------- ### Python Import Pattern for Core Functions (Python) Source: https://github.com/fideus-labs/ngff-zarr/blob/main/AGENTS.md Example of importing core functions from the ngff_zarr library, emphasizing function-based imports over classes. ```python from ngff_zarr import from_ngff_zarr, to_ngff_zarr, to_multiscales ``` -------------------------------- ### Access metadata Source: https://github.com/fideus-labs/ngff-zarr/blob/main/docs/lif.md This example shows how to access and print metadata from a LIF image after converting it to an NgffImage object. ```APIDOC ## Access metadata This example shows how to access and print metadata from a LIF image after converting it to an NgffImage object. ```python from liffile import LifFile from ngff_zarr import lif_to_ngff_image with LifFile("microscopy_data.lif") as lif: for i, lif_image in enumerate(lif.images): ngff_image = lif_to_ngff_image(lif_image) print(f"\nSeries {i}: {lif_image.path}") print(f" Dimensions: {ngff_image.dims}") print(f" Shape: {ngff_image.data.shape}") print(f" Scale (pixel size): {ngff_image.scale}") print(f" Translation (origin): {ngff_image.translation}") # Access timestamps if available if ngff_image.attrs and "timestamps" in ngff_image.attrs: print(f" Timestamps: {ngff_image.attrs['timestamps']}") ``` ``` -------------------------------- ### Install ngff-zarr in Browser with Pyodide Source: https://github.com/fideus-labs/ngff-zarr/blob/main/docs/installation.md Install the ngff-zarr library within a browser environment using Pyodide, suitable for web-based applications or interactive consoles like the Pyodide REPL or JupyterLite. ```python import micropip await micropip.install('ngff-zarr') ``` -------------------------------- ### Python Development Commands (Bash) Source: https://github.com/fideus-labs/ngff-zarr/blob/main/CONTRIBUTING.md Commands for developing the Python package, including installation, testing, linting, and building documentation. ```bash cd py pixi install # Install dependencies pixi run test # Run test suite pixi run lint # Run linting pixi run build-docs # Build documentation ``` -------------------------------- ### MCP Server Development Commands (Bash) Source: https://github.com/fideus-labs/ngff-zarr/blob/main/CONTRIBUTING.md Commands for developing the MCP server package, including installation, testing, type checking, formatting, and linting. ```bash cd mcp pixi install # Install dependencies pixi run test # Run tests pixi run typecheck # Type checking (mypy) pixi run format # Format code pixi run lint # Run linting ``` -------------------------------- ### Complete Drug Screening Workflow Setup (v0.4) Source: https://github.com/fideus-labs/ngff-zarr/blob/main/docs/hcs.md Imports necessary modules for a drug screening workflow using ngff-zarr, including HCSPlate and to_hcs_zarr, and specific metadata components for version 0.4. ```python import ngff_zarr as nz import numpy as np from ngff_zarr import NgffImage, to_multiscales from ngff_zarr.hcs import HCSPlate, to_hcs_zarr from ngff_zarr.v04.zarr_metadata import * ``` -------------------------------- ### TypeScript Import Pattern for Core Functions (TypeScript) Source: https://github.com/fideus-labs/ngff-zarr/blob/main/AGENTS.md Example of importing core functions in TypeScript, using function-based exports and JSR imports. ```typescript import { fromNgffZarr, toNgffZarr } from "./io/from_ngff_zarr.ts"; ``` -------------------------------- ### Check ngff-zarr-mcp Help Source: https://github.com/fideus-labs/ngff-zarr/blob/main/mcp/README.md Verify that the ngff-zarr-mcp server starts correctly by checking its help message. This is part of troubleshooting general MCP client errors. ```bash uvx ngff-zarr-mcp --help ``` -------------------------------- ### Working with Different Store Types Source: https://github.com/fideus-labs/ngff-zarr/blob/main/docs/typescript.md Examples of using ngff-zarr with various storage backends, including in-memory maps, HTTP/HTTPS fetch stores, and file system stores. Note that file system stores are only available in Node.js or Deno environments. ```typescript import * as zarr from "zarrita"; import { fromNgffZarr } from "@fideus-labs/ngff-zarr"; // Memory store const memoryStore = new Map(); const ms1 = await fromNgffZarr(memoryStore); // Fetch store (HTTP/HTTPS) const fetchStore = new zarr.FetchStore("https://example.com/data.ome.zarr"); const ms2 = await fromNgffZarr(fetchStore); // File system store (Node.js/Deno only) import { FileSystemStore } from "@zarrita/storage"; const fsStore = new FileSystemStore("/path/to/data.ome.zarr"); const ms3 = await fromNgffZarr(fsStore); ``` -------------------------------- ### Convert Single Image to OME-Zarr via MCP Client Source: https://github.com/fideus-labs/ngff-zarr/blob/main/mcp/README.md Example of using the MCP client to convert a single TIFF image to OME-Zarr format with specified scale factors and compression. ```python # Through MCP client, the agent can: result = await convert_images_to_ome_zarr( input_paths=["image.tif"], output_path="output.ome.zarr", ome_zarr_version="0.4", scale_factors=[2, 4, 8], method="itkwasm_gaussian", compression_codec="zstd" ) ``` -------------------------------- ### Configure ngff-zarr MCP Server in Cursor (Direct Python) Source: https://github.com/fideus-labs/ngff-zarr/blob/main/mcp/README.md Configuration for ngff-zarr MCP server in Cursor using direct Python execution. This method involves installing the package and then running the server. ```json { "mcpServers": { "ngff-zarr": { "command": "python", "args": ["-m", "pip", "install", "ngff-zarr-mcp", "&&", "ngff-zarr-mcp"] } } } ``` -------------------------------- ### Create and Write HCS Plate (v0.4) Source: https://github.com/fideus-labs/ngff-zarr/blob/main/docs/hcs.md A complete example for creating an HCS plate structure and writing images to its wells using v0.4 metadata. Ensure all operations use the same version. ```python import ngff_zarr as nz import numpy as np from ngff_zarr.hcs import HCSPlate, to_hcs_zarr from ngff_zarr.v04.zarr_metadata import * # IMPORTANT: Define version once - all plate and well operations must use the same version ome_zarr_version = "0.4" # Create plate layout columns = [PlateColumn(name="1"), PlateColumn(name="2")] rows = [PlateRow(name="A"), PlateRow(name="B")] wells = [ PlateWell(path="A/1", rowIndex=0, columnIndex=0), PlateWell(path="A/2", rowIndex=0, columnIndex=1), PlateWell(path="B/1", rowIndex=1, columnIndex=0), PlateWell(path="B/2", rowIndex=1, columnIndex=1), ] plate_metadata = Plate( columns=columns, rows=rows, wells=wells, name="Example Plate v0.4", field_count=1, version=ome_zarr_version ) # Create synthetic image data data = np.random.randint(0, 255, size=(1, 1, 10, 256, 256), dtype=np.uint8) ngff_image = nz.NgffImage( data=data, dims=["t", "c", "z", "y", "x"], scale={"t": 1.0, "c": 1.0, "z": 0.5, "y": 0.325, "x": 0.325}, translation={"t": 0.0, "c": 0.0, "z": 0.0, "y": 0.0, "x": 0.0} ) multiscales = nz.to_multiscales(ngff_image) # First create the plate structure hcs_plate = HCSPlate(store="my_plate_v04.ome.zarr", plate_metadata=plate_metadata) to_hcs_zarr(hcs_plate, "my_plate_v04.ome.zarr") # Write images to each well (all must use same version as plate) for well in wells: row_name = rows[well.rowIndex].name col_name = columns[well.columnIndex].name nz.write_hcs_well_image( store="my_plate_v04.ome.zarr", multiscales=multiscales, plate_metadata=plate_metadata, row_name=row_name, column_name=col_name, field_index=0, version=ome_zarr_version, # Must match plate version ) # Verify the result plate = nz.from_hcs_zarr("my_plate_v04.ome.zarr") print(f"Created v0.4 plate with {len(plate.wells)} wells") ``` -------------------------------- ### Build Documentation Source: https://github.com/fideus-labs/ngff-zarr/blob/main/docs/development.md Build and update the project documentation if necessary. ```shell pixi run dev-docs ``` -------------------------------- ### Install cuCIM for GPU-accelerated ITKWASM Source: https://github.com/fideus-labs/ngff-zarr/blob/main/docs/methods.md Install the cuCIM package to enable NVIDIA CUDA GPU acceleration for ITKWASM downsampling methods. GPU-accelerated filtering is applied by default after installation. ```sh pip install itkwasm-downsample-cucim ``` -------------------------------- ### Build npm package and run browser tests Source: https://github.com/fideus-labs/ngff-zarr/blob/main/ts/README.md A convenience command to first build the npm package and then run the browser tests. ```bash deno task test:browser:npm ``` -------------------------------- ### Set Up Plate Structure with to_hcs_zarr Source: https://github.com/fideus-labs/ngff-zarr/blob/main/docs/hcs.md Create the HCS plate structure on disk using `to_hcs_zarr`. Ensure the `HCSPlate` object is initialized with the store path and plate metadata. ```python import ngff_zarr as nz from ngff_zarr.hcs import HCSPlate, to_hcs_zarr # Create the HCS plate structure hcs_plate = HCSPlate(store="my_screen.ome.zarr", plate_metadata=plate_metadata) to_hcs_zarr(hcs_plate, "my_screen.ome.zarr") ``` -------------------------------- ### Zarr Store Handling (Python) Source: https://github.com/fideus-labs/ngff-zarr/blob/main/AGENTS.md Python code demonstrating how to open Zarr stores, automatically detecting v2 or v3 and using the appropriate store type. ```python from zarr.storage import DirectoryStore, LocalStore # v2 vs v3 store = zarr.open.v2() if zarr_v2 else zarr.open() ``` -------------------------------- ### Initialize Results Table Source: https://github.com/fideus-labs/ngff-zarr/blob/main/ts/test/browser-npm/omero-benchmark.html Populates the results table with rows for each benchmark configuration, showing pending status and initial memory estimates. ```javascript function initResultsTable() { resultsBody.innerHTML = ""; BENCHMARK_CONFIGS.forEach((config) => { const elements = config.shape.reduce((a, b) => a * b, 1); const memoryMB = ((elements * 4) / (1024 * 1024)).toFixed(1); const row = document.createElement("tr"); row.id = `row-${config.name}`; row.innerHTML = ` ${config.name} ${elements.toLocaleString()} ${memoryMB} MB Pending - - - - `; resultsBody.appendChild(row); }); } ``` -------------------------------- ### Run tests with Deno Source: https://github.com/fideus-labs/ngff-zarr/blob/main/ts/README.md Execute the project's test suite using Deno. Ensure all tests pass to verify code integrity. ```bash deno test --allow-all ``` -------------------------------- ### Run browser tests with UI Source: https://github.com/fideus-labs/ngff-zarr/blob/main/ts/README.md Launch browser tests with an interactive UI for easier debugging and observation. ```bash deno task test:browser:ui ``` -------------------------------- ### Run Interactive Commit Helper (Bash) Source: https://github.com/fideus-labs/ngff-zarr/blob/main/CONTRIBUTING.md Use the interactive CLI to help create compliant commit messages. Navigate to the respective package directory first. ```bash cd py && pixi run commit # or from other directories: cd ts && pixi run commit cd mcp && pixi run commit ``` -------------------------------- ### Install ITK dependencies for ngff-zarr Source: https://github.com/fideus-labs/ngff-zarr/blob/main/docs/methods.md Install the necessary dependencies for using ITK-based downsampling methods with ngff-zarr. This includes native binary builds. ```sh pip install "ngff-zarr[itk]" ``` -------------------------------- ### Run All Pre-commit Hooks (Bash) Source: https://github.com/fideus-labs/ngff-zarr/blob/main/AGENTS.md Command to run all pre-commit hooks, including Ruff formatting and checking, from the 'py/' directory. Essential for AI agents to ensure code compliance. ```bash pixi run --as-is lint # from py/ directory — runs all pre-commit hooks ``` -------------------------------- ### Install ngff-zarr CLI Source: https://github.com/fideus-labs/ngff-zarr/blob/main/docs/cli.md Install the command line interface for ngff-zarr using pip. This command includes the necessary dependencies for CLI usage. ```shell pip install 'ngff-zarr[cli]' ``` -------------------------------- ### Run Test Suite Source: https://github.com/fideus-labs/ngff-zarr/blob/main/docs/development.md Execute the project's test suite using the pixi run command. ```shell pixi run test ``` -------------------------------- ### Install DASK_IMAGE dependencies for ngff-zarr Source: https://github.com/fideus-labs/ngff-zarr/blob/main/docs/methods.md Install the required dependencies for using DASK_IMAGE-based downsampling methods with ngff-zarr. This enables implementations based on dask-image and scipy. ```sh pip install "ngff-zarr[dask-image]" ``` -------------------------------- ### Run all tests including browser tests Source: https://github.com/fideus-labs/ngff-zarr/blob/main/ts/README.md Execute the complete test suite, encompassing both standard and browser-based tests. ```bash deno task test:all ``` -------------------------------- ### Run TypeScript Tests and Build Commands Source: https://github.com/fideus-labs/ngff-zarr/blob/main/AGENTS.md Commands for running Deno test suite, linting, formatting, building, browser compatibility tests, and type checking for the TypeScript package. ```bash cd ts && pixi run --as-is test # Deno test suite cd ts && pixi run --as-is lint # Deno lint cd ts && pixi run --as-is fmt # Deno format cd ts && pixi run --as-is build # Full build pipeline cd ts && pixi run --as-is test:browser # Browser compatibility tests cd ts && pixi run --as-is check # Type checking ``` -------------------------------- ### Write OME-Zarr Basic Example Source: https://github.com/fideus-labs/ngff-zarr/blob/main/docs/typescript.md Write an NgffMultiscales object to an OME-Zarr file using the toNgffZarr function. ```typescript // Basic writing await toNgffZarr("output.ome.zarr", multiscales); // With version specification await toNgffZarr("output.ome.zarr", multiscales, { version: "0.5" }); // With sharding (v0.5) await toNgffZarr("output.ome.zarr", multiscales, { version: "0.5", chunksPerShard: { z: 2, y: 2, x: 2 }, }); ``` -------------------------------- ### Install ngff-zarr-mcp in Claude Code (pip) Source: https://github.com/fideus-labs/ngff-zarr/blob/main/mcp/README.md Run this command in Claude Code to add ngff-zarr using pip. ```sh claude mcp add ngff-zarr -- python -m pip install ngff-zarr-mcp && ngff-zarr-mcp ``` -------------------------------- ### Install ngff-zarr-mcp in OpenCode Source: https://github.com/fideus-labs/ngff-zarr/blob/main/mcp/README.md Add this configuration to your OpenCode settings to enable ngff-zarr tools. Restart OpenCode after adding the configuration. ```json { "mcp": { "ngff-zarr": { "type": "local", "command": [ "python", "-c", "import subprocess; subprocess.run(['pip', 'install', 'ngff-zarr-mcp']); import ngff_zarr_mcp.server; ngff_zarr_mcp.server.main()" ], "enabled": true } } } ``` -------------------------------- ### Convert OME-Zarr Directory to .ozx File Source: https://github.com/fideus-labs/ngff-zarr/blob/main/docs/python.md Read an existing OME-Zarr directory store and write it as a portable .ozx file. This creates a single-file archive for easy distribution. ```python >>> # Read from directory store >>> multiscales = nz.from_ngff_zarr('cthead1.ome.zarr') >>> >>> # Write as .ozx file >>> nz.to_ngff_zarr('cthead1.ozx', multiscales) ``` -------------------------------- ### Build npm package with Deno Source: https://github.com/fideus-labs/ngff-zarr/blob/main/ts/README.md Create an npm-compatible package from the TypeScript code using Deno's build task. ```bash deno task build:npm ``` -------------------------------- ### Run MCP Server Tests and Development Commands Source: https://github.com/fideus-labs/ngff-zarr/blob/main/AGENTS.md Commands for testing, type checking, formatting, and running the MCP server in development mode for the MCP server package. ```bash cd mcp && pixi run --as-is test # Run MCP tests cd mcp && pixi run --as-is typecheck # mypy type checking cd mcp && pixi run --as-is format # Format code cd mcp && pixi run --as-is dev # Run MCP server in dev mode ``` -------------------------------- ### RFC-4 Metadata Format Example Source: https://github.com/fideus-labs/ngff-zarr/blob/main/docs/rfc4.md Shows the JSON structure for OME-NGFF metadata when RFC-4 is enabled, including the 'orientation' field for spatial axes. ```json { "axes": [ { "name": "z", "type": "space", "unit": "micrometer", "orientation": { "type": "anatomical", "value": "inferior-to-superior" } }, { "name": "y", "type": "space", "unit": "micrometer", "orientation": { "type": "anatomical", "value": "anterior-to-posterior" } }, { "name": "x", "type": "space", "unit": "micrometer", "orientation": { "type": "anatomical", "value": "right-to-left" } } ] } ``` -------------------------------- ### Generate Multiscale Pyramids Source: https://github.com/fideus-labs/ngff-zarr/blob/main/docs/typescript.md Create multiscale image pyramids with specified downsampling factors and methods. This example uses Gaussian downsampling and specifies chunking. ```typescript import { createNgffImage, toMultiscales, toNgffZarr, Methods, } from "@fideus-labs/ngff-zarr"; // Create base image const data = new Uint8Array(512 * 512); const image = createNgffImage( data.buffer, [512, 512], "uint8", ["y", "x"], { y: 1.0, x: 1.0 }, { y: 0.0, x: 0.0 } ); // Generate multiscale pyramid with 2x and 4x downsampling const multiscales = await toMultiscales(image, { scaleFactors: [2, 4], method: Methods.ITKWASM_GAUSSIAN, chunks: 128, }); // Write the pyramid await toNgffZarr("pyramid.ome.zarr", multiscales); ``` -------------------------------- ### Create NgffImage with LPS orientation Source: https://github.com/fideus-labs/ngff-zarr/blob/main/docs/rfc4.md Demonstrates how to create an NgffImage using the LPS convenience constant for axes orientations. This image is then converted to multiscales and written to a zarr store with RFC-4 enabled. ```python import ngff_zarr as nz import dask.array as da # Create image data data = da.zeros((100, 100, 100)) # Using the LPS convenience constant ngff_image = nz.NgffImage( data=data, dims=("z", "y", "x"), scale={"x": 1.0, "y": 1.0, "z": 1.0}, translation={"x": 0.0, "y": 0.0, "z": 0.0}, axes_orientations=nz.LPS ) # Convert to multiscales and write with RFC-4 enabled multiscales = nz.to_multiscales(ngff_image) nz.to_ngff_zarr( store="output.ome.zarr", multiscales=multiscales, enabled_rfcs=[4] ) ``` -------------------------------- ### Install ngff-zarr-mcp in Augment Code UI Source: https://github.com/fideus-labs/ngff-zarr/blob/main/mcp/README.md Use the Augment Code UI to add ngff-zarr-mcp by entering the command `uvx ngff-zarr-mcp` and naming the MCP 'ngff-zarr'. ```text uvx ngff-zarr-mcp ```