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
1320e408
Unverified
Commit
1320e408
authored
9 months ago
by
Michiel Cottaar
Browse files
Options
Downloads
Patches
Plain Diff
Add test for :pulseq IO format
parent
45f32a25
No related branches found
No related tags found
1 merge request
!3
Add InstantPulse and InstantGradient pulseq extension support
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
test/test_IO.jl
+33
-32
33 additions, 32 deletions
test/test_IO.jl
with
33 additions
and
32 deletions
test/test_IO.jl
+
33
−
32
View file @
1320e408
...
@@ -84,46 +84,47 @@
...
@@ -84,46 +84,47 @@
@test
variables
.
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
for
format
in
(
:
pulseq
,
:
serialize
)
@testset
"check that serialisation works for all v1.4.0 files in 01_from_FID_to_PRESS"
begin
@testset
"check that format
$(format)
works for 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"
)
for
fn
in
readdir
(
path
)
for
fn
in
readdir
(
path
)
@testset
"checking
$
fn"
begin
@testset
"checking
$
fn"
begin
if
!
endswith
(
fn
,
".seq"
)
if
!
endswith
(
fn
,
".seq"
)
continue
continue
end
full_filename
=
joinpath
(
path
,
fn
)
seq_orig
=
read_sequence
(
full_filename
)
io
=
IOBuffer
()
write_sequence
(
io
,
seq_orig
,
format
=
format
)
seek
(
io
,
0
)
seq_json
=
read_sequence
(
io
,
format
=
format
)
@test
variables
.
duration
(
seq_orig
)
==
variables
.
duration
(
seq_json
)
@test
length
(
seq_orig
)
==
length
(
seq_json
)
@test
all
(
variables
.
duration
.
(
seq_orig
)
.==
variables
.
duration
.
(
seq_json
))
@test
iszero
(
length
(
iter_instant_gradients
(
seq_json
)))
@test
iszero
(
length
(
iter_instant_pulses
(
seq_json
)))
@test
all
(
variables
.
readout_times
(
seq_json
)
.==
variables
.
readout_times
(
seq_orig
))
end
end
full_filename
=
joinpath
(
path
,
fn
)
end
seq_orig
=
read_sequence
(
full_filename
)
end
@testset
"check that format
$(format)
works for some sequences with instant pulses/gradients"
begin
for
seq_orig
in
[
DWI
(
TE
=
80.
,
bval
=
2.
,
scanner
=
Siemens_Connectom
),
DWI
(
TE
=
80.
,
bval
=
2.
,
scanner
=
Siemens_Terra
,
gradient
=
(
type
=:
instant
,
)),
SpinEcho
(
TE
=
30.
),
]
io
=
IOBuffer
()
io
=
IOBuffer
()
write_sequence
(
io
,
seq_orig
,
format
=
:
serialize
)
write_sequence
(
io
,
seq_orig
;
format
=
format
)
seek
(
io
,
0
)
seek
(
io
,
0
)
seq_json
=
read_sequence
(
io
,
format
=
:
serialize
)
seq_json
=
read_sequence
(
io
;
format
=
format
)
@test
variables
.
duration
(
seq_orig
)
==
variables
.
duration
(
seq_json
)
@test
variables
.
duration
(
seq_orig
)
==
variables
.
duration
(
seq_json
)
@test
length
(
seq_orig
)
==
length
(
seq_json
)
@test
length
(
seq_orig
)
==
length
(
seq_json
)
@test
all
(
variables
.
duration
.
(
seq_orig
)
.==
variables
.
duration
.
(
seq_json
))
@test
all
(
variables
.
duration
.
(
seq_orig
)
.==
variables
.
duration
.
(
seq_json
))
@test
iszero
(
length
(
iter_instant_gradients
(
seq_json
))
)
@test
length
(
iter_instant_gradients
(
seq_json
))
==
length
(
iter_instant_gradients
(
seq_json
))
@test
iszero
(
length
(
iter_instant_pulses
(
seq_json
))
)
@test
length
(
iter_instant_pulses
(
seq_json
))
==
length
(
iter_instant_pulses
(
seq_json
))
@test
all
(
variables
.
readout_times
(
seq_json
)
.==
variables
.
readout_times
(
seq_orig
))
@test
all
(
variables
.
readout_times
(
seq_json
)
.==
variables
.
readout_times
(
seq_orig
))
end
end
end
end
end
end
@testset
"check that serialisation works for some sequences with instant pulses/gradients"
begin
for
seq_orig
in
[
DWI
(
TE
=
80.
,
bval
=
2.
,
scanner
=
Siemens_Connectom
),
DWI
(
TE
=
80.
,
bval
=
2.
,
scanner
=
Siemens_Terra
,
gradient
=
(
type
=:
instant
,
)),
SpinEcho
(
TE
=
30.
),
]
io
=
IOBuffer
()
write_sequence
(
io
,
seq_orig
;
format
=:
serialize
)
seek
(
io
,
0
)
seq_json
=
read_sequence
(
io
;
format
=:
serialize
)
@test
variables
.
duration
(
seq_orig
)
==
variables
.
duration
(
seq_json
)
@test
length
(
seq_orig
)
==
length
(
seq_json
)
@test
all
(
variables
.
duration
.
(
seq_orig
)
.==
variables
.
duration
.
(
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
all
(
variables
.
readout_times
(
seq_json
)
.==
variables
.
readout_times
(
seq_orig
))
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