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
7807f233
Unverified
Commit
7807f233
authored
9 months ago
by
Michiel Cottaar
Browse files
Options
Downloads
Patches
Plain Diff
Add missing `variables.`
parent
18ee63fd
No related branches found
No related tags found
1 merge request
!2
Define variables through new @defvar macro
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
test/test_IO.jl
+19
-19
19 additions, 19 deletions
test/test_IO.jl
test/test_components.jl
+27
-27
27 additions, 27 deletions
test/test_components.jl
test/test_post_hoc.jl
+20
-21
20 additions, 21 deletions
test/test_post_hoc.jl
test/test_sequences.jl
+29
-30
29 additions, 30 deletions
test/test_sequences.jl
with
95 additions
and
97 deletions
test/test_IO.jl
+
19
−
19
View file @
7807f233
...
@@ -19,16 +19,16 @@
...
@@ -19,16 +19,16 @@
(
0.21
,
0.
,
iszero
),
(
0.21
,
0.
,
iszero
),
(
0.23
,
0.
,
isnan
),
(
0.23
,
0.
,
isnan
),
]
]
@test
phase_check
(
phase
(
seq
,
time
))
@test
phase_check
(
variables
.
phase
(
seq
,
time
))
@test
amplitude
(
seq
,
time
)
≈
ampl
@test
variables
.
amplitude
(
seq
,
time
)
≈
ampl
end
end
# Single ADC event
# Single ADC event
@test
length
(
readout_times
(
seq
))
==
1024
@test
length
(
readout_times
(
seq
))
==
1024
@test
readout_times
(
seq
)[
1
]
≈
0.22
+
5
+
0.02
+
0.5
*
0.3125
@test
variables
.
readout_times
(
seq
)[
1
]
≈
0.22
+
5
+
0.02
+
0.5
*
0.3125
@test
readout_times
(
seq
)[
end
]
≈
0.22
+
5
+
0.02
+
1023.5
*
0.3125
@test
variables
.
readout_times
(
seq
)[
end
]
≈
0.22
+
5
+
0.02
+
1023.5
*
0.3125
@test
TR
(
seq
)
≈
0.22
+
5
+
0.02
+
1024
*
0.3125
@test
variables
.
TR
(
seq
)
≈
0.22
+
5
+
0.02
+
1024
*
0.3125
end
end
@testset
"read all v1.4.0 files in 01_from_FID_to_PRESS"
begin
@testset
"read all v1.4.0 files in 01_from_FID_to_PRESS"
begin
path
=
joinpath
(
directory
,
"01_from_FID_to_PRESS_v140"
)
path
=
joinpath
(
directory
,
"01_from_FID_to_PRESS_v140"
)
...
@@ -45,7 +45,7 @@
...
@@ -45,7 +45,7 @@
seq
=
read_sequence
(
fn
)
seq
=
read_sequence
(
fn
)
@test
length
(
seq
)
==
2
@test
length
(
seq
)
==
2
(
index
,
pulse
)
=
events
(
seq
[
1
])[
1
]
(
index
,
pulse
)
=
events
(
seq
[
1
])[
1
]
@test
flip_angle
(
pulse
)
≈
90
@test
variables
.
flip_angle
(
pulse
)
≈
90
@test
start_time
(
seq
,
1
,
index
)
≈
0.1
# determined by RF dead time
@test
start_time
(
seq
,
1
,
index
)
≈
0.1
# determined by RF dead time
@test
end_time
(
seq
,
1
,
index
)
≈
0.6
# RF dead time + RF duration
@test
end_time
(
seq
,
1
,
index
)
≈
0.6
# RF dead time + RF duration
@test
phase
(
seq
,
0.3
)
==
0
@test
phase
(
seq
,
0.3
)
==
0
...
@@ -57,8 +57,8 @@
...
@@ -57,8 +57,8 @@
29.730
# Delay until ADC start (to get start at ADC at TE=30)
29.730
# Delay until ADC start (to get start at ADC at TE=30)
)
)
@test
length
(
readout_times
(
seq
))
==
8192
@test
length
(
readout_times
(
seq
))
==
8192
@test
readout_times
(
seq
)[
1
]
≈
start_adc
+
0.5
*
0.03125
@test
variables
.
readout_times
(
seq
)[
1
]
≈
start_adc
+
0.5
*
0.03125
@test
readout_times
(
seq
)[
end
]
≈
start_adc
+
8191.5
*
0.03125
@test
variables
.
readout_times
(
seq
)[
end
]
≈
start_adc
+
8191.5
*
0.03125
end
end
@testset
"check 01_from_FID_to_PRESS/06_PRESS_center.seq"
begin
@testset
"check 01_from_FID_to_PRESS/06_PRESS_center.seq"
begin
fn
=
joinpath
(
directory
,
"01_from_FID_to_PRESS_v140"
,
"06_PRESS_center.seq"
)
fn
=
joinpath
(
directory
,
"01_from_FID_to_PRESS_v140"
,
"06_PRESS_center.seq"
)
...
@@ -69,19 +69,19 @@
...
@@ -69,19 +69,19 @@
#@test flip_angle(excitation) ≈ 90
#@test flip_angle(excitation) ≈ 90
@test
start_time
(
seq
,
1
,
index
)
≈
0.1
# determined by RF dead time
@test
start_time
(
seq
,
1
,
index
)
≈
0.1
# determined by RF dead time
@test
end_time
(
seq
,
1
,
index
)
≈
3.1
# RF dead time + RF duration
@test
end_time
(
seq
,
1
,
index
)
≈
3.1
# RF dead time + RF duration
@test
phase
(
seq
,
0.3
)
≈
0
+
rad2deg
(
0.5
)
@test
variables
.
phase
(
seq
,
0.3
)
≈
0
+
rad2deg
(
0.5
)
@test
phase
(
seq
,
1.6
)
≈
0
@test
variables
.
phase
(
seq
,
1.6
)
≈
0
@test
length
(
readout_times
(
seq
))
==
4096
@test
length
(
variables
.
readout_times
(
seq
))
==
4096
refocus_pulses
=
(
refocus_pulses
=
(
events
(
seq
[
3
])[
1
][
2
],
events
(
seq
[
3
])[
1
][
2
],
events
(
seq
[
5
])[
1
][
2
],
events
(
seq
[
5
])[
1
][
2
],
)
)
for
p
in
refocus_pulses
for
p
in
refocus_pulses
@test
duration
(
p
)
≈
3
# should have been 4 for refocus pulses, but there is an error in the matlab generation
@test
variables
.
duration
(
p
)
≈
3
# should have been 4 for refocus pulses, but there is an error in the matlab generation
@test
phase
(
p
,
0.
)
≈
90
rtol
=
1e-5
@test
variables
.
phase
(
p
,
0.
)
≈
90
rtol
=
1e-5
@test
phase
(
p
,
0.38
)
≈
90
+
rad2deg
(
0.5
)
rtol
=
1e-5
@test
variables
.
phase
(
p
,
0.38
)
≈
90
+
rad2deg
(
0.5
)
rtol
=
1e-5
@test
phase
(
p
,
1.5
)
≈
90
rtol
=
1e-5
@test
variables
.
phase
(
p
,
1.5
)
≈
90
rtol
=
1e-5
end
end
end
end
# JSON encoding has not been implemented yet
# JSON encoding has not been implemented yet
...
@@ -100,12 +100,12 @@
...
@@ -100,12 +100,12 @@
write_sequence
(
io
,
seq_orig
,
format
=:
serialize
)
write_sequence
(
io
,
seq_orig
,
format
=:
serialize
)
seek
(
io
,
0
)
seek
(
io
,
0
)
seq_json
=
read_sequence
(
io
,
format
=:
serialize
)
seq_json
=
read_sequence
(
io
,
format
=:
serialize
)
@test
TR
(
seq_orig
)
==
TR
(
seq_json
)
@test
variables
.
TR
(
seq_orig
)
==
variables
.
TR
(
seq_json
)
@test
length
(
seq_orig
)
==
length
(
seq_json
)
@test
length
(
seq_orig
)
==
length
(
seq_json
)
@test
all
(
duration
.
(
seq_orig
)
.==
duration
.
(
seq_json
))
@test
all
(
duration
.
(
seq_orig
)
.==
duration
.
(
seq_json
))
@test
iszero
(
length
(
iter_instant_gradients
(
seq_json
)))
@test
iszero
(
length
(
iter_instant_gradients
(
seq_json
)))
@test
iszero
(
length
(
iter_instant_pulses
(
seq_json
)))
@test
iszero
(
length
(
iter_instant_pulses
(
seq_json
)))
@test
all
(
readout_times
(
seq_json
)
.==
readout_times
(
seq_orig
))
@test
all
(
variables
.
readout_times
(
seq_json
)
.==
variables
.
readout_times
(
seq_orig
))
end
end
end
end
end
end
...
@@ -119,12 +119,12 @@
...
@@ -119,12 +119,12 @@
write_sequence
(
io
,
seq_orig
;
format
=:
serialize
)
write_sequence
(
io
,
seq_orig
;
format
=:
serialize
)
seek
(
io
,
0
)
seek
(
io
,
0
)
seq_json
=
read_sequence
(
io
;
format
=:
serialize
)
seq_json
=
read_sequence
(
io
;
format
=:
serialize
)
@test
TR
(
seq_orig
)
==
TR
(
seq_json
)
@test
variables
.
TR
(
seq_orig
)
==
variables
.
TR
(
seq_json
)
@test
length
(
seq_orig
)
==
length
(
seq_json
)
@test
length
(
seq_orig
)
==
length
(
seq_json
)
@test
all
(
duration
.
(
seq_orig
)
.==
duration
.
(
seq_json
))
@test
all
(
duration
.
(
seq_orig
)
.==
duration
.
(
seq_json
))
@test
length
(
iter_instant_gradients
(
seq_json
))
==
length
(
iter_instant_gradients
(
seq_json
))
@test
length
(
iter_instant_gradients
(
seq_json
))
==
length
(
iter_instant_gradients
(
seq_json
))
@test
length
(
iter_instant_pulses
(
seq_json
))
==
length
(
iter_instant_pulses
(
seq_json
))
@test
length
(
iter_instant_pulses
(
seq_json
))
==
length
(
iter_instant_pulses
(
seq_json
))
@test
all
(
readout_times
(
seq_json
)
.==
readout_times
(
seq_orig
))
@test
all
(
variables
.
readout_times
(
seq_json
)
.==
variables
.
readout_times
(
seq_orig
))
end
end
end
end
end
end
\ No newline at end of file
This diff is collapsed.
Click to expand it.
test/test_components.jl
+
27
−
27
View file @
7807f233
@testset
"test_components.jl"
begin
@testset
"test_components.jl"
begin
@testset
"probing GenericPulse"
begin
@testset
"probing GenericPulse"
begin
gp
=
GenericPulse
([
0.
,
1.
,
3.
,
4.
],
[
1.
,
2.
,
3.
,
0.
],
[
0.
,
90.
,
180.
,
180.
])
gp
=
GenericPulse
([
0.
,
1.
,
3.
,
4.
],
[
1.
,
2.
,
3.
,
0.
],
[
0.
,
90.
,
180.
,
180.
])
@test
amplitude
(
gp
,
0.
)
≈
1.
@test
variables
.
amplitude
(
gp
,
0.
)
≈
1.
@test
amplitude
(
gp
,
1.
)
≈
2.
@test
variables
.
amplitude
(
gp
,
1.
)
≈
2.
@test
amplitude
(
gp
,
0.25
)
≈
1.25
@test
variables
.
amplitude
(
gp
,
0.25
)
≈
1.25
@test
amplitude
(
gp
,
2.5
)
≈
2.75
@test
variables
.
amplitude
(
gp
,
2.5
)
≈
2.75
@test
amplitude
(
gp
,
3.5
)
≈
1.5
@test
variables
.
amplitude
(
gp
,
3.5
)
≈
1.5
@test
amplitude
(
gp
,
4.
)
≈
0.
@test
variables
.
amplitude
(
gp
,
4.
)
≈
0.
@test
phase
(
gp
,
0.
)
≈
0.
@test
variables
.
phase
(
gp
,
0.
)
≈
0.
@test
phase
(
gp
,
1.
)
≈
90.
@test
variables
.
phase
(
gp
,
1.
)
≈
90.
@test
phase
(
gp
,
0.25
)
≈
90
/
4
@test
variables
.
phase
(
gp
,
0.25
)
≈
90
/
4
@test
phase
(
gp
,
2.5
)
≈
90
*
7
/
4
@test
variables
.
phase
(
gp
,
2.5
)
≈
90
*
7
/
4
@test
phase
(
gp
,
3.5
)
≈
180.
@test
variables
.
phase
(
gp
,
3.5
)
≈
180.
@test
phase
(
gp
,
4.
)
≈
180.
@test
variables
.
phase
(
gp
,
4.
)
≈
180.
@test
frequency
(
gp
,
0.
)
≈
1
/
4
@test
variables
.
frequency
(
gp
,
0.
)
≈
1
/
4
@test
frequency
(
gp
,
1.
)
≈
1
/
6
@test
variables
.
frequency
(
gp
,
1.
)
≈
1
/
6
@test
frequency
(
gp
,
0.25
)
≈
1
/
4
@test
variables
.
frequency
(
gp
,
0.25
)
≈
1
/
4
@test
frequency
(
gp
,
2.5
)
≈
1
/
8
@test
variables
.
frequency
(
gp
,
2.5
)
≈
1
/
8
@test
frequency
(
gp
,
3.
)
≈
1
/
12
@test
variables
.
frequency
(
gp
,
3.
)
≈
1
/
12
@test
frequency
(
gp
,
3.5
)
≈
0.
@test
variables
.
frequency
(
gp
,
3.5
)
≈
0.
@test
frequency
(
gp
,
4.
)
≈
0.
@test
variables
.
frequency
(
gp
,
4.
)
≈
0.
end
end
@testset
"SincPulse"
begin
@testset
"SincPulse"
begin
sp
=
SincPulse
(
amplitude
=
1.
,
frequency
=
2.
,
phase
=
0.
,
lobe_duration
=
10.
,
Nzeros
=
(
2
,
1
))
sp
=
SincPulse
(
amplitude
=
1.
,
frequency
=
2.
,
phase
=
0.
,
lobe_duration
=
10.
,
Nzeros
=
(
2
,
1
))
@test
duration
(
sp
)
≈
30.
@test
duration
(
sp
)
≈
30.
@test
amplitude
(
sp
,
20
)
≈
1.
@test
variables
.
amplitude
(
sp
,
20
)
≈
1.
@test
amplitude
(
sp
,
0
)
≈
0.
atol
=
1e-8
@test
variables
.
amplitude
(
sp
,
0
)
≈
0.
atol
=
1e-8
@test
amplitude
(
sp
,
10
)
≈
0.
atol
=
1e-8
@test
variables
.
amplitude
(
sp
,
10
)
≈
0.
atol
=
1e-8
@test
phase
(
sp
,
20
)
≈
0.
atol
=
1e-8
@test
variables
.
phase
(
sp
,
20
)
≈
0.
atol
=
1e-8
@test
phase
(
sp
,
0
)
≈
-
360
*
40
@test
variables
.
phase
(
sp
,
0
)
≈
-
360
*
40
@test
phase
(
sp
,
10
)
≈
-
360
*
20
@test
variables
.
phase
(
sp
,
10
)
≈
-
360
*
20
@test
phase
(
sp
,
30
)
≈
360
*
20
@test
variables
.
phase
(
sp
,
30
)
≈
360
*
20
@test
frequency
(
sp
,
π
)
≈
2.
@test
variables
.
frequency
(
sp
,
π
)
≈
2.
end
end
end
end
This diff is collapsed.
Click to expand it.
test/test_post_hoc.jl
+
20
−
21
View file @
7807f233
...
@@ -4,54 +4,53 @@
...
@@ -4,54 +4,53 @@
@testset
"adjust different components"
begin
@testset
"adjust different components"
begin
@testset
"finite gradients"
begin
@testset
"finite gradients"
begin
dwi
=
DWI
(
bval
=
1.
,
TE
=:
min
)
dwi
=
DWI
(
bval
=
1.
,
TE
=:
min
)
@test
bval
(
dwi
)
≈
1.
@test
variables
.
bval
(
dwi
)
≈
1.
qval_orig
=
qval
(
dwi
[
:
gradient
])
qval_orig
=
variables
.
qval
(
dwi
[
:
gradient
])
@test
all
(
qvec
(
dwi
[
:
gradient
])
.
≈
[
qval_orig
,
0.
,
0.
])
@test
all
(
variables
.
qvec
(
dwi
[
:
gradient
])
.
≈
[
qval_orig
,
0.
,
0.
])
@testset
"scale and change orientation"
begin
@testset
"scale and change orientation"
begin
new_dwi
=
adjust
(
dwi
,
diffusion
=
(
scale
=
0.5
,
orientation
=
[
0.
,
1.
,
0.
]))
new_dwi
=
adjust
(
dwi
,
diffusion
=
(
scale
=
0.5
,
orientation
=
[
0.
,
1.
,
0.
]))
@test
bval
(
new_dwi
)
≈
0.25
@test
variables
.
bval
(
new_dwi
)
≈
0.25
@test
all
(
qvec
(
new_dwi
[
:
gradient
])
.
≈
[
0.
,
qval_orig
/
2
,
0.
])
@test
all
(
variables
.
qvec
(
new_dwi
[
:
gradient
])
.
≈
[
0.
,
qval_orig
/
2
,
0.
])
end
end
@testset
"Rotate gradient"
begin
@testset
"Rotate gradient"
begin
new_dwi
=
adjust
(
dwi
,
gradient
=
(
rotation
=
RotationVec
(
0.
,
0.
,
π
/
4
),
))
new_dwi
=
adjust
(
dwi
,
gradient
=
(
rotation
=
RotationVec
(
0.
,
0.
,
π
/
4
),
))
@test
bval
(
new_dwi
)
≈
1.
@test
variables
.
bval
(
new_dwi
)
≈
1.
@test
all
(
qvec
(
new_dwi
[
:
gradient
])
.
≈
[
qval_orig
/
√2
,
qval_orig
/
√2
,
0.
])
@test
all
(
variables
.
qvec
(
new_dwi
[
:
gradient
])
.
≈
[
qval_orig
/
√2
,
qval_orig
/
√2
,
0.
])
end
end
end
end
@testset
"instant gradients"
begin
@testset
"instant gradients"
begin
dwi
=
DWI
(
bval
=
1.
,
TE
=
80
,
Δ
=
40
,
gradient
=
(
type
=:
instant
,
))
dwi
=
DWI
(
bval
=
1.
,
TE
=
80
,
Δ
=
40
,
gradient
=
(
type
=:
instant
,
))
@test
bval
(
dwi
)
≈
1.
@test
variables
.
bval
(
dwi
)
≈
1.
qval_orig
=
qval
(
dwi
[
:
gradient
])
qval_orig
=
variables
.
qval
(
dwi
[
:
gradient
])
@test
all
(
qvec
(
dwi
[
:
gradient
])
.
≈
[
qval_orig
,
0.
,
0.
])
@test
all
(
variables
.
qvec
(
dwi
[
:
gradient
])
.
≈
[
qval_orig
,
0.
,
0.
])
@testset
"scale and change orientation"
begin
@testset
"scale and change orientation"
begin
new_dwi
=
adjust
(
dwi
,
diffusion
=
(
scale
=
0.5
,
orientation
=
[
0.
,
1.
,
0.
]))
new_dwi
=
adjust
(
dwi
,
diffusion
=
(
scale
=
0.5
,
orientation
=
[
0.
,
1.
,
0.
]))
@test
bval
(
new_dwi
)
≈
0.25
@test
variables
.
bval
(
new_dwi
)
≈
0.25
@test
all
(
qvec
(
new_dwi
[
:
gradient
])
.
≈
[
0.
,
qval_orig
/
2
,
0.
])
@test
all
(
variables
.
qvec
(
new_dwi
[
:
gradient
])
.
≈
[
0.
,
qval_orig
/
2
,
0.
])
@testset
"multiple adjustments"
begin
@testset
"multiple adjustments"
begin
new_dwi
=
adjust
(
dwi
,
diffusion
=
(
scale
=
[
0.5
,
1.
],
orientation
=
[
0.
,
1.
,
0.
]),
merge
=
false
)
new_dwi
=
adjust
(
dwi
,
diffusion
=
(
scale
=
[
0.5
,
1.
],
orientation
=
[
0.
,
1.
,
0.
]),
merge
=
false
)
@test
length
(
new_dwi
)
==
2
@test
length
(
new_dwi
)
==
2
@test
bval
(
new_dwi
[
1
])
≈
0.25
@test
variables
.
bval
(
new_dwi
[
1
])
≈
0.25
@test
bval
(
new_dwi
[
2
])
≈
1.
@test
variables
.
bval
(
new_dwi
[
2
])
≈
1.
@test
all
(
qvec
(
new_dwi
[
1
][
:
gradient
])
.
≈
[
0.
,
qval_orig
/
2
,
0.
])
@test
all
(
variables
.
qvec
(
new_dwi
[
1
][
:
gradient
])
.
≈
[
0.
,
qval_orig
/
2
,
0.
])
@test
all
(
qvec
(
new_dwi
[
2
][
:
gradient
])
.
≈
[
0.
,
qval_orig
,
0.
])
@test
all
(
variables
.
qvec
(
new_dwi
[
2
][
:
gradient
])
.
≈
[
0.
,
qval_orig
,
0.
])
new_dwi
=
adjust
(
dwi
,
diffusion
=
(
scale
=
[
0.5
,
1.
],
orientation
=
[
0.
,
1.
,
0.
]))
new_dwi
=
adjust
(
dwi
,
diffusion
=
(
scale
=
[
0.5
,
1.
],
orientation
=
[
0.
,
1.
,
0.
]))
@test
duration
(
new_dwi
)
≈
160
@test
variables
.
duration
(
new_dwi
)
≈
160
@test
length
(
new_dwi
)
==
2
@test
length
(
new_dwi
)
==
2
new_dwi
=
adjust
(
dwi
,
diffusion
=
(
scale
=
[
0.5
,
1.
],
orientation
=
[
0.
,
1.
,
0.
]),
merge
=
(
wait_time
=
10
,
))
new_dwi
=
adjust
(
dwi
,
diffusion
=
(
scale
=
[
0.5
,
1.
],
orientation
=
[
0.
,
1.
,
0.
]),
merge
=
(
wait_time
=
10
,
))
@test
duration
(
new_dwi
)
≈
170
@test
variables
.
duration
(
new_dwi
)
≈
170
@test
length
(
new_dwi
)
==
3
@test
length
(
new_dwi
)
==
3
end
end
end
end
@testset
"Rotate gradient"
begin
@testset
"Rotate gradient"
begin
new_dwi
=
adjust
(
dwi
,
gradient
=
(
rotation
=
RotationVec
(
0.
,
0.
,
π
/
4
),
))
new_dwi
=
adjust
(
dwi
,
gradient
=
(
rotation
=
RotationVec
(
0.
,
0.
,
π
/
4
),
))
@test
bval
(
new_dwi
)
≈
1.
@test
variables
.
bval
(
new_dwi
)
≈
1.
@test
all
(
qvec
(
new_dwi
[
:
gradient
])
.
≈
[
qval_orig
/
√2
,
qval_orig
/
√2
,
0.
])
@test
all
(
variables
.
qvec
(
new_dwi
[
:
gradient
])
.
≈
[
qval_orig
/
√2
,
qval_orig
/
√2
,
0.
])
end
end
end
end
end
end
...
...
This diff is collapsed.
Click to expand it.
test/test_sequences.jl
+
29
−
30
View file @
7807f233
...
@@ -6,8 +6,8 @@
...
@@ -6,8 +6,8 @@
@test
all
(
isapprox
.
(
duration
.
(
seq
),
[
0.
,
40.
,
0.
],
atol
=
1e-6
))
@test
all
(
isapprox
.
(
duration
.
(
seq
),
[
0.
,
40.
,
0.
],
atol
=
1e-6
))
@test
length
(
collect
(
iter_instant_pulses
(
seq
)))
==
1
@test
length
(
collect
(
iter_instant_pulses
(
seq
)))
==
1
@test
length
(
collect
(
iter_instant_gradients
(
seq
)))
==
0.
@test
length
(
collect
(
iter_instant_gradients
(
seq
)))
==
0.
@test
duration_dephase
(
seq
)
≈
40.
@test
variables
.
duration_dephase
(
seq
)
≈
40.
@test
duration_transverse
(
seq
)
≈
40.
@test
variables
.
duration_transverse
(
seq
)
≈
40.
end
end
@testset
"SpinEcho"
begin
@testset
"SpinEcho"
begin
seq
=
SpinEcho
(
TE
=
40
)
seq
=
SpinEcho
(
TE
=
40
)
...
@@ -16,8 +16,8 @@
...
@@ -16,8 +16,8 @@
@test
all
(
isapprox
.
(
duration
.
(
seq
),
[
0.
,
20.
,
0.
,
20.
,
0.
],
atol
=
1e-6
))
@test
all
(
isapprox
.
(
duration
.
(
seq
),
[
0.
,
20.
,
0.
,
20.
,
0.
],
atol
=
1e-6
))
@test
length
(
collect
(
iter_instant_pulses
(
seq
)))
==
2
@test
length
(
collect
(
iter_instant_pulses
(
seq
)))
==
2
@test
length
(
collect
(
iter_instant_gradients
(
seq
)))
==
0.
@test
length
(
collect
(
iter_instant_gradients
(
seq
)))
==
0.
@test
duration_dephase
(
seq
)
≈
0.
atol
=
1e-4
@test
variables
.
duration_dephase
(
seq
)
≈
0.
atol
=
1e-4
@test
duration_transverse
(
seq
)
≈
40.
@test
variables
.
duration_transverse
(
seq
)
≈
40.
end
end
@testset
"DW-SE"
begin
@testset
"DW-SE"
begin
...
@@ -56,23 +56,23 @@
...
@@ -56,23 +56,23 @@
@testset
"Set diffusion time Δ"
begin
@testset
"Set diffusion time Δ"
begin
seq
=
DiffusionSpinEcho
(
TE
=
80.
,
Δ
=
70.
,
qval
=:
max
)
seq
=
DiffusionSpinEcho
(
TE
=
80.
,
Δ
=
70.
,
qval
=:
max
)
@test
all
(
isapprox
.
(
duration
.
(
seq
),
[
0.
,
0.
,
10.
,
30.
,
0.
,
30.
,
10.
,
0.
,
0.
],
atol
=
1e-4
,
rtol
=
1e-4
))
@test
all
(
isapprox
.
(
duration
.
(
seq
),
[
0.
,
0.
,
10.
,
30.
,
0.
,
30.
,
10.
,
0.
,
0.
],
atol
=
1e-4
,
rtol
=
1e-4
))
@test
Δ
(
seq
)
≈
70.
@test
variables
.
Δ
(
seq
)
≈
70.
@test
TE
(
seq
)
≈
80.
@test
variables
.
TE
(
seq
)
≈
80.
@test
TR
(
seq
)
≈
80.
@test
variables
.
TR
(
seq
)
≈
80.
@test
0.72
<
bval
(
seq
)
<
0.73
@test
0.72
<
variables
.
bval
(
seq
)
<
0.73
@test
readout_times
(
seq
)[
1
]
≈
TE
(
seq
)
@test
variables
.
readout_times
(
seq
)[
1
]
≈
variables
.
TE
(
seq
)
@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
),
[
0.
,
min_rise_time
,
10.
-
min_rise_time
,
10.
,
40
,
70
,
70
+
min_rise_time
,
80
-
min_rise_time
,
80.
],
atol
=
1e-4
))
@test
all
(
isapprox
.
(
edge_times
(
seq
),
[
0.
,
min_rise_time
,
10.
-
min_rise_time
,
10.
,
40
,
70
,
70
+
min_rise_time
,
80
-
min_rise_time
,
80.
],
atol
=
1e-4
))
end
end
@testset
"Set gradient duration"
begin
@testset
"Set gradient duration"
begin
seq
=
DiffusionSpinEcho
(
TE
=
80.
,
gradient
=
(
duration
=
10.
,
),
bval
=:
max
)
seq
=
DiffusionSpinEcho
(
TE
=
80.
,
gradient
=
(
duration
=
10.
,
),
bval
=:
max
)
@test
all
(
isapprox
.
(
duration
.
(
seq
),
[
0.
,
0.
,
10.
,
30.
,
0.
,
30.
,
10.
,
0.
,
0.
],
atol
=
1e-4
,
rtol
=
1e-4
))
@test
all
(
isapprox
.
(
duration
.
(
seq
),
[
0.
,
0.
,
10.
,
30.
,
0.
,
30.
,
10.
,
0.
,
0.
],
atol
=
1e-4
,
rtol
=
1e-4
))
@test
Δ
(
seq
)
≈
70.
rtol
=
1e-4
@test
variables
.
Δ
(
seq
)
≈
70.
rtol
=
1e-4
@test
TE
(
seq
)
≈
80.
@test
variables
.
TE
(
seq
)
≈
80.
@test
TR
(
seq
)
≈
80.
@test
variables
.
TR
(
seq
)
≈
80.
@test
0.72
<
bval
(
seq
)
<
0.73
@test
0.72
<
variables
.
bval
(
seq
)
<
0.73
@test
readout_times
(
seq
)[
1
]
≈
TE
(
seq
)
@test
variables
.
readout_times
(
seq
)[
1
]
≈
variables
.
TE
(
seq
)
@test
rise_time
(
seq
[
:
gradient
])
≈
min_rise_time
rtol
=
1e-4
@test
variables
.
rise_time
(
seq
[
:
gradient
])
≈
min_rise_time
rtol
=
1e-4
end
end
end
end
@testset
"DW-SE with finite RF pulses"
begin
@testset
"DW-SE with finite RF pulses"
begin
...
@@ -88,9 +88,9 @@
...
@@ -88,9 +88,9 @@
end
end
end
end
@test
duration
(
seq
[
:
gradient
])
≈
duration
(
seq
[
:
gradient2
])
@test
duration
(
seq
[
:
gradient
])
≈
duration
(
seq
[
:
gradient2
])
@test
bval
(
seq
)
≈
2.
@test
variables
.
bval
(
seq
)
≈
2.
@test
length
(
readout_times
(
seq
))
==
1
@test
length
(
readout_times
(
seq
))
==
1
@test
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
(
TR
=:
min
,
bval
=
2.
,
voxel_size
=
2.
,
fov
=
(
20
,
20
,
20
))
...
@@ -104,33 +104,32 @@
...
@@ -104,33 +104,32 @@
end
end
end
end
@test
duration
(
seq
[
:
gradient
])
≈
duration
(
seq
[
:
gradient2
])
@test
duration
(
seq
[
:
gradient
])
≈
duration
(
seq
[
:
gradient2
])
@test
bval
(
seq
)
≈
2.
@test
variables
.
bval
(
seq
)
≈
2.
@test
length
(
readout_times
(
seq
))
>
50
@test
length
(
readout_times
(
seq
))
>
50
@test
67
<
TE
(
seq
)
<
68
@test
67
<
variables
.
TE
(
seq
)
<
68
@test
72
<
TR
(
seq
)
<
73
@test
72
<
variables
.
TR
(
seq
)
<
73
(
pulse
,
t_pulse
)
=
get_pulse
(
seq
,
1.
)
(
pulse
,
t_pulse
)
=
get_pulse
(
seq
,
1.
)
@test
1.
-
t_pulse
≈
min_rise_time
rtol
=
1e-4
@test
1.
-
t_pulse
≈
min_rise_time
rtol
=
1e-4
@test
flip_angle
(
pulse
)
≈
90.
@test
variables
.
flip_angle
(
pulse
)
≈
90.
@test
iszero
(
phase
(
pulse
))
@test
iszero
(
variables
.
phase
(
pulse
))
@test
iszero
(
phase
(
seq
,
1.
))
@test
iszero
(
variables
.
phase
(
seq
,
1.
))
@test
iszero
(
frequency
(
seq
,
1.
))
@test
iszero
(
variables
.
frequency
(
seq
,
1.
))
@test
isnothing
(
get_pulse
(
seq
,
10.
))
@test
isnothing
(
get_pulse
(
seq
,
10.
))
@test
isnan
(
phase
(
seq
,
10.
))
@test
isnan
(
variables
.
phase
(
seq
,
10.
))
@test
isnan
(
frequency
(
seq
,
10.
))
@test
isnan
(
variables
.
frequency
(
seq
,
10.
))
gp
=
GenericPulse
(
pulse
,
0.
,
1.
)
gp
=
GenericPulse
(
pulse
,
0.
,
1.
)
@test
gp
.
amplitude
[
1
]
≈
0.
atol
=
1e-8
@test
gp
.
amplitude
[
1
]
≈
0.
atol
=
1e-8
@test
gp
.
amplitude
[
end
]
≈
amplitude
(
pulse
,
1.
)
rtol
=
1e-2
@test
gp
.
amplitude
[
end
]
≈
variables
.
amplitude
(
pulse
,
1.
)
rtol
=
1e-2
@test
all
(
iszero
.
(
gp
.
phase
))
@test
all
(
iszero
.
(
gp
.
phase
))
(
pulse
,
t_pulse
)
=
get_pulse
(
seq
,
35.
)
(
pulse
,
t_pulse
)
=
get_pulse
(
seq
,
35.
)
@test
1.1
<
t_pulse
<
1.2
@test
1.1
<
t_pulse
<
1.2
@test
flip_angle
(
pulse
)
≈
180.
@test
variables
.
flip_angle
(
pulse
)
≈
180.
@test
iszero
(
phase
(
pulse
))
@test
iszero
(
phase
(
pulse
))
end
end
end
end
end
end
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