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

Code modifications in the 2nd round review of JOSS paper. #26

Merged
merged 1 commit into from
Feb 19, 2024
Merged
Show file tree
Hide file tree
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
3 changes: 1 addition & 2 deletions docs/lit/examples/joss_demo.jl
Original file line number Diff line number Diff line change
Expand Up @@ -245,7 +245,7 @@ sensitivity = mapslices(x -> imresize(x, params_spiral[:recon_size][1], params_s
# Optional: Plot the sensitivity maps of each coil on a given slice.
if params_general[:do_plot_recon]
plotlyjs()
plot_sense_maps(sensitivity,20)
plot_sense_maps(sensitivity, 20)
end

# Optional: Coil compression to further reduce the time of recon
Expand Down Expand Up @@ -344,7 +344,6 @@ if params_general[:do_plot_recon]
reco,
1:length(selected_slice),
resized_b0_maps,
fig_handles = ["Original Magnitude", "Original Phase", "B0"],
is_slice_interleaved = false,
rotation = 90,
)
Expand Down
13 changes: 9 additions & 4 deletions src/utils/utils.jl
Original file line number Diff line number Diff line change
Expand Up @@ -83,22 +83,27 @@ end

"""
plot_sense_maps(sensitivity, num_channels; slice_index = 1)
Plots coil sensitivity maps from the channels, for a total of num_channels plots
Plots coil sensitivity maps from the channels, for a given number of num_channels plots on a given slice index.

# Arguments
* `sensitivity` - sensitivity maps, a 4D array: [nX, nY, nZ, nCoil]
* `num_channels` - number of coils (usually the last dimension of sensitivity)
* `num_channels` - number of coils to be displayed.
* `slice_index` - The index of the slice to be displayed (if multislice)
"""
function plot_sense_maps(sensitivity; slice_index = 1)
function plot_sense_maps(sensitivity, num_channels; slice_index = 1)
if ndims(sensitivity) == 4
num_slices = size(sensitivity, 3)
num_channels = size(sensitivity, 4)
num_channels_total = size(sensitivity, 4)
else
err_msg = @sprintf("sensitivity must be a 4D array with a size of [nX, nY, nZ, nCoil]. Current input has %d dimensions.", ndims(sensitivity))
error(err_msg)
end

if num_channels > num_channels_total
err_msg = @sprintf("The number of coils to be displayed is %d, but total available coil number is %d.", num_channels, num_channels_total)
error(err_msg)
end

if slice_index > num_slices
err_msg = @sprintf("The index of slice to be displayed is %d, but total slice number is %d.", slice_index, num_slices)
error(err_msg)
Expand Down
Loading