From 92f2345a3bb02beb0a50c694f6902c5a8d1b9b09 Mon Sep 17 00:00:00 2001
From: Michiel Cottaar <michiel.cottaar@ndcn.ox.ac.uk>
Date: Tue, 9 Apr 2024 14:36:53 +0100
Subject: [PATCH] Add InstantGradient to plot

---
 src/plot.jl | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/src/plot.jl b/src/plot.jl
index 7b28c13..2d06a7c 100644
--- a/src/plot.jl
+++ b/src/plot.jl
@@ -2,7 +2,7 @@ module Plot
 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
+import ..Components: RFPulseComponent, ADC, InstantPulse, NoGradient, InstantGradient1D, InstantGradient3D
 
 """
     SinglePlotLine(times, amplitudes, event_times, event_amplitudes)
@@ -151,6 +151,12 @@ function SequenceDiagram(bbb::BaseBuildingBlock)
                     [0., 0., 1., 1., 0., 0.],
                 )
             end
+        elseif event isa InstantGradient1D
+            kwargs[:G] = SinglePlotLine([0., duration(bbb)], [0., 0.], [delay], [event.qval])
+        elseif event isa InstantGradient3D
+            for (index, symbol) in enumerate([:Gx, :Gy, :Gz])
+                kwargs[symbol] = SinglePlotLine([0., duration(bbb)], [0., 0.], [delay], [event.qval[index]])
+            end
         end
     end
     return SequenceDiagram(duration(bbb); kwargs...)
-- 
GitLab