MagneticResonanceImaging / MRIReco.jl

Julia Package for MRI Reconstruction
https://magneticresonanceimaging.github.io/MRIReco.jl/latest/
Other
85 stars 22 forks source link

estimateCoilSensitivities returns a 5D array -> iterative reconstruction expected a 4D array #83

Closed aTrotier closed 1 year ago

aTrotier commented 2 years ago

estimateCoilSensitivities returns a 5D array (read,phase,slice,echo,channel) whereas espirit returns a 5D array (read,phase,slice,channel,nmaps)

For the reconstruction params[:senseMaps] is suppose to be a 4D array (read,phase,slice,channel).

Should we change something ? Or just let the user figure that out and remove the 4th dimension of the estimateCoilSensitivities output ?

"""
    `s = estimateCoilSensitivities(I::AbstractArray{T,5})`
Estimates the coil sensitivity based on a reconstruction where the data
from each coil has been reconstructed individually.
Returns a 5D array.
"""
function estimateCoilSensitivities(I::AbstractArray{T,5}, thresh = 1.e-2) where {T}
  nx, ny, nz, ne, numChan = size(I)

  I_sum = sqrt.(sum(abs.(I) .^ 2, dims = 5)) .+ eps()
  I_max = maximum(abs.(I_sum))
  msk = zeros(size(I_sum))
  msk[findall(x -> x > thresh * I_max, I_sum)] .= 1

  s = zeros(eltype(I), size(I))
  for i = 1:numChan
    s[:, :, :, :, i] = msk .* I[:, :, :, :, i] ./ I_sum
  end

  return s
end