Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix for noise matrix absence and allow for double wrap correction in the future #53

Merged
merged 5 commits into from
Sep 30, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 10 additions & 6 deletions src/Navigator.jl
Original file line number Diff line number Diff line change
Expand Up @@ -43,11 +43,16 @@ function NavCorr!(nav::Array{Complex{T}, 4}, acqData::AcquisitionData, params::D
end

remove_ref_ph!(nav, addData.numlines, 1) # remove the reference phase
noisestd = std(addData.noisemat, dims=[1]).^2
if addData.noisemat != nothing
noisestd = std(addData.noisemat, dims=[1]).^2

# Compute weights for the coils average
weights = comp_weights(abs.(nav), noisestd, addData.numlines, addData.numslices)
nav = sum(weights .* nav, dims=(1,2,)) # coils and samples average for each line
# Compute weights for the coils average
weights = comp_weights(abs.(nav), noisestd, addData.numlines, addData.numslices)
nav = sum(weights .* nav, dims=(1,2,)) # coils and samples average for each line

else
nav = sum(nav, dims=(1,2,))
end

# Compute navigator phase
cartes_index = findall(x -> isnan(x), nav)
Expand Down Expand Up @@ -253,8 +258,7 @@ function wrap_corr!(nav::Array{Float64, 4}, wrapped_points::Array{Int8, 2}, corr

invertNavSign!(nav, correlation, slices)
wrapped_points_local = reshape(wrapped_points, (1, 1, size(wrapped_points)...))
idx_pos = findall(x->x==1, wrapped_points_local)
nav[idx_pos] = nav[idx_pos] .+ (2*pi)
nav = nav .+ ((2*pi) .* wrapped_points_local)
invertNavSign!(nav, correlation, slices)

return nav
Expand Down
Loading