diff --git a/docs/lit/examples/joss_demo.jl b/docs/lit/examples/joss_demo.jl index 75969d0..f4e00fe 100644 --- a/docs/lit/examples/joss_demo.jl +++ b/docs/lit/examples/joss_demo.jl @@ -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 @@ -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, ) diff --git a/src/utils/utils.jl b/src/utils/utils.jl index 9ee0133..1e55cec 100644 --- a/src/utils/utils.jl +++ b/src/utils/utils.jl @@ -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)