Binning

Description

This example described how to perform data binning with different number of profiles which is generaly used for self-gating acquisition in order to reconstruct images along the cardiac/respiratory cycle :

  1. Trotier AJ, Castets CR, Lefrançois W, et al. USPIO-enhanced 3D-cine self-gated cardiac MRI based on a stack-of-stars golden angle short echo time sequence: Application on mice with acute myocardial infarction. Journal of Magnetic Resonance Imaging 2016;44:355–365 doi: 10.1002/jmri.25150.
  2. Ribot EJ, Duriez TJ, Trotier AJ, Thiaudiere E, Franconi J-M, Miraux S. Self-gated bSSFP sequences to detect iron-labeled cancer cells and/or metastases in vivo in mouse liver at 7 Tesla. Journal of Magnetic Resonance Imaging 2015;41:1413–1421 doi: 10.1002/jmri.24688.

Here, we will create a simulated 2D radial acquisition and split the projections in 2 parts along the contrast dimension. The number of projection into each bin will be different to show how MRIReco handle that case.

Setup

using CairoMakie
using ImageUtils: shepp_logan
using MRIReco, MRISimulation

function plot_im2D(im2D;title::String="")
    f = Figure()
    ax = Axis(f[1, 1],aspect = DataAspect(), yreversed = true, title = title)
    image!(ax, im2D')
    hidedecorations!(ax, grid = false)
    f
end
plot_im2D (generic function with 1 method)

Simulate a radial acquisition

N = 256
x = shepp_logan(N)

params = Dict{Symbol, Any}()
params[:simulation] = "fast"
params[:trajName] = "Radial"
params[:numProfiles] = round(Int64,400)
params[:numSamplingPerProfile] = round(Int64,N)

acqRad = simulation(x, params)
rawRad = RawAcquisitionData(acqRad)
RawAcquisitionData(Dict{String, Any}("H1resonanceFrequency_Hz" => 1, "encodedFOV" => [0.0, 0.0, 0.0], "receiverChannels" => 1, "encodedSize" => [256, 256], "trajectory" => "Radial"), Profile[Profile(AcquisitionHeader(0x0000, 0x0000000000000000, 0x00000000, 0x00000001, 0x00000000, (0x00000000, 0x00000000, 0x00000000), 0x0100, 0x0001, 0x0001, (0x0000000000000000, 0x0000000000000000, 0x0000000000000000, 0x0000000000000000, 0x0000000000000000, 0x0000000000000000, 0x0000000000000000, 0x0000000000000000, 0x0000000000000000, 0x0000000000000000, 0x0000000000000000, 0x0000000000000000, 0x0000000000000000, 0x0000000000000000, 0x0000000000000000, 0x0000000000000000), 0x0000, 0x0000, 0x0000, 0x0000, 0x0002, 3.90625f0, (0.0f0, 0.0f0, 0.0f0), (1.0f0, 0.0f0, 0.0f0), (0.0f0, 1.0f0, 0.0f0), (0.0f0, 0.0f0, 1.0f0), (0.0f0, 0.0f0, 0.0f0), EncodingCounters(0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, (0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000)), (0, 0, 0, 0, 0, 0, 0, 0), (0.0f0, 0.0f0, 0.0f0, 0.0f0, 0.0f0, 0.0f0, 0.0f0, 0.0f0)), Float32[0.5 0.49609375 … -0.4921875 -0.49609375; 0.0 0.0 … -0.0 -0.0], ComplexF32[14.993935f0 - 0.014462396f0im; -2.745702f0 - 17.48758f0im; … ; -1.7356578f0 + 1.6820171f0im; -2.7453408f0 + 17.487709f0im;;]), Profile(AcquisitionHeader(0x0000, 0x0000000000000000, 0x00000000, 0x00000002, 0x00000000, (0x00000000, 0x00000000, 0x00000000), 0x0100, 0x0001, 0x0001, (0x0000000000000000, 0x0000000000000000, 0x0000000000000000, 0x0000000000000000, 0x0000000000000000, 0x0000000000000000, 0x0000000000000000, 0x0000000000000000, 0x0000000000000000, 0x0000000000000000, 0x0000000000000000, 0x0000000000000000, 0x0000000000000000, 0x0000000000000000, 0x0000000000000000, 0x0000000000000000), 0x0000, 0x0000, 0x0000, 0x0000, 0x0002, 3.90625f0, (0.0f0, 0.0f0, 0.0f0), (1.0f0, 0.0f0, 0.0f0), (0.0f0, 1.0f0, 0.0f0), (0.0f0, 0.0f0, 1.0f0), (0.0f0, 0.0f0, 0.0f0), EncodingCounters(0x0001, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, (0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000)), (0, 0, 0, 0, 0, 0, 0, 0), (0.0f0, 0.0f0, 0.0f0, 0.0f0, 0.0f0, 0.0f0, 0.0f0, 0.0f0)), Float32[-0.4999846 -0.49607846 … 0.49217233 0.49607846; -0.0039269505 -0.003896271 … 0.003865592 0.003896271], ComplexF32[5.082206f0 - 0.46051154f0im; -7.301943f0 - 3.8703349f0im; … ; 4.533107f0 - 5.784494f0im; -7.301943f0 + 3.8703349f0im;;]), Profile(AcquisitionHeader(0x0000, 0x0000000000000000, 0x00000000, 0x00000003, 0x00000000, (0x00000000, 0x00000000, 0x00000000), 0x0100, 0x0001, 0x0001, (0x0000000000000000, 0x0000000000000000, 0x0000000000000000, 0x0000000000000000, 0x0000000000000000, 0x0000000000000000, 0x0000000000000000, 0x0000000000000000, 0x0000000000000000, 0x0000000000000000, 0x0000000000000000, 0x0000000000000000, 0x0000000000000000, 0x0000000000000000, 0x0000000000000000, 0x0000000000000000), 0x0000, 0x0000, 0x0000, 0x0000, 0x0002, 3.90625f0, (0.0f0, 0.0f0, 0.0f0), (1.0f0, 0.0f0, 0.0f0), (0.0f0, 1.0f0, 0.0f0), (0.0f0, 0.0f0, 1.0f0), (0.0f0, 0.0f0, 0.0f0), EncodingCounters(0x0002, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, (0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000)), (0, 0, 0, 0, 0, 0, 0, 0), (0.0f0, 0.0f0, 0.0f0, 0.0f0, 0.0f0, 0.0f0, 0.0f0, 0.0f0)), Float32[0.4999383 0.49603254 … -0.4921268 -0.49603254; 0.007853659 0.007792302 … -0.007730945 -0.007792302], ComplexF32[2.961479f0 + 1.6425503f0im; -9.065082f0 + 19.113466f0im; … ; 8.297119f0 + 6.7589464f0im; -9.065082f0 - 19.113466f0im;;]), Profile(AcquisitionHeader(0x0000, 0x0000000000000000, 0x00000000, 0x00000004, 0x00000000, (0x00000000, 0x00000000, 0x00000000), 0x0100, 0x0001, 0x0001, (0x0000000000000000, 0x0000000000000000, 0x0000000000000000, 0x0000000000000000, 0x0000000000000000, 0x0000000000000000, 0x0000000000000000, 0x0000000000000000, 0x0000000000000000, 0x0000000000000000, 0x0000000000000000, 0x0000000000000000, 0x0000000000000000, 0x0000000000000000, 0x0000000000000000, 0x0000000000000000), 0x0000, 0x0000, 0x0000, 0x0000, 0x0002, 3.90625f0, (0.0f0, 0.0f0, 0.0f0), (1.0f0, 0.0f0, 0.0f0), (0.0f0, 1.0f0, 0.0f0), (0.0f0, 0.0f0, 1.0f0), (0.0f0, 0.0f0, 0.0f0), EncodingCounters(0x0003, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, (0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000)), (0, 0, 0, 0, 0, 0, 0, 0), (0.0f0, 0.0f0, 0.0f0, 0.0f0, 0.0f0, 0.0f0, 0.0f0, 0.0f0)), Float32[-0.4998612 -0.49595606 … 0.4920509 0.49595606; -0.011779882 -0.011687852 … 0.011595822 0.011687852], ComplexF32[16.566261f0 - 2.3455367f0im; -2.9743297f0 + 6.258768f0im; … ; 0.7448429f0 + 0.29103297f0im; -2.9743297f0 - 6.258768f0im;;]), Profile(AcquisitionHeader(0x0000, 0x0000000000000000, 0x00000000, 0x00000005, 0x00000000, (0x00000000, 0x00000000, 0x00000000), 0x0100, 0x0001, 0x0001, (0x0000000000000000, 0x0000000000000000, 0x0000000000000000, 0x0000000000000000, 0x0000000000000000, 0x0000000000000000, 0x0000000000000000, 0x0000000000000000, 0x0000000000000000, 0x0000000000000000, 0x0000000000000000, 0x0000000000000000, 0x0000000000000000, 0x0000000000000000, 0x0000000000000000, 0x0000000000000000), 0x0000, 0x0000, 0x0000, 0x0000, 0x0002, 3.90625f0, (0.0f0, 0.0f0, 0.0f0), (1.0f0, 0.0f0, 0.0f0), (0.0f0, 1.0f0, 0.0f0), (0.0f0, 0.0f0, 1.0f0), (0.0f0, 0.0f0, 0.0f0), EncodingCounters(0x0004, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, (0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000)), (0, 0, 0, 0, 0, 0, 0, 0), (0.0f0, 0.0f0, 0.0f0, 0.0f0, 0.0f0, 0.0f0, 0.0f0, 0.0f0)), Float32[0.49975327 0.49584895 … -0.49194464 -0.49584895; 0.015705379 0.015582682 … -0.015459983 -0.015582682], ComplexF32[9.999771f0 + 2.6336045f0im; -4.0890183f0 - 13.689984f0im; … ; 0.23596795f0 - 1.4290216f0im; -4.0890183f0 + 13.689984f0im;;]), Profile(AcquisitionHeader(0x0000, 0x0000000000000000, 0x00000000, 0x00000006, 0x00000000, (0x00000000, 0x00000000, 0x00000000), 0x0100, 0x0001, 0x0001, (0x0000000000000000, 0x0000000000000000, 0x0000000000000000, 0x0000000000000000, 0x0000000000000000, 0x0000000000000000, 0x0000000000000000, 0x0000000000000000, 0x0000000000000000, 0x0000000000000000, 0x0000000000000000, 0x0000000000000000, 0x0000000000000000, 0x0000000000000000, 0x0000000000000000, 0x0000000000000000), 0x0000, 0x0000, 0x0000, 0x0000, 0x0002, 3.90625f0, (0.0f0, 0.0f0, 0.0f0), (1.0f0, 0.0f0, 0.0f0), (0.0f0, 1.0f0, 0.0f0), (0.0f0, 0.0f0, 1.0f0), (0.0f0, 0.0f0, 0.0f0), EncodingCounters(0x0005, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, (0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000)), (0, 0, 0, 0, 0, 0, 0, 0), (0.0f0, 0.0f0, 0.0f0, 0.0f0, 0.0f0, 0.0f0, 0.0f0, 0.0f0)), Float32[-0.4996145 -0.49571127 … 0.49180803 0.49571127; -0.019629909 -0.01947655 … 0.01932319 0.01947655], ComplexF32[-3.4125814f0 - 6.9961543f0im; -8.001315f0 - 12.458125f0im; … ; 8.93454f0 - 3.6784592f0im; -8.001315f0 + 12.458125f0im;;]), Profile(AcquisitionHeader(0x0000, 0x0000000000000000, 0x00000000, 0x00000007, 0x00000000, (0x00000000, 0x00000000, 0x00000000), 0x0100, 0x0001, 0x0001, (0x0000000000000000, 0x0000000000000000, 0x0000000000000000, 0x0000000000000000, 0x0000000000000000, 0x0000000000000000, 0x0000000000000000, 0x0000000000000000, 0x0000000000000000, 0x0000000000000000, 0x0000000000000000, 0x0000000000000000, 0x0000000000000000, 0x0000000000000000, 0x0000000000000000, 0x0000000000000000), 0x0000, 0x0000, 0x0000, 0x0000, 0x0002, 3.90625f0, (0.0f0, 0.0f0, 0.0f0), (1.0f0, 0.0f0, 0.0f0), (0.0f0, 1.0f0, 0.0f0), (0.0f0, 0.0f0, 1.0f0), (0.0f0, 0.0f0, 0.0f0), EncodingCounters(0x0006, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, (0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000)), (0, 0, 0, 0, 0, 0, 0, 0), (0.0f0, 0.0f0, 0.0f0, 0.0f0, 0.0f0, 0.0f0, 0.0f0, 0.0f0)), Float32[0.49944493 0.49554303 … -0.4916411 -0.49554303; 0.023553226 0.023369215 … -0.023185207 -0.023369215], ComplexF32[5.817503f0 + 8.687793f0im; -6.0875187f0 + 7.5072694f0im; … ; 7.8041325f0 + 3.3605914f0im; -6.0875187f0 - 7.5072694f0im;;]), Profile(AcquisitionHeader(0x0000, 0x0000000000000000, 0x00000000, 0x00000008, 0x00000000, (0x00000000, 0x00000000, 0x00000000), 0x0100, 0x0001, 0x0001, (0x0000000000000000, 0x0000000000000000, 0x0000000000000000, 0x0000000000000000, 0x0000000000000000, 0x0000000000000000, 0x0000000000000000, 0x0000000000000000, 0x0000000000000000, 0x0000000000000000, 0x0000000000000000, 0x0000000000000000, 0x0000000000000000, 0x0000000000000000, 0x0000000000000000, 0x0000000000000000), 0x0000, 0x0000, 0x0000, 0x0000, 0x0002, 3.90625f0, (0.0f0, 0.0f0, 0.0f0), (1.0f0, 0.0f0, 0.0f0), (0.0f0, 1.0f0, 0.0f0), (0.0f0, 0.0f0, 1.0f0), (0.0f0, 0.0f0, 0.0f0), EncodingCounters(0x0007, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, (0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000)), (0, 0, 0, 0, 0, 0, 0, 0), (0.0f0, 0.0f0, 0.0f0, 0.0f0, 0.0f0, 0.0f0, 0.0f0, 0.0f0)), Float32[-0.49924454 -0.4953442 … 0.49144384 0.4953442; -0.02747509 -0.027260441 … 0.027045792 0.027260441], ComplexF32[11.766594f0 - 3.1228037f0im; -8.0251f0 + 19.106346f0im; … ; 2.1835642f0 + 2.4805624f0im; -8.0251f0 - 19.106346f0im;;]), Profile(AcquisitionHeader(0x0000, 0x0000000000000000, 0x00000000, 0x00000009, 0x00000000, (0x00000000, 0x00000000, 0x00000000), 0x0100, 0x0001, 0x0001, (0x0000000000000000, 0x0000000000000000, 0x0000000000000000, 0x0000000000000000, 0x0000000000000000, 0x0000000000000000, 0x0000000000000000, 0x0000000000000000, 0x0000000000000000, 0x0000000000000000, 0x0000000000000000, 0x0000000000000000, 0x0000000000000000, 0x0000000000000000, 0x0000000000000000, 0x0000000000000000), 0x0000, 0x0000, 0x0000, 0x0000, 0x0002, 3.90625f0, (0.0f0, 0.0f0, 0.0f0), (1.0f0, 0.0f0, 0.0f0), (0.0f0, 1.0f0, 0.0f0), (0.0f0, 0.0f0, 1.0f0), (0.0f0, 0.0f0, 0.0f0), EncodingCounters(0x0008, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, (0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000)), (0, 0, 0, 0, 0, 0, 0, 0), (0.0f0, 0.0f0, 0.0f0, 0.0f0, 0.0f0, 0.0f0, 0.0f0, 0.0f0)), Float32[0.49901336 0.49511483 … -0.49121627 -0.49511483; 0.03139526 0.031149983 … -0.030904708 -0.031149983], ComplexF32[1.8170606f0 + 6.1379848f0im; -10.68053f0 - 7.014571f0im; … ; 7.586608f0 - 6.249012f0im; -10.68053f0 + 7.014571f0im;;]), Profile(AcquisitionHeader(0x0000, 0x0000000000000000, 0x00000000, 0x0000000a, 0x00000000, (0x00000000, 0x00000000, 0x00000000), 0x0100, 0x0001, 0x0001, (0x0000000000000000, 0x0000000000000000, 0x0000000000000000, 0x0000000000000000, 0x0000000000000000, 0x0000000000000000, 0x0000000000000000, 0x0000000000000000, 0x0000000000000000, 0x0000000000000000, 0x0000000000000000, 0x0000000000000000, 0x0000000000000000, 0x0000000000000000, 0x0000000000000000, 0x0000000000000000), 0x0000, 0x0000, 0x0000, 0x0000, 0x0002, 3.90625f0, (0.0f0, 0.0f0, 0.0f0), (1.0f0, 0.0f0, 0.0f0), (0.0f0, 1.0f0, 0.0f0), (0.0f0, 0.0f0, 1.0f0), (0.0f0, 0.0f0, 0.0f0), EncodingCounters(0x0009, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, (0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000)), (0, 0, 0, 0, 0, 0, 0, 0), (0.0f0, 0.0f0, 0.0f0, 0.0f0, 0.0f0, 0.0f0, 0.0f0, 0.0f0)), Float32[-0.4987514 -0.4948549 … 0.49095842 0.4948549; -0.035313495 -0.035037607 … 0.03476172 0.035037607], ComplexF32[2.5731554f0 - 12.080997f0im; -5.5287757f0 - 6.6514955f0im; … ; 12.245896f0 + 7.3431664f0im; -5.5287757f0 + 6.6514955f0im;;])  …  Profile(AcquisitionHeader(0x0000, 0x0000000000000000, 0x00000000, 0x00000187, 0x00000000, (0x00000000, 0x00000000, 0x00000000), 0x0100, 0x0001, 0x0001, (0x0000000000000000, 0x0000000000000000, 0x0000000000000000, 0x0000000000000000, 0x0000000000000000, 0x0000000000000000, 0x0000000000000000, 0x0000000000000000, 0x0000000000000000, 0x0000000000000000, 0x0000000000000000, 0x0000000000000000, 0x0000000000000000, 0x0000000000000000, 0x0000000000000000, 0x0000000000000000), 0x0000, 0x0000, 0x0000, 0x0000, 0x0002, 3.90625f0, (0.0f0, 0.0f0, 0.0f0), (1.0f0, 0.0f0, 0.0f0), (0.0f0, 1.0f0, 0.0f0), (0.0f0, 0.0f0, 1.0f0), (0.0f0, 0.0f0, 0.0f0), EncodingCounters(0x0186, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, (0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000)), (0, 0, 0, 0, 0, 0, 0, 0), (0.0f0, 0.0f0, 0.0f0, 0.0f0, 0.0f0, 0.0f0, 0.0f0, 0.0f0)), Float32[-0.49845865 -0.49456444 … 0.49067026 0.49456444; 0.03922955 0.038923066 … -0.038616586 -0.038923066], ComplexF32[10.05843f0 - 1.3539083f0im; -8.455272f0 + 16.258371f0im; … ; 11.0733595f0 + 8.79255f0im; -8.455272f0 - 16.258371f0im;;]), Profile(AcquisitionHeader(0x0000, 0x0000000000000000, 0x00000000, 0x00000188, 0x00000000, (0x00000000, 0x00000000, 0x00000000), 0x0100, 0x0001, 0x0001, (0x0000000000000000, 0x0000000000000000, 0x0000000000000000, 0x0000000000000000, 0x0000000000000000, 0x0000000000000000, 0x0000000000000000, 0x0000000000000000, 0x0000000000000000, 0x0000000000000000, 0x0000000000000000, 0x0000000000000000, 0x0000000000000000, 0x0000000000000000, 0x0000000000000000, 0x0000000000000000), 0x0000, 0x0000, 0x0000, 0x0000, 0x0002, 3.90625f0, (0.0f0, 0.0f0, 0.0f0), (1.0f0, 0.0f0, 0.0f0), (0.0f0, 1.0f0, 0.0f0), (0.0f0, 0.0f0, 1.0f0), (0.0f0, 0.0f0, 0.0f0), EncodingCounters(0x0187, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, (0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000)), (0, 0, 0, 0, 0, 0, 0, 0), (0.0f0, 0.0f0, 0.0f0, 0.0f0, 0.0f0, 0.0f0, 0.0f0, 0.0f0)), Float32[0.4987514 0.4948549 … -0.49095842 -0.4948549; -0.035313495 -0.035037607 … 0.03476172 0.035037607], ComplexF32[5.536305f0 + 12.6587925f0im; -2.594134f0 + 6.632514f0im; … ; 15.055162f0 - 2.1961787f0im; -2.594134f0 - 6.632514f0im;;]), Profile(AcquisitionHeader(0x0000, 0x0000000000000000, 0x00000000, 0x00000189, 0x00000000, (0x00000000, 0x00000000, 0x00000000), 0x0100, 0x0001, 0x0001, (0x0000000000000000, 0x0000000000000000, 0x0000000000000000, 0x0000000000000000, 0x0000000000000000, 0x0000000000000000, 0x0000000000000000, 0x0000000000000000, 0x0000000000000000, 0x0000000000000000, 0x0000000000000000, 0x0000000000000000, 0x0000000000000000, 0x0000000000000000, 0x0000000000000000, 0x0000000000000000), 0x0000, 0x0000, 0x0000, 0x0000, 0x0002, 3.90625f0, (0.0f0, 0.0f0, 0.0f0), (1.0f0, 0.0f0, 0.0f0), (0.0f0, 1.0f0, 0.0f0), (0.0f0, 0.0f0, 1.0f0), (0.0f0, 0.0f0, 0.0f0), EncodingCounters(0x0188, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, (0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000)), (0, 0, 0, 0, 0, 0, 0, 0), (0.0f0, 0.0f0, 0.0f0, 0.0f0, 0.0f0, 0.0f0, 0.0f0, 0.0f0)), Float32[-0.49901336 -0.49511483 … 0.49121627 0.49511483; 0.03139526 0.031149983 … -0.030904708 -0.031149983], ComplexF32[3.3057163f0 - 6.911439f0im; -10.649474f0 + 5.8795266f0im; … ; 9.651593f0 + 2.8329146f0im; -10.649474f0 - 5.8795266f0im;;]), Profile(AcquisitionHeader(0x0000, 0x0000000000000000, 0x00000000, 0x0000018a, 0x00000000, (0x00000000, 0x00000000, 0x00000000), 0x0100, 0x0001, 0x0001, (0x0000000000000000, 0x0000000000000000, 0x0000000000000000, 0x0000000000000000, 0x0000000000000000, 0x0000000000000000, 0x0000000000000000, 0x0000000000000000, 0x0000000000000000, 0x0000000000000000, 0x0000000000000000, 0x0000000000000000, 0x0000000000000000, 0x0000000000000000, 0x0000000000000000, 0x0000000000000000), 0x0000, 0x0000, 0x0000, 0x0000, 0x0002, 3.90625f0, (0.0f0, 0.0f0, 0.0f0), (1.0f0, 0.0f0, 0.0f0), (0.0f0, 1.0f0, 0.0f0), (0.0f0, 0.0f0, 1.0f0), (0.0f0, 0.0f0, 0.0f0), EncodingCounters(0x0189, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, (0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000)), (0, 0, 0, 0, 0, 0, 0, 0), (0.0f0, 0.0f0, 0.0f0, 0.0f0, 0.0f0, 0.0f0, 0.0f0, 0.0f0)), Float32[0.49924454 0.4953442 … -0.49144384 -0.4953442; -0.02747509 -0.027260441 … 0.027045792 0.027260441], ComplexF32[12.007651f0 + 0.31225017f0im; -10.996951f0 - 18.835096f0im; … ; 3.1901186f0 - 2.1595764f0im; -10.996951f0 + 18.835096f0im;;]), Profile(AcquisitionHeader(0x0000, 0x0000000000000000, 0x00000000, 0x0000018b, 0x00000000, (0x00000000, 0x00000000, 0x00000000), 0x0100, 0x0001, 0x0001, (0x0000000000000000, 0x0000000000000000, 0x0000000000000000, 0x0000000000000000, 0x0000000000000000, 0x0000000000000000, 0x0000000000000000, 0x0000000000000000, 0x0000000000000000, 0x0000000000000000, 0x0000000000000000, 0x0000000000000000, 0x0000000000000000, 0x0000000000000000, 0x0000000000000000, 0x0000000000000000), 0x0000, 0x0000, 0x0000, 0x0000, 0x0002, 3.90625f0, (0.0f0, 0.0f0, 0.0f0), (1.0f0, 0.0f0, 0.0f0), (0.0f0, 1.0f0, 0.0f0), (0.0f0, 0.0f0, 1.0f0), (0.0f0, 0.0f0, 0.0f0), EncodingCounters(0x018a, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, (0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000)), (0, 0, 0, 0, 0, 0, 0, 0), (0.0f0, 0.0f0, 0.0f0, 0.0f0, 0.0f0, 0.0f0, 0.0f0, 0.0f0)), Float32[-0.49944493 -0.49554303 … 0.4916411 0.49554303; 0.023553226 0.023369215 … -0.023185207 -0.023369215], ComplexF32[6.6472697f0 - 4.5136094f0im; -5.344333f0 - 6.108877f0im; … ; 8.043598f0 - 3.0316396f0im; -5.344333f0 + 6.108877f0im;;]), Profile(AcquisitionHeader(0x0000, 0x0000000000000000, 0x00000000, 0x0000018c, 0x00000000, (0x00000000, 0x00000000, 0x00000000), 0x0100, 0x0001, 0x0001, (0x0000000000000000, 0x0000000000000000, 0x0000000000000000, 0x0000000000000000, 0x0000000000000000, 0x0000000000000000, 0x0000000000000000, 0x0000000000000000, 0x0000000000000000, 0x0000000000000000, 0x0000000000000000, 0x0000000000000000, 0x0000000000000000, 0x0000000000000000, 0x0000000000000000, 0x0000000000000000), 0x0000, 0x0000, 0x0000, 0x0000, 0x0002, 3.90625f0, (0.0f0, 0.0f0, 0.0f0), (1.0f0, 0.0f0, 0.0f0), (0.0f0, 1.0f0, 0.0f0), (0.0f0, 0.0f0, 1.0f0), (0.0f0, 0.0f0, 0.0f0), EncodingCounters(0x018b, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, (0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000)), (0, 0, 0, 0, 0, 0, 0, 0), (0.0f0, 0.0f0, 0.0f0, 0.0f0, 0.0f0, 0.0f0, 0.0f0, 0.0f0)), Float32[0.4996145 0.49571127 … -0.49180803 -0.49571127; -0.019629909 -0.01947655 … 0.01932319 0.01947655], ComplexF32[-2.846417f0 + 2.951415f0im; -6.325493f0 + 10.367838f0im; … ; 9.957207f0 + 3.5855086f0im; -6.325493f0 - 10.367838f0im;;]), Profile(AcquisitionHeader(0x0000, 0x0000000000000000, 0x00000000, 0x0000018d, 0x00000000, (0x00000000, 0x00000000, 0x00000000), 0x0100, 0x0001, 0x0001, (0x0000000000000000, 0x0000000000000000, 0x0000000000000000, 0x0000000000000000, 0x0000000000000000, 0x0000000000000000, 0x0000000000000000, 0x0000000000000000, 0x0000000000000000, 0x0000000000000000, 0x0000000000000000, 0x0000000000000000, 0x0000000000000000, 0x0000000000000000, 0x0000000000000000, 0x0000000000000000), 0x0000, 0x0000, 0x0000, 0x0000, 0x0002, 3.90625f0, (0.0f0, 0.0f0, 0.0f0), (1.0f0, 0.0f0, 0.0f0), (0.0f0, 1.0f0, 0.0f0), (0.0f0, 0.0f0, 1.0f0), (0.0f0, 0.0f0, 0.0f0), EncodingCounters(0x018c, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, (0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000)), (0, 0, 0, 0, 0, 0, 0, 0), (0.0f0, 0.0f0, 0.0f0, 0.0f0, 0.0f0, 0.0f0, 0.0f0, 0.0f0)), Float32[-0.49975327 -0.49584895 … 0.49194464 0.49584895; 0.015705379 0.015582682 … -0.015459983 -0.015582682], ComplexF32[10.062752f0 + 2.2095094f0im; -4.453672f0 + 16.220171f0im; … ; 2.3116508f0 + 1.4371337f0im; -4.453672f0 - 16.220171f0im;;]), Profile(AcquisitionHeader(0x0000, 0x0000000000000000, 0x00000000, 0x0000018e, 0x00000000, (0x00000000, 0x00000000, 0x00000000), 0x0100, 0x0001, 0x0001, (0x0000000000000000, 0x0000000000000000, 0x0000000000000000, 0x0000000000000000, 0x0000000000000000, 0x0000000000000000, 0x0000000000000000, 0x0000000000000000, 0x0000000000000000, 0x0000000000000000, 0x0000000000000000, 0x0000000000000000, 0x0000000000000000, 0x0000000000000000, 0x0000000000000000, 0x0000000000000000), 0x0000, 0x0000, 0x0000, 0x0000, 0x0002, 3.90625f0, (0.0f0, 0.0f0, 0.0f0), (1.0f0, 0.0f0, 0.0f0), (0.0f0, 1.0f0, 0.0f0), (0.0f0, 0.0f0, 1.0f0), (0.0f0, 0.0f0, 0.0f0), EncodingCounters(0x018d, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, (0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000)), (0, 0, 0, 0, 0, 0, 0, 0), (0.0f0, 0.0f0, 0.0f0, 0.0f0, 0.0f0, 0.0f0, 0.0f0, 0.0f0)), Float32[0.4998612 0.49595606 … -0.4920509 -0.49595606; -0.011779882 -0.011687852 … 0.011595822 0.011687852], ComplexF32[16.642382f0 - 1.3235054f0im; -2.33835f0 - 8.296187f0im; … ; 2.0819774f0 + 0.37532032f0im; -2.33835f0 + 8.296187f0im;;]), Profile(AcquisitionHeader(0x0000, 0x0000000000000000, 0x00000000, 0x0000018f, 0x00000000, (0x00000000, 0x00000000, 0x00000000), 0x0100, 0x0001, 0x0001, (0x0000000000000000, 0x0000000000000000, 0x0000000000000000, 0x0000000000000000, 0x0000000000000000, 0x0000000000000000, 0x0000000000000000, 0x0000000000000000, 0x0000000000000000, 0x0000000000000000, 0x0000000000000000, 0x0000000000000000, 0x0000000000000000, 0x0000000000000000, 0x0000000000000000, 0x0000000000000000), 0x0000, 0x0000, 0x0000, 0x0000, 0x0002, 3.90625f0, (0.0f0, 0.0f0, 0.0f0), (1.0f0, 0.0f0, 0.0f0), (0.0f0, 1.0f0, 0.0f0), (0.0f0, 0.0f0, 1.0f0), (0.0f0, 0.0f0, 0.0f0), EncodingCounters(0x018e, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, (0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000)), (0, 0, 0, 0, 0, 0, 0, 0), (0.0f0, 0.0f0, 0.0f0, 0.0f0, 0.0f0, 0.0f0, 0.0f0, 0.0f0)), Float32[-0.4999383 -0.49603254 … 0.4921268 0.49603254; 0.007853659 0.007792302 … -0.007730945 -0.007792302], ComplexF32[3.0175219f0 - 0.2766111f0im; -7.636106f0 - 18.211138f0im; … ; 8.107178f0 - 7.6346684f0im; -7.636106f0 + 18.211138f0im;;]), Profile(AcquisitionHeader(0x0000, 0x0000000000000000, 0x00000000, 0x00000190, 0x00000000, (0x00000000, 0x00000000, 0x00000000), 0x0100, 0x0001, 0x0001, (0x0000000000000000, 0x0000000000000000, 0x0000000000000000, 0x0000000000000000, 0x0000000000000000, 0x0000000000000000, 0x0000000000000000, 0x0000000000000000, 0x0000000000000000, 0x0000000000000000, 0x0000000000000000, 0x0000000000000000, 0x0000000000000000, 0x0000000000000000, 0x0000000000000000, 0x0000000000000000), 0x0000, 0x0000, 0x0000, 0x0000, 0x0002, 3.90625f0, (0.0f0, 0.0f0, 0.0f0), (1.0f0, 0.0f0, 0.0f0), (0.0f0, 1.0f0, 0.0f0), (0.0f0, 0.0f0, 1.0f0), (0.0f0, 0.0f0, 0.0f0), EncodingCounters(0x018f, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, (0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000)), (0, 0, 0, 0, 0, 0, 0, 0), (0.0f0, 0.0f0, 0.0f0, 0.0f0, 0.0f0, 0.0f0, 0.0f0, 0.0f0)), Float32[0.4999846 0.49607846 … -0.49217233 -0.49607846; -0.0039269505 -0.003896271 … 0.003865592 0.003896271], ComplexF32[5.086101f0 - 0.143221f0im; -7.220583f0 + 3.4889958f0im; … ; 3.9863534f0 + 6.037494f0im; -7.220583f0 - 3.4889958f0im;;])])

For real acquisition we first create the RawAcquisitionData structure and then convert into the AcquisitionData.

Binning Data

rawRad2 = deepcopy(rawRad)
for i in 1:length(rawRad.profiles)
    if  mod(i,4) == 0
        rawRad2.profiles[i].head.idx.contrast = 0
    else
        rawRad2.profiles[i].head.idx.contrast = 1
    end
end;

We need to tell to MRIReco that our trajectory is a custom one :

rawRad2.params["trajectory"] = "custom";

Reconstruction

To perform the reconstruction we need to convert the RawAcquisitionData into and AcquisitionData structure.

acqRad2 = AcquisitionData(rawRad2)
AcquisitionData{Float32, 2}(Dict{Symbol, Any}(), Trajectory{Float32}[Trajectory{Float32}("Custom", Float32[-0.4998612 -0.49595606 … -0.49217233 -0.49607846; -0.011779882 -0.011687852 … 0.003865592 0.003896271], Float32[0.0, 3.90625f-6, 7.8125f-6, 1.171875f-5, 1.5625f-5, 1.953125f-5, 2.34375f-5, 2.734375f-5, 3.125f-5, 3.515625f-5  …  0.0009609375, 0.0009648437, 0.00096875, 0.00097265624, 0.0009765625, 0.0009804687, 0.000984375, 0.0009882812, 0.0009921875, 0.0009960937], 0.0f0, 0.001f0, 100, 256, 1, false, true), Trajectory{Float32}("Custom", Float32[0.5 0.49609375 … 0.4921268 0.49603254; 0.0 0.0 … -0.007730945 -0.007792302], Float32[0.0, 3.90625f-6, 7.8125f-6, 1.171875f-5, 1.5625f-5, 1.953125f-5, 2.34375f-5, 2.734375f-5, 3.125f-5, 3.515625f-5  …  0.0009609375, 0.0009648437, 0.00096875, 0.00097265624, 0.0009765625, 0.0009804687, 0.000984375, 0.0009882812, 0.0009921875, 0.0009960937], 0.0f0, 0.001f0, 300, 256, 1, false, true)], Matrix{ComplexF32}[[16.566261f0 - 2.3455367f0im; -2.9743297f0 + 6.258768f0im; … ; 3.9863534f0 + 6.037494f0im; -7.220583f0 - 3.4889958f0im;;]; [14.993935f0 - 0.014462396f0im; -2.745702f0 - 17.48758f0im; … ; 8.107178f0 - 7.6346684f0im; -7.636106f0 + 18.211138f0im;;];;;], [[897, 898, 899, 900, 901, 902, 903, 904, 905, 906  …  102519, 102520, 102521, 102522, 102523, 102524, 102525, 102526, 102527, 102528], [129, 130, 131, 132, 133, 134, 135, 136, 137, 138  …  102263, 102264, 102265, 102266, 102267, 102268, 102269, 102270, 102271, 102272]], (256, 256), (0.0, 0.0, 0.0))

We can also plot the number of projection for both bin :

nPro1 = Int32(length(acqRad2.kdata[1,1,1])/N)
nPro2 = Int32(length(acqRad2.kdata[2,1,1])/N)
println("Number of projection in : \n
- Bin 1 = $nPro1\n
- Bin 2 = $nPro2")
Number of projection in :

- Bin 1 = 100

- Bin 2 = 300

Now we can perform a standard reconstruction

params = Dict{Symbol, Any}()
params[:reco] = "direct"
params[:reconSize] = (N,N)

Ireco = reconstruction(acqRad2, params)
size(Ireco)
(256, 256, 1, 2, 1, 1)

let's show the results for first bin

plot_im2D(abs.(Ireco[:,:,1,1]),title = "First bin")

and the second bin

plot_im2D(abs.(Ireco[:,:,1,2]),title = "Second bin")

As expected we have more streaking artifacts on the first bin because we reconstruct the image with less projections.

Reproducibility

This page was generated with the following version of Julia:

using InteractiveUtils
io = IOBuffer();
versioninfo(io);
split(String(take!(io)), '\n')
12-element Vector{SubString{String}}:
 "Julia Version 1.10.3"
 "Commit 0b4590a5507 (2024-04-30 10:59 UTC)"
 "Build Info:"
 "  Official https://julialang.org/ release"
 "Platform Info:"
 "  OS: Linux (x86_64-linux-gnu)"
 "  CPU: 4 × AMD EPYC 7763 64-Core Processor"
 "  WORD_SIZE: 64"
 "  LIBM: libopenlibm"
 "  LLVM: libLLVM-15.0.7 (ORCJIT, znver3)"
 "Threads: 1 default, 0 interactive, 1 GC (on 4 virtual cores)"
 ""

And with the following package versions

import Pkg; Pkg.status()
Status `~/work/MRIReco.jl/MRIReco.jl/docs/Project.toml`
  [13f3f980] CairoMakie v0.12.2
⌃ [e30172f5] Documenter v0.25.2
  [8ad4436d] ImageUtils v0.2.11
  [98b081ad] Literate v2.18.0
  [f7771a9a] MRIBase v0.4.3 `/home/runner/work/MRIReco.jl/MRIReco.jl:MRIBase#master`
  [c57eb701] MRICoilSensitivities v0.1.3 `/home/runner/work/MRIReco.jl/MRIReco.jl:MRICoilSensitivities#master`
  [5a6f062f] MRIFiles v0.3.1 `/home/runner/work/MRIReco.jl/MRIReco.jl:MRIFiles#master`
  [fb1137e3] MRIOperators v0.2.1 `/home/runner/work/MRIReco.jl/MRIReco.jl:MRIOperators#master`
  [bdf86e05] MRIReco v0.9.0 `~/work/MRIReco.jl/MRIReco.jl`
  [9be66c26] MRISampling v0.1.2 `/home/runner/work/MRIReco.jl/MRIReco.jl:MRISampling#master`
  [8988da37] MRISimulation v0.1.2 `/home/runner/work/MRIReco.jl/MRIReco.jl:MRISimulation#master`
  [b77e0a4c] InteractiveUtils
Info Packages marked with ⌃ have new versions available and may be upgradable.

This page was generated using Literate.jl.