Skip to content

Latest commit

 

History

History
134 lines (82 loc) · 6.27 KB

File metadata and controls

134 lines (82 loc) · 6.27 KB

Back to Projects List

OHIF-v3 Mode Gallery

Key Investigators

  • Alireza Sedghi (OHIF)
  • James Petts (OHIF)
  • Erik Ziegler (OHIF)

Project Description

OHIF-v3 architecture has been re-designed to enable building applications that are easily extensible to various use cases (Modes) that behind the scene would utilize desired functionalities (Extensions) to reach the goal of the use case. A mode can be thought of as a viewer app configured to perform a specific task, such as tracking measurements over time, 3D segmentation, a guided radiological workflow, etc. Addition of modes enables application with many applications as each mode become a mini app configuration behind the scene.

Currently OHIF developers have to copy paste the source code of a sample Mode/Extension and edit the source code to let OHIF know about the new Mode/Extension they are developing, which has its limitations. The purpose of this project is to overcome this by enabling self-registration of Modes and Extensions and provide a ohif-cli tool to automatically generate templates and link Mode/Extension(s) internally.

Objectives

  • Create a CLI tool for making new extensions/modes (similar to e.g. create-react-app), and automagically installing extensions/modes from npm and including them in the source.
    • Commands to include:
      • create-mode, create-extension : for generating template extension and mode
      • add-mode, add-extension : for adding mode/extensions to OHIF (either linking locally or installing published modes and extensions from npm)
      • remove-extension, remove-mode : same above but for removing
      • list : list all extensions and modes that are installed in OHIF
  • Update OHIF to dynamically install extensions and modes from config files rather than having to hard code their inclusion.
    • For example one could install OHIF, then a set of modes/extensions, programmatically.
  • Parse information from npm to populate the markdown of the OHIF page for installable modes and extensions.

Stretch Goals:

  • Versioning errors + conflict resolution for mode dependencies.
  • Installing a mode installs required extensions.
  • Type the contract interfaces for extensions and modes in typescript.

Super stretch goal: type all the things

Approach and Plan

Complete all of the primary objectives as fast as possible and then play with the stretch goals.

Progress and Next Steps

Primary Goals

Core:

  • Self registering extensions from configuration JSON (dynamically build JavaScript required in node and inject these files at build time ).
  • Basic CLI tool codebase.
  • Basic working create-mode command.
  • Basic working create-extension command.
  • Basic working add-mode, remove-mode commands.
  • Basic working add-extension, remove-extension commands.
  • Basic list command.
  • Test CLI tools with actual extensions.
  • WIP Documentation in the docs

Gallery

  • Example mode and extension + publish to NPM. (@ohif-test/mode-clock , @ohif-test/mode-extension)
  • Create mode gallery page which consumes markdown files to generate a page with a title, description, dependencies, images and copyable install commands.

Stretch Goals

Stretch Goals

Core:

  • Installing a mode installs required extensions (not versioned).
  • Augment mode schema to optionally specify semantic version for required ohif-extensions.
  • Automatically download extensions of correct version when installing modes.
  • WIP Verify that npm packages fetched by CLI are actually conforming to extensions/modes so we don't just cross our fingers.
  • WIP Error handling for extension conflicts.
  • Error handling when constructing modes at runtime for missing extensions/extension version mismatches.
  • Type mode and extension schema and make these types publically available somewhere.
  • Add the type contracts to the templates produced by ohif-cli create-extension and ohif-cli create-mode.

Gallery:

  • Create "whitelist" for extensions.
  • Parse information from npm repo for whitelisted extensions to populate ohif-modes gallery page.
  • Search NPM for ohif-extension and ohif-mode keywords within cli and show name and short description

Illustrations

CLI illustrations

  1. create-mode command to create a new template to write modes

drawing

It generates the template files for you to write your own mode

image

  1. create-extension command to create a new template to write extensions.

drawing

It also generates template for an extension

image

  1. add-mode <mode-name> will install any ohif-mode that has been published on npm registry and make it available on OHIF.

ezgif com-gif-maker (11)

After installation the mode becomes avaiable.

  1. remove-mode <mode-name>

ezgif com-gif-maker (12)

  1. search will search in all npm packages for those who have ohif-extension or ohif-mode in their keywords and display their information

drawing

  1. OHIF website update

Using Github GraphQL we showcase a list of modes that are published on the npm registry.

image

The README file of each mode repository is fetched and shown in its detailed page

image

Background and References