Skip to content

Gadgeton examples

Gadgetron is an open source project for medical image reconstruction and can be used with Tyger. These examples assume that you have ismrmrd installed.

Basic example

Generate some test data with:

bash
ismrmrd_generate_cartesian_shepp_logan

This will generate a testdata.h5 file. You can then run a reconstruction with:

bash
ismrmrd_hdf5_to_stream -i testdata.h5 --use-stdout \
| tyger run exec -f  basic_gadgetron.yml \
| ismrmrd_stream_to_hdf5 --use-stdin -o out_basic.h5

basic_gadgetron.yml looks like this:

yaml
job:
  codespec:
    image: ghcr.io/gadgetron/gadgetron/gadgetron_ubuntu_rt_nocuda:latest
    buffers:
      inputs:
        - input
      outputs:
        - output
    args:
      - "-c"
      - "default.xml"
      - "--from_stream"
      - "-i"
      - "$(INPUT_PIPE)"
      - "-o"
      - "$(OUTPUT_PIPE)"
    resources:
      requests:
        cpu: 1

Distributed reconstruction

Next is an example that uses a distributed run. First, download the raw data:

bash
curl -OL https://aka.ms/tyger/docs/samples/binning.h5

Then run:

bash
ismrmrd_hdf5_to_stream -i binning.h5 --use-stdout \
| tyger run exec -f  distributed_gadgetron.yml --logs \
| ismrmrd_stream_to_hdf5 --use-stdin -o out_binning.h5

distributed_gadgetron.yml looks like this:

yaml
job:
  codespec:
    image: ghcr.io/gadgetron/gadgetron/gadgetron_ubuntu_rt_nocuda:latest
    buffers:
      inputs:
        - input
      outputs:
        - output
    args:
      - "-c"
      - "CMR_2DT_RTCine_KspaceBinning_Cloud.xml"
      - "--from_stream"
      - "-i"
      - "$(INPUT_PIPE)"
      - "-o"
      - "$(OUTPUT_PIPE)"
    env:
      GADGETRON_REMOTE_WORKER_COMMAND: printenv TYGER_GADGETRON_WORKER_ENDPOINT_ADDRESSES
    resources:
      requests:
        cpu: 1

worker:
  codespec:
    image: ghcr.io/gadgetron/gadgetron/gadgetron_ubuntu_rt_nocuda:latest
    args: []
    endpoints:
      gadgetron: 9002
    resources:
      requests:
        cpu: 3000m
        memory: 4G
      limits:
        memory: 4G
  replicas: 2

This run is made up of a job with two worker replicas.