Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
M
MRIBuilder.jl
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Michiel Cottaar
MRIBuilder.jl
Commits
92e995c4
Verified
Commit
92e995c4
authored
1 year ago
by
Michiel Cottaar
Browse files
Options
Downloads
Patches
Plain Diff
Add cleaner plot_sequence function
parent
3c9419c7
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
ext/MakieMRIBuilder/MakieMRIBuilder.jl
+30
-1
30 additions, 1 deletion
ext/MakieMRIBuilder/MakieMRIBuilder.jl
src/MRIBuilder.jl
+3
-0
3 additions, 0 deletions
src/MRIBuilder.jl
src/plot.jl
+11
-21
11 additions, 21 deletions
src/plot.jl
with
44 additions
and
22 deletions
ext/MakieMRIBuilder/MakieMRIBuilder.jl
+
30
−
1
View file @
92e995c4
module
MakieMRIBuilder
using
Makie
import
MakieCore
import
MRIBuilder
.
Plot
:
Plot_Sequence
,
SequenceDiagram
,
range_line
,
normalise
import
MakieCore
:
@recipe
,
theme
,
generic_plot_attributes!
,
Attributes
,
automatic
import
MRIBuilder
.
Plot
:
SequenceDiagram
,
range_line
,
normalise
,
plot_sequence
import
MRIBuilder
:
BaseSequence
,
BaseBuildingBlock
,
duration
@recipe
(
Plot_Sequence
,
sequence
)
do
scene
attr
=
Attributes
(
color
=
theme
(
scene
,
:
textcolor
),
linecolor
=
automatic
,
linewidth
=
1.5
,
instant_width
=
3.
,
textcolor
=
automatic
,
font
=
theme
(
scene
,
:
font
),
fonts
=
theme
(
scene
,
:
fonts
),
fontsize
=
theme
(
scene
,
:
fontsize
),
fxaa
=
true
,
)
generic_plot_attributes!
(
attr
)
return
attr
end
function
Makie.plot!
(
scene
::
Plot_Sequence
)
kwargs
=
Dict
([
key
=>
scene
[
key
]
for
key
in
[
...
...
@@ -42,4 +60,15 @@ end
Makie
.
plottype
(
::
Union
{
BaseBuildingBlock
,
BaseSequence
})
=
Plot_Sequence
function
plot_sequence
(
sequence
;
figure
=
(),
axis
=
(
xgridvisible
=
false
,
ygridvisible
=
false
),
kwargs
...
)
f
=
Figure
(;
figure
...
)
ax
=
Axis
(
f
[
1
,
1
];
axis
...
)
p
=
plot!
(
ax
,
sequence
;
kwargs
...
)
ax
.
xlabel
[]
=
"Time (ms)"
hideydecorations!
(
ax
)
hidespines!
(
ax
,
:
l
,
:
r
,
:
t
)
return
Makie
.
FigureAxisPlot
(
f
,
ax
,
p
)
end
end
\ No newline at end of file
This diff is collapsed.
Click to expand it.
src/MRIBuilder.jl
+
3
−
0
View file @
92e995c4
...
...
@@ -38,6 +38,9 @@ export dwi_gradients, readout_event, excitation_pulse, refocus_pulse, Trapezoid,
import
.
Sequences
:
GradientEcho
,
SpinEcho
,
DiffusionSpinEcho
,
DW_SE
,
DWI
export
GradientEcho
,
SpinEcho
,
DiffusionSpinEcho
,
DW_SE
,
DWI
import
.
Plot
:
plot_sequence
export
plot_sequence
import
JuMP
:
@constraint
,
@objective
,
objective_function
,
value
,
Model
export
@constraint
,
@objective
,
objective_function
,
value
,
Model
...
...
This diff is collapsed.
Click to expand it.
src/plot.jl
+
11
−
21
View file @
92e995c4
module
Plot
import
MakieCore
:
@recipe
,
theme
,
generic_plot_attributes!
,
Attributes
,
automatic
,
shading_attributes!
,
colormap_attributes!
import
MakieCore
:
generic_plot_attributes!
import
..
Containers
:
BaseBuildingBlock
,
BaseSequence
,
waveform
,
events
,
start_time
,
ndim_grad
,
waveform_sequence
import
..
Variables
:
duration
,
flip_angle
,
phase
,
make_generic
,
gradient_orientation
import
..
Components
:
RFPulseComponent
,
ADC
,
InstantPulse
,
NoGradient
...
...
@@ -159,15 +159,19 @@ function normalise(sd::SequenceDiagram)
)
end
"""
plot(sequence; kwargs...)
plot!([scene,] sequence; kwargs...)
plot_sequence(sequence; kwargs...)
plot_sequence!([scene,] sequence; kwargs...)
plot_sequence(sequence; figure=(), axis=(), attributes...)
plot(sequence; attributes...)
plot!([scene,] sequence; attributes...)
Plot the sequence diagram.
Calling `plot_sequence` will result in a much cleaner sequence diagram (recommended).
However, if you want to combine this diagram with other plots you will have to use `plot` or `plot!` instead.
If called as `plot_sequence` the user can also supply `Makie.Figure` (`figure=(...)`) and `Makie.Axis` (`axis=(...)`) keywords.
If called using the `plot` or `plot!` interface, only the attributes listed below can be supplied
This function will only work if [`Makie`](https://makie.org) is installed and imported.
## Attributes
...
...
@@ -184,20 +188,6 @@ This function will only work if [`Makie`](https://makie.org) is installed and im
$
(Base.Docs.doc(generic_plot_attributes!))
"""
@recipe
(
Plot_Sequence
,
sequence
)
do
scene
attr
=
Attributes
(
color
=
theme
(
scene
,
:
textcolor
),
linecolor
=
automatic
,
linewidth
=
1.5
,
instant_width
=
3.
,
textcolor
=
automatic
,
font
=
theme
(
scene
,
:
font
),
fonts
=
theme
(
scene
,
:
fonts
),
fontsize
=
theme
(
scene
,
:
fontsize
),
fxaa
=
true
,
)
generic_plot_attributes!
(
attr
)
return
attr
end
function
plot_sequence
end
end
\ No newline at end of file
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment