Skip to content

Commit 33dab33

Browse files
authored
Add adiabatic RF pulse tutorial (#791)
* docs: support Plotly animation embeds * docs: add adiabatic RF pulse tutorial * docs: fix chemical shift phantom plot layout * docs: clean up slice-selective recon plot * docs: fix tutorial plot layout * docs: resolve tutorial preview issues
1 parent eae656a commit 33dab33

9 files changed

Lines changed: 290 additions & 126 deletions

docs/EmbeddPlotlyJSSyncPlotLiterate.jl

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,13 +21,17 @@ function Base.show(io::IO, ::MIME"text/html", fig::PlotlyJS.SyncPlot)
2121
# Copy is required because we pop layout width/height for Plotly's inner JSON.
2222
# Mutating fig.plot directly would change size(fig) and user-visible behavior.
2323
plot = copy(fig.plot)
24+
plot.frames = fig.plot.frames
25+
plot.config = deepcopy(fig.plot.config)
26+
plot.config.displayModeBar = false
2427
default_width = layout_to_html_default_size!(plot.layout.fields, :width, get(plot.layout.fields, :width, nothing))
2528
default_height = layout_to_html_default_size!(plot.layout.fields, :height, get(plot.layout.fields, :height, nothing))
2629

2730
html_buffer = IOBuffer()
2831
PlotlyJS.PlotlyBase.to_html(
2932
html_buffer,
3033
plot;
34+
autoplay=false,
3135
full_html=true,
3236
include_plotlyjs="cdn",
3337
default_width=default_width,
-29.1 KB
Binary file not shown.

examples/3.tutorials/adiabatic_pulses/BIR4InversionB0B1.jl

Lines changed: 0 additions & 53 deletions
This file was deleted.

examples/3.tutorials/adiabatic_pulses/BIR4InversionProfile.jl

Lines changed: 0 additions & 37 deletions
This file was deleted.

examples/3.tutorials/adiabatic_pulses/HSInversionProfile.jl

Lines changed: 0 additions & 30 deletions
This file was deleted.

examples/3.tutorials/lit-03-ChemicalShiftEPI.jl

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,22 @@ sys = Scanner(); #hide
88
obj = brain_phantom2D() # a slice of a brain
99
p1 = plot_phantom_map(obj, :T2 ; height=400, width=400, view_2d=true)
1010
p2 = plot_phantom_map(obj, :Δw ; height=400, width=400, view_2d=true)
11-
#md [p1 p2] #hide
12-
#jl display([p1 p2])
11+
p = [p1 p2] #hide
12+
p.plot.layout.fields[:xaxis2][:scaleanchor] = "y2" #hide
13+
p.plot.layout.fields[:xaxis1][:domain] = [0.0, 0.40] #hide
14+
p.plot.layout.fields[:xaxis2][:domain] = [0.58, 0.98] #hide
15+
for axis in (:xaxis1, :yaxis1, :xaxis2, :yaxis2) #hide
16+
p.plot.layout.fields[axis][:title] = "" #hide
17+
p.plot.layout.fields[axis][:ticks] = "" #hide
18+
p.plot.layout.fields[axis][:showticklabels] = false #hide
19+
end #hide
20+
for (trace, x) in zip(p.plot.data, (0.43, 1.02)) #hide
21+
trace.fields[:marker][:colorbar][:x] = x #hide
22+
trace.fields[:marker][:colorbar][:len] = 0.55 #hide
23+
trace.fields[:marker][:colorbar][:thickness] = 14 #hide
24+
end #hide
25+
#md p #hide
26+
#jl display(p)
1327

1428
# At the left, you can see the ``T_2`` map of the phantom,
1529
# and at the right, the off-resonance ``\Delta\omega``.

examples/3.tutorials/lit-04-3DSliceSelective.jl

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,7 @@ p3 = plot_signal(raw; slider=false, height=300)
4747
# Finally, we reconstruct the acquiered images.
4848

4949
## Get the acquisition data
50+
raw.params["trajectory"] = "other"
5051
acq = AcquisitionData(raw)
5152

5253
## Setting up the reconstruction parameters and perform reconstruction
@@ -58,5 +59,15 @@ image = reconstruction(acq, reconParams)
5859
p4 = plot_image(abs.(image[:, :, 1]); height=360, title="Slice 1")
5960
p5 = plot_image(abs.(image[:, :, 2]); height=360, title="Slice 2")
6061
p6 = plot_image(abs.(image[:, :, 3]); height=360, title="Slice 3")
61-
#md [p4 p5 p6] #hide
62-
#jl display([p4 p5 p6])
62+
p = [p4 p5 p6] #hide
63+
foreach(t -> t.fields[:showscale] = false, p.plot.data) #hide
64+
for (i, xref) in enumerate(("x", "x2", "x3")) #hide
65+
xaxis = Symbol("xaxis", i) #hide
66+
yaxis = Symbol("yaxis", i) #hide
67+
p.plot.layout.fields[yaxis][:scaleanchor] = xref #hide
68+
p.plot.layout.fields[yaxis][:constrain] = "domain" #hide
69+
p.plot.layout.fields[xaxis][:range] = [-0.5, Nx - 0.5] #hide
70+
p.plot.layout.fields[yaxis][:range] = [-0.5, Ny - 0.5] #hide
71+
end #hide
72+
#md p #hide
73+
#jl display(p)

0 commit comments

Comments
 (0)