Skip to content
Snippets Groups Projects
Unverified Commit 62da8f76 authored by Michiel Cottaar's avatar Michiel Cottaar
Browse files

Add variables. and replace TR constraint with duration

parent db4f20e5
No related branches found
No related tags found
1 merge request!2Define variables through new @defvar macro
...@@ -48,7 +48,7 @@ using Gtk ...@@ -48,7 +48,7 @@ using Gtk
@testset "Finite gradients" begin @testset "Finite gradients" begin
function plot_finite_dwi(fname) function plot_finite_dwi(fname)
sequence = DWI(bval=2., TE=:min, TR=100, voxel_size=2., scanner=Siemens_Prisma, fov=(10, 10, 10)) sequence = DWI(bval=2., TE=:min, duration=100, voxel_size=2., scanner=Siemens_Prisma, fov=(10, 10, 10))
f = plot_sequence(sequence) f = plot_sequence(sequence)
CairoMakie.save(fname, f) CairoMakie.save(fname, f)
end end
......
...@@ -41,17 +41,17 @@ ...@@ -41,17 +41,17 @@
@test all(isapprox.(duration.(seq), [0., 0., 40., 0., 0., 0., 40., 0., 0.], atol=1e-4, rtol=1e-4)) @test all(isapprox.(duration.(seq), [0., 0., 40., 0., 0., 0., 40., 0., 0.], atol=1e-4, rtol=1e-4))
@test length([iter_instant_pulses(seq)...]) == 2 @test length([iter_instant_pulses(seq)...]) == 2
@test length([iter_instant_gradients(seq)...]) == 0. @test length([iter_instant_gradients(seq)...]) == 0.
@test TE(seq) 80. @test variables.TE(seq) 80.
@test variables.duration(seq) 80. @test variables.duration(seq) 80.
@test 4.8 < bval(seq) < 4.9 @test 4.8 < bval(seq) < 4.9
@test rise_time(seq[:gradient]) min_rise_time rtol=1e-4 @test variables.rise_time(seq[:gradient]) min_rise_time rtol=1e-4
@test all(isapprox.(edge_times(seq, tol=1e-3), [0., min_rise_time, 40. - min_rise_time, 40, 40 + min_rise_time, 80 - min_rise_time, 80.], atol=1e-4)) @test all(isapprox.(edge_times(seq, tol=1e-3), [0., min_rise_time, 40. - min_rise_time, 40, 40 + min_rise_time, 80 - min_rise_time, 80.], atol=1e-4))
# can also maximise q-value # can also maximise q-value
seq2 = DiffusionSpinEcho(TE=80., qval=:max) seq2 = DiffusionSpinEcho(TE=80., qval=:max)
@test all(isapprox.(duration.(seq), duration.(seq2), atol=1e-4, rtol=1e-4)) @test all(isapprox.(duration.(seq), duration.(seq2), atol=1e-4, rtol=1e-4))
@test TE(seq) TE(seq2) atol=1e-4 rtol=1e-4 @test variables.TE(seq) variables.TE(seq2) atol=1e-4 rtol=1e-4
@test bval(seq) bval(seq2) atol=1e-4 rtol=1e-4 @test variables.bval(seq) variables.bval(seq2) atol=1e-4 rtol=1e-4
end end
@testset "Set diffusion time Δ" begin @testset "Set diffusion time Δ" begin
seq = DiffusionSpinEcho(TE=80., Δ=70., qval=:max) seq = DiffusionSpinEcho(TE=80., Δ=70., qval=:max)
...@@ -77,7 +77,7 @@ ...@@ -77,7 +77,7 @@
end end
@testset "DW-SE with finite RF pulses" begin @testset "DW-SE with finite RF pulses" begin
@testset "slice-select DW-SE" begin @testset "slice-select DW-SE" begin
seq = DiffusionSpinEcho(TR=:min, bval=2., slice_thickness=2.) seq = DiffusionSpinEcho(duration=:min, bval=2., slice_thickness=2.)
@test length(seq) == 9 @test length(seq) == 9
@test duration(seq[1]) > 1. @test duration(seq[1]) > 1.
for index in 1:9 for index in 1:9
...@@ -93,7 +93,7 @@ ...@@ -93,7 +93,7 @@
@test variables.readout_times(seq)[1] > TE(seq) @test variables.readout_times(seq)[1] > TE(seq)
end end
@testset "voxel-wise DW-SE" begin @testset "voxel-wise DW-SE" begin
seq = DiffusionSpinEcho(TR=:min, bval=2., voxel_size=2., fov=(20, 20, 20)) seq = DiffusionSpinEcho(duration=:min, bval=2., voxel_size=2., fov=(20, 20, 20))
@test length(seq) == 9 @test length(seq) == 9
@test duration(seq[1]) > 1. @test duration(seq[1]) > 1.
for index in 1:9 for index in 1:9
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment