Skip to content

Command line utilities

Eyened ORM CLI

The Eyened ORM provides several command line utilities to help with development, testing, and maintenance. These commands are available through the eorm CLI tool.

Available Commands

database-mirror-test

Creates a test database for ORM testing, developing new features, or running alembic migrations. This command creates a database with the schema but only a subset of the data from the production database.

Terminal window
eorm database-mirror-test [OPTIONS]

database-mirror-full

Creates a complete test database with all data from the production database. This is useful when you need a full copy of the database for development or testing purposes.

Terminal window
eorm database-mirror-full [OPTIONS]

update-thumbnails

Updates thumbnails for all images in the database. This is useful when the thumbnail generation logic has changed or when thumbnails are missing.

Terminal window
eorm update-thumbnails [OPTIONS]

Options:

  • -e, --env PATH: Path to .env file for environment configuration (see Configuration)
  • --failed: Include images with failed thumbnails (empty ThumbnailPath) in addition to images with no thumbnails (NULL ThumbnailPath)

Usage:

By default, the command processes images where ThumbnailPath is NULL:

Terminal window
eorm update-thumbnails --env production.env

To also regenerate thumbnails for images where generation previously failed:

Terminal window
eorm update-thumbnails --failed --env production.env

Updating thumbnail generation code:

If you need to modify the thumbnail generation logic (e.g., to support new image types or change generation behavior):

  1. Update the thumbnail generation code in orm/eyened_orm/importer/thumbnails.py
  2. Test your changes using the test notebook
  3. For images that need regeneration, set their ThumbnailPath to NULL in the database
  4. Run the update command with the --failed flag to regenerate all thumbnails:
Terminal window
eorm update-thumbnails --failed --env production.env

run-models

Runs inference models on the database. This command processes images with the configured AI models.

Terminal window
eorm run-models [OPTIONS]

validate-forms

Validates form annotations and schemas in the database. This helps ensure that all form data is correctly structured and follows the defined schemas.

Terminal window
eorm validate-forms [OPTIONS]

zarr-tree

Displays the structure of the zarr store, showing groups and array shapes. This is useful for understanding the organization of segmentation data stored in zarr format.

Terminal window
eorm zarr-tree [OPTIONS]

defragment-zarr

Defragments the zarr store by copying all segmentations to a new store with sequential indices. This command creates a new zarr store and copies all existing segmentations to it, assigning new sequential ZarrArrayIndex values to eliminate gaps and improve storage efficiency.

Terminal window
eorm defragment-zarr [OPTIONS]

update-hashes

Updates FileChecksum and DataHash for all ImageInstances in the database where they are NULL. This maintains data integrity by ensuring all images have proper hash values.

Terminal window
eorm update-hashes [OPTIONS]

run-registration

Runs registration processing for images in the database. This command processes images to perform registration operations, which can be filtered by patient identifier, project ID, form schema, or creator.

Terminal window
eorm run-registration [OPTIONS]

Options:

  • -e, --env PATH: Path to .env file for environment configuration (see Configuration)
  • --patient PATIENT: Patient identifier to run registration for (optional)
  • --project PROJECT_ID: Project ID to run registration for (optional)
  • --schema SCHEMA_NAME: SchemaName to run registration for (default: “RegistrationSet”)
  • --creator CREATOR_NAME: CreatorName to run registration for (default: “registration model”)
  • --replace: Replace existing registration if it already exists

Usage:

To run registration for a specific patient:

Terminal window
eorm run-registration --env production.env --patient Patient_001

To run registration for all patients in a project:

Terminal window
eorm run-registration --env production.env --project 1

To run registration with custom schema and creator:

Terminal window
eorm run-registration --env production.env --schema "CustomRegistration" --creator "My Registration Model"