JuliaHealth / KomaMRI.jl

Koma is a Pulseq-compatible framework to efficiently simulate Magnetic Resonance Imaging (MRI) acquisitions. The main focus of this package is to simulate general scenarios that could arise in pulse sequence development.
https://JuliaHealth.github.io/KomaMRI.jl
MIT License
117 stars 21 forks source link

Incorrect interpretation of time shaped RFs #200

Closed beorostica closed 7 months ago

beorostica commented 1 year ago

In the source code we use a custom trapezoidal function (used only by the get_rfs() function) which doesn't regard time-shaped waveforms:

⏢(A, t, ΔT, ζ1, ζ2, delay) = begin
    if sum(abs.(A)) != 0 && ΔT+ζ1+ζ2 != 0 # If no event just ignore calculations
        #Getting amplitudes, only supports uniformly sampled waveforms for now
        if length(A) != 1
            grad_raster = ΔT / length(A)
            idx = ceil.(Int, (t .- delay .- ζ1) ./ grad_raster ) #Time to integer index
            valid = 1 .<= idx .<= length(A)
            idx[(!).(valid)] .= 1
            B = A[idx] .* valid
...

In a near future, we want to use linear interpolation instead of zero-order-hold so this issue should be addressed there. This is also related with the issue #167.

cncastillo commented 1 year ago

This already in development in the branch: