Skip to content

Backend Overview

FORGE Studio supports five reconstruction backends. Each backend corresponds to a different runtime environment.

BackendKeyRuntimeConfig format
PythonpythonExternal Python 3JSON
JuliajuliaExternal JuliaJSON
MATLABmatlabExternal MATLABJSON
MATLAB RuntimerunmatBundled MCR (read-only)JSON
FORGE (C++/CUDA)forgeBundled binariesCLI flags

How Backends Execute

Script Backends (Python, Julia, MATLAB)

Script backends use a persistent session model:

  1. On the first stage for a backend, FORGE Studio spawns the interpreter with the forge_dispatcher script.
  2. The dispatcher signals ready via the FORGE_RESP: protocol on stdout.
  3. For each step, FORGE Studio writes a JSON config file and sends a run command to the session.
  4. The dispatcher loads and calls your module's run() function.
  5. Progress, logs, convergence metrics, and image previews are streamed back in real time via FORGE_RESP: events.
  6. Subsequent stages on the same backend reuse the same session — cold-start latency only once per job.
FORGE Studio (Node.js)

  │─── stdin: {"type":"run","module_path":"...","config_path":"..."} ───►
  │                                                                      │
  │◄── stdout: FORGE_RESP:{"type":"log","message":"starting"} ──────────│
  │◄── stdout: FORGE_RESP:{"type":"progress_tick",...} ─────────────────│
  │◄── stdout: FORGE_RESP:{"type":"ok","output_paths":["..."]} ─────────│
interpreter process

FORGE Backend

FORGE binaries are invoked directly as child processes with CLI flags — no persistent session. Each stage spawns a new process. Progress and metrics are read from stderr as JSONL events.


Config File

For script backends, FORGE Studio writes a JSON config file to the stage output directory before calling run(). Your module receives the path as its only argument.

json
{
  "job_id": "abc-123",
  "step_id": "espirit_calib",
  "stage_index": 0,
  "input_paths": ["/data/scan.dat"],
  "output_dir": "/output/stage_0_sensitivity_calibration",
  "input_format": "twix",
  "channels": 32,
  "params": {
    "calibration_size": 24,
    "use_gpu": true
  }
}

See Config Format Reference → for the full field list.


Stage Chaining

Each stage receives the outputs of the previous stage as its input_paths. Stage 0 receives the original raw file. This enables multi-stage pipelines where, for example:

  • Stage 0 (Python): reads TWIX, produces calibration maps → .npy
  • Stage 1 (FORGE): reads calibration maps, produces reconstruction → .nii
  • Stage 2 (Julia): reads NIfTI, applies post-processing → .nii

input_format is detected from the file extension of input_paths[0]:

ExtensionFormat value
.dattwix
.h5, .hdf5ismrmrd
.matmat
.jld2jld2
.npy, .npznpy / npz

Configuring Backend Paths

Go to Settings → Backends to set or override the executable path for each backend. Paths are auto-detected at startup but can be overridden:

  • Browse — opens a file picker to select the executable.
  • Validate — checks the path and reports the detected version.

Detection order (macOS):

  • MATLAB: /Applications/MATLAB_*.app, then PATH
  • Python: python3 on PATH, then common Homebrew/pyenv paths
  • Julia: /Applications/Julia-*.app, then PATH

Compute Backend (FORGE)

FORGE binaries are available in three variants, selected automatically based on hardware:

VariantPlatform
metalApple Silicon (macOS)
cudaNVIDIA GPU (Linux)
cpuAny (fallback)

Override in Settings → Compute Backend.

FORGE Studio