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
cc85b512
Verified
Commit
cc85b512
authored
1 year ago
by
Michiel Cottaar
Browse files
Options
Downloads
Patches
Plain Diff
Apply consistent normalisation across RF and grad
parent
85366df5
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
ext/MakieMRIBuilder/MakieMRIBuilder.jl
+6
-8
6 additions, 8 deletions
ext/MakieMRIBuilder/MakieMRIBuilder.jl
src/plot.jl
+21
-0
21 additions, 0 deletions
src/plot.jl
with
27 additions
and
8 deletions
ext/MakieMRIBuilder/MakieMRIBuilder.jl
+
6
−
8
View file @
cc85b512
module
MakieMRIBuilder
using
Makie
import
MakieCore
import
MRIBuilder
.
Plot
:
Plot_Sequence
,
SequenceDiagram
,
range_line
import
MRIBuilder
.
Plot
:
Plot_Sequence
,
SequenceDiagram
,
range_line
,
normalise
import
MRIBuilder
:
BaseSequence
,
BaseBuildingBlock
function
Makie.plot!
(
scene
::
Plot_Sequence
)
...
...
@@ -20,19 +20,17 @@ function Makie.plot!(scene:: Plot_Sequence)
instant_width
=
map
((
a
,
c
)
->
a
*
c
,
scene
[
:
linewidth
],
scene
[
:
instant_width
])
lift
(
scene
[
:
sequence
])
do
sequence
sequence_diagram
=
SequenceDiagram
(
sequence
)
sequence_diagram
=
normalise
(
SequenceDiagram
(
sequence
)
)
current_y
=
0.
for
label
in
(
:
ADC
,
:
Gz
,
:
Gy
,
:
Gx
,
:
G
,
:
RFy
,
:
RFx
)
line
=
getproperty
(
sequence_diagram
,
label
)
full_range
=
range_line
(
line
)
norm
=
max
(
abs
.
(
full_range
)
...
)
(
lower
,
upper
)
=
full_range
./
norm
if
norm
>
0
(
lower
,
upper
)
=
range_line
(
line
)
if
!
(
lower
≈
upper
)
shift
=
current_y
-
lower
Makie
.
text!
(
scene
,
string
(
label
)
*
" "
;
position
=
(
0.
,
shift
),
align
=
(
:
right
,
:
center
),
text_kwargs
...
,
kwargs
...
)
Makie
.
lines!
(
scene
,
line
.
times
,
line
.
amplitudes
./
norm
.+
shift
;
color
=
line_color
,
linewidth
=
scene
[
:
linewidth
],
kwargs
...
)
Makie
.
lines!
(
scene
,
line
.
times
,
line
.
amplitudes
.+
shift
;
color
=
line_color
,
linewidth
=
scene
[
:
linewidth
],
kwargs
...
)
for
(
time
,
amplitude
)
in
zip
(
line
.
event_times
,
line
.
event_amplitudes
)
Makie
.
lines!
([
time
,
time
],
[
0.
,
amplitude
/
norm
]
.+
shift
;
color
=
line_color
,
linewidth
=
instant_width
,
kwargs
...
)
Makie
.
lines!
([
time
,
time
],
[
0.
,
amplitude
]
.+
shift
;
color
=
line_color
,
linewidth
=
instant_width
,
kwargs
...
)
end
current_y
+=
(
upper
-
lower
)
+
0.1
end
...
...
This diff is collapsed.
Click to expand it.
src/plot.jl
+
21
−
0
View file @
cc85b512
...
...
@@ -56,6 +56,8 @@ range_line(spl::SinglePlotLine) = (
max
(
maximum
(
spl
.
amplitudes
;
init
=
0.
),
maximum
(
spl
.
event_amplitudes
;
init
=
0.
)),
)
normalise
(
spl
::
SinglePlotLine
,
value
)
=
iszero
(
value
)
?
spl
:
SinglePlotLine
(
spl
.
times
,
spl
.
amplitudes
./
value
,
spl
.
event_times
,
spl
.
event_amplitudes
./
value
)
"""
SequenceDiagram(; RFx, RFy, Gx, Gy, Gz, ADC)
...
...
@@ -138,6 +140,25 @@ function SequenceDiagram(seq::BaseSequence)
for
symbol
in
[
:
RFx
,
:
RFy
,
:
G
,
:
Gx
,
:
Gy
,
:
Gz
,
:
ADC
]]
...
)
end
function
normalise
(
sd
::
SequenceDiagram
)
rf_norm
=
max
(
abs
.
(
range_line
(
sd
.
RFx
))
...
,
abs
.
(
range_line
(
sd
.
RFy
))
...
)
grad_norm
=
max
(
abs
.
(
range_line
(
sd
.
G
))
...
,
abs
.
(
range_line
(
sd
.
Gx
))
...
,
abs
.
(
range_line
(
sd
.
Gy
))
...
,
abs
.
(
range_line
(
sd
.
Gz
))
...
,
)
SequenceDiagram
(
normalise
(
sd
.
RFx
,
rf_norm
),
normalise
(
sd
.
RFy
,
rf_norm
),
normalise
(
sd
.
G
,
grad_norm
),
normalise
(
sd
.
Gx
,
grad_norm
),
normalise
(
sd
.
Gy
,
grad_norm
),
normalise
(
sd
.
Gz
,
grad_norm
),
sd
.
ADC
)
end
"""
plot(sequence; kwargs...)
...
...
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