KomaMRIPlots

Plotting Phantom

KomaMRIPlots.plot_phantom_map โ€” Function
p = plot_phantom_map(obj::Phantom, key::Symbol; kwargs...)

Plots a phantom map for a specific spin parameter given by key.

Arguments

  • obj: (::Phantom) Phantom struct
  • key: (::Symbol, opts: [:ฯ, :T1, :T2, :T2s, :x, :y, :z]) symbol for displaying different parameters of the phantom spins

Keywords

  • height: (::Integer, =600) plot height
  • width: (::Integer, =nothing) plot width
  • darkmode: (::Bool, =false) boolean to indicate whether to display darkmode style
  • view_2d: (::Bool, =false) boolean to indicate whether to use a 2D scatter plot
  • colorbar: (::Bool, =true) boolean to indicate whether to display a colorbar
  • max_spins:(::Int, =100_000) maximum number of displayed spins
  • time_samples:(::Int, =0) intermediate time samples between motion t_start and t_end
  • max_time_samples:(::Int, =100) maximum number of time samples
  • frame_duration_ms:(::Int, =250) time in miliseconds between two frames

Returns

  • p: (::PlotlyJS.SyncPlot) plot of the phantom map for a specific spin parameter

References

Colormaps from https://github.com/markgriswold/MRFColormaps Towards Unified Colormaps for Quantitative MRF Data, Mark Griswold, et al. (2018).

Examples

julia> obj2D, obj3D = brain_phantom2D(), brain_phantom3D();

julia> plot_phantom_map(obj2D, :ฯ)

julia> plot_phantom_map(obj3D, :ฯ)
source

Plotting Sequence

KomaMRIPlots.plot_seq โ€” Function
p = plot_seq(seq::Sequence; kwargs...)

Plots a sequence struct.

Arguments

  • seq: (::Sequence) Sequence struct

Keywords

  • width: (::Integer, =nothing) plot width
  • height: (::Integer, =nothing) plot height
  • slider: (::Bool, =true) boolean to indicate whether to display a slider
  • show_seq_blocks: (::Bool, =false) boolean to indicate whether to display sequence blocks
  • darkmode: (::Bool, =false) boolean to indicate whether to display darkmode style
  • range: (::Vector{Real}, =[]) time range to be displayed initially
  • title: (::String, ="") plot title
  • freq_in_phase: (::Bool, =true) Include FM modulation in RF phase
  • gl: (::Bool, =false) use PlotlyJS.scattergl backend (faster)
  • max_rf_samples: (::Integer, =100) maximum number of RF samples
  • show_adc: (::Bool, =false) plot ADC samples with markers

Returns

  • p: (::PlotlyJS.SyncPlot) plot of the Sequence struct

Examples

julia> seq_file = joinpath(dirname(pathof(KomaMRI)), "../examples/1.sequences/spiral.seq")

julia> seq = read_seq(seq_file)

julia> plot_seq(seq)
source
KomaMRIPlots.plot_kspace โ€” Function
p = plot_kspace(seq::Sequence; width=nothing, height=nothing, darkmode=false)

Plots the k-space of a Sequence struct.

Arguments

  • seq: (::Sequence) Sequence struct

Keywords

  • width: (::Integer, =nothing) plot width
  • height: (::Integer, =nothing) plot height
  • darkmode: (::Bool, =false) boolean to indicate whether to display darkmode style

Returns

  • p: (::PlotlyJS.SyncPlot) plot of the k-space of the Sequence struct

Examples

julia> seq_file = joinpath(dirname(pathof(KomaMRI)), "../examples/1.sequences/spiral.seq")

julia> seq = read_seq(seq_file)

julia> plot_kspace(seq)
source
KomaMRIPlots.plot_M0 โ€” Function
p = plot_M0(seq::Sequence; kwargs...)

Plots the zero order moment (M0) of a Sequence struct.

Arguments

  • seq: (::Sequence) Sequence struct

Keywords

  • width: (::Integer, =nothing) plot width
  • height: (::Integer, =nothing) plot height
  • slider: (::Bool, =true) boolean to indicate whether to display a slider
  • show_seq_blocks: (::Bool, =false) boolean to indicate whether to display sequence blocks
  • darkmode: (::Bool, =false) boolean to indicate whether to display darkmode style
  • range: (::Vector{Real}, =[]) time range to be displayed initially
  • title: (::String, ="") plot title

Returns

  • p: (::PlotlyJS.SyncPlot) plot of the moment M0 of the Sequence struct

Examples

julia> seq_file = joinpath(dirname(pathof(KomaMRI)), "../examples/1.sequences/spiral.seq")

julia> seq = read_seq(seq_file)

julia> plot_M0(seq)
source
KomaMRIPlots.plot_M1 โ€” Function
p = plot_M1(seq::Sequence; kwargs...)

Plots the first order moment (M1) of a Sequence struct.

Arguments

  • seq: (::Sequence) Sequence struct

Keywords

  • width: (::Integer, =nothing) plot width
  • height: (::Integer, =nothing) plot height
  • slider: (::Bool, =true) boolean to indicate whether to display a slider
  • show_seq_blocks: (::Bool, =false) boolean to indicate whether to display sequence blocks
  • darkmode: (::Bool, =false) boolean to indicate whether to display darkmode style
  • range: (::Vector{Real}, =[]) time range to be displayed initially
  • title: (::String, ="") plot title

Returns

  • p: (::PlotlyJS.SyncPlot) plot of the moment M1 of the Sequence struct

Examples

julia> seq_file = joinpath(dirname(pathof(KomaMRI)), "../examples/1.sequences/spiral.seq")

julia> seq = read_seq(seq_file)

julia> plot_M1(seq)
source
KomaMRIPlots.plot_M2 โ€” Function
p = plot_M2(seq::Sequence; kwargs...)

Plots the second order moment (M2) of a Sequence struct.

Arguments

  • seq: (::Sequence) Sequence struct

Keywords

  • width: (::Integer, =nothing) plot width
  • height: (::Integer, =nothing) plot height
  • slider: (::Bool, =true) boolean to indicate whether to display a slider
  • show_seq_blocks: (::Bool, =false) boolean to indicate whether to display sequence blocks
  • darkmode: (::Bool, =false) boolean to indicate whether to display darkmode style
  • range: (::Vector{Real}, =[]) time range to be displayed initially
  • title: (::String, ="") plot title

Returns

  • p: (::PlotlyJS.SyncPlot) plot of the moment M2 of the Sequence struct

Examples

julia> seq_file = joinpath(dirname(pathof(KomaMRI)), "../examples/1.sequences/spiral.seq")

julia> seq = read_seq(seq_file)

julia> plot_M2(seq)
source
KomaMRIPlots.plot_eddy_currents โ€” Function
p = plot_eddy_currents(seq::Sequence, ฮป; kwargs...)

Plots the eddy currents of a Sequence struct.

Arguments

  • seq: (::Sequence) Sequence struct
  • ฮป: (::Real, [s]) time constant for the decay of Eddy currents

Keywords

  • ฮฑ: (::Vector{Real}, =ones(size(ฮป))) eddy currents factors
  • width: (::Integer, =nothing) plot width
  • height: (::Integer, =nothing) plot height
  • slider: (::Bool, =true) boolean to indicate whether to display a slider
  • show_seq_blocks: (::Bool, =false) boolean to indicate whether to display sequence blocks
  • darkmode: (::Bool, =false) boolean to indicate whether to display darkmode style
  • range: (::Vector{Real}, =[]) time range to be displayed initially
  • title: (::String, ="") plot title

Returns

  • p: (::PlotlyJS.SyncPlot) plot of the Eddy currents of the Sequence struct

Examples

julia> seq_file = joinpath(dirname(pathof(KomaMRI)), "../examples/1.sequences/spiral.seq")

julia> seq = read_seq(seq_file)

julia> plot_eddy_currents(seq, 80e-3)
source
KomaMRIPlots.plot_slew_rate โ€” Function
p = plot_slew_rate(seq::Sequence; kwargs...)

Plots the slew rate currents of a Sequence struct.

Arguments

  • seq: (::Sequence) Sequence struct

Keywords

  • width: (::Integer, =nothing) plot width
  • height: (::Integer, =nothing) plot height
  • slider: (::Bool, =true) boolean to indicate whether to display a slider
  • show_seq_blocks: (::Bool, =false) boolean to indicate whether to display sequence blocks
  • darkmode: (::Bool, =false) boolean to indicate whether to display darkmode style
  • range: (::Vector{Real}, =[]) time range to be displayed initially
  • title: (::String, ="") plot title

Returns

  • p: (::PlotlyJS.SyncPlot) plot of the slew rate currents of the Sequence struct

Examples

julia> seq_file = joinpath(dirname(pathof(KomaMRI)), "../examples/1.sequences/spiral.seq")

julia> seq = read_seq(seq_file)

julia> plot_slew_rate(seq)
source
KomaMRIPlots.plot_seqd โ€” Function
p = plot_seqd(seq::Sequence; sampling_params=KomaMRIBase.default_sampling_params())

Plots a sampled sequence struct.

Arguments

  • seq: (::Sequence) Sequence struct

Keywords

  • sampling_params: (::Dict{String,Any}(), =KomaMRIBase.default_sampling_params()) dictionary of sampling parameters

Returns

  • p: (::PlotlyJS.SyncPlot) plot of the sampled Sequence struct

Examples

julia> seq_file = joinpath(dirname(pathof(KomaMRI)), "../examples/1.sequences/spiral.seq")

julia> seq = read_seq(seq_file)

julia> plot_seqd(seq)
source

Plotting RawAcquisitionData

KomaMRIPlots.plot_signal โ€” Function
p = plot_signal(raw::RawAcquisitionData; kwargs...)

Plots a raw signal in ISMRMRD format.

Arguments

  • raw: (::RawAcquisitionData) RawAcquisitionData struct (raw signal in ISMRMRD format)

Keywords

  • width: (::Integer, =nothing) plot width
  • height: (::Integer, =nothing) plot height
  • slider: (::Bool, =true) boolean to indicate whether to display a slider
  • show_sim_blocks: (::Bool, =false) boolean to indicate whether to display sequence blocks
  • darkmode: (::Bool, =false) boolean to indicate whether to display darkmode style
  • range: (::Vector{Real}, =[]) time range to be displayed initially

Returns

  • p: (::PlotlyJS.SyncPlot) plot of the raw signal

Examples

julia> seq_file = joinpath(dirname(pathof(KomaMRI)), "../examples/5.koma_paper/comparison_accuracy/sequences/EPI/epi_100x100_TE100_FOV230.seq");

julia> sys, obj, seq = Scanner(), brain_phantom2D(), read_seq(seq_file)

julia> raw = simulate(obj, seq, sys)

julia> plot_signal(raw)
source

Plotting images

KomaMRIPlots.plot_image โ€” Function
p = plot_image(image; height, width, zmin, zmax, darkmode, title)

Plots an image matrix.

Arguments

  • image: (::Matrix{Number}) image matrix

Keywords

  • width: (::Integer, =nothing) plot width
  • height: (::Integer, =nothing) plot height
  • zmin: (::Real, =minimum(abs.(image[:]))) reference value for minimum color
  • zmax: (::Real, =maximum(abs.(image[:]))) reference value for maximum color
  • darkmode: (::Bool, =false) boolean to indicate whether to display darkmode style
  • title: (::String, ="") plot title

Returns

  • p: (::PlotlyJS.SyncPlot) plot of the image matrix
source

Others

KomaMRIPlots.plot_dict โ€” Function
str = plot_dict(dict::Dict)

Generates an HTML table based on the dictionary dict.

Arguments

  • dict: (::Dict) dictionary

Returns

  • str: (::String) dictionary as an HTML table
source