diff --git a/.devcontainer/Dockerfile b/.devcontainer/Dockerfile index 02a21c42..1033a4e3 100644 --- a/.devcontainer/Dockerfile +++ b/.devcontainer/Dockerfile @@ -1,4 +1,4 @@ -ARG DEVCONTAINER_BASE=mcr.microsoft.com/devcontainers/base:1.0.9-ubuntu-22.04 +ARG DEVCONTAINER_BASE=mcr.microsoft.com/devcontainers/base:2.1.5-ubuntu24.04 FROM ${DEVCONTAINER_BASE} AS devcontainer diff --git a/docs/reference/gadgetron/gadgetron.md b/docs/reference/gadgetron/gadgetron.md index 2dae70d6..bfde507d 100644 --- a/docs/reference/gadgetron/gadgetron.md +++ b/docs/reference/gadgetron/gadgetron.md @@ -1,4 +1,4 @@ -# Gadgeton examples +# Gadgetron examples [Gadgetron](https://github.com/gadgetron/gadgetron) is an open source project for medical image reconstruction and can be used with Tyger. These examples @@ -16,7 +16,7 @@ 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 \ +| tyger run exec -f basic_gadgetron.yml \ | ismrmrd_stream_to_hdf5 --use-stdin -o out_basic.h5 ``` @@ -26,6 +26,65 @@ ismrmrd_hdf5_to_stream -i testdata.h5 --use-stdout \ ``` +## Using dependent measurements + +It is common in MRI to perform a noise reference scan before the main scan. The +noise scan is used to estimate a noise covariance matrix and the subsequent scan +is reconstructed after noise pre-whitening using this covariance matrix. + +For this example, download the noise and main scan raw data files: + +```bash +curl -OL https://aka.ms/tyger/docs/samples/dependencies/noise_scan.h5 +curl -OL https://aka.ms/tyger/docs/samples/dependencies/main_scan.h5 +``` + +### Compute noise covariance matrix + +Start by creating buffers for the noise data and covariance matrix: + +```bash +noise_buffer_id=$(tyger buffer create) +noise_covariance_buffer_id=$(tyger buffer create) +``` + +Then write the noise data to the buffer: + +```bash +ismrmrd_hdf5_to_stream -i noise_scan.h5 --use-stdout \ + | tyger buffer write $noise_buffer_id +``` + +Now compute the noise covariance matrix using the two buffers: + +```bash +tyger run exec -f noise_gadgetron.yml \ + -b input=$noise_buffer_id \ + -b noisecovariance=$noise_covariance_buffer_id +``` + +`noise_gadgetron.yml` looks like this: +```yaml + +``` + +### Reconstruction + +We are ready to reconstruct the main scan data by referencing the noise +covariance matrix buffer: + +```bash +ismrmrd_hdf5_to_stream -i main_scan.h5 --use-stdout \ + | tyger run exec -f snr_gadgetron.yml --logs -b noisecovariance=$noise_covariance_buffer_id \ + | ismrmrd_stream_to_hdf5 --use-stdin -o main-scan-recon.h5 +``` + + +`snr_gadgetron.yml` looks like this (note the two input buffers): +```yaml + +``` + ## Distributed reconstruction Next is an example that uses a distributed run. First, download the raw data: @@ -38,7 +97,7 @@ Then run: ```bash ismrmrd_hdf5_to_stream -i binning.h5 --use-stdout \ -| tyger run exec -f distributed_gadgetron.yml --logs \ +| tyger run exec -f distributed_gadgetron.yml --logs \ | ismrmrd_stream_to_hdf5 --use-stdin -o out_binning.h5 ``` diff --git a/docs/reference/gadgetron/noise_gadgetron.yml b/docs/reference/gadgetron/noise_gadgetron.yml new file mode 100644 index 00000000..5e042aea --- /dev/null +++ b/docs/reference/gadgetron/noise_gadgetron.yml @@ -0,0 +1,20 @@ +job: + codespec: + image: ghcr.io/gadgetron/gadgetron/gadgetron_ubuntu_rt_nocuda:latest + buffers: + inputs: + - input + outputs: + - noisecovariance + args: + - "-c" + - "default_measurement_dependencies.xml" + - "--from_stream" + - "-i" + - "$(INPUT_PIPE)" + - "-o" + - /dev/null + - --disable_storage + - 'true' + - --parameter + - noisecovarianceout=$(NOISECOVARIANCE_PIPE) diff --git a/docs/reference/gadgetron/snr_gadgetron.yml b/docs/reference/gadgetron/snr_gadgetron.yml new file mode 100644 index 00000000..da5c5083 --- /dev/null +++ b/docs/reference/gadgetron/snr_gadgetron.yml @@ -0,0 +1,21 @@ +job: + codespec: + image: ghcr.io/gadgetron/gadgetron/gadgetron_ubuntu_rt_nocuda:latest + buffers: + inputs: + - input + - noisecovariance + outputs: + - output + args: + - "-c" + - "Generic_Cartesian_FFT.xml" + - "--from_stream" + - "-i" + - "$(INPUT_PIPE)" + - "-o" + - "$(OUTPUT_PIPE)" + - --disable_storage + - 'true' + - --parameter + - noisecovariancein=$(NOISECOVARIANCE_PIPE)