Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Write Pulseq #284

Open
wants to merge 128 commits into
base: master
Choose a base branch
from
Open
Changes from 1 commit
Commits
Show all changes
128 commits
Select commit Hold shift + click to select a range
a559ef4
Translate some functions and structs from Pulseq MATLAB to Julia
beorostica Jan 10, 2024
7626005
Add test code for writing a pulseq file from a Sequence struct
beorostica Jan 10, 2024
071ce8d
Merge branch 'master' into pulseq
beorostica Jan 15, 2024
20914f9
Organize code and tests for writing Pulseq functionality
beorostica Jan 15, 2024
5239213
Remove Pulseq written test files
beorostica Jan 16, 2024
d9aef17
Merge branch 'master' into pulseq
beorostica Jan 16, 2024
3b9d4d1
Merge branch 'master' into pulseq
beorostica Jan 19, 2024
cae64de
Load pulseq sequences faster and allow comparison
gabuzi Dec 3, 2023
efadc1a
Add a test for fast read sequence
beorostica Jan 23, 2024
b086efd
Restore previous tests in KomaMRIFiles
beorostica Jan 23, 2024
db4e10a
Merge read .seq optimization branch into pulseq
beorostica Jan 23, 2024
4be6f65
Merge branch 'master' into pulseq
beorostica Jan 23, 2024
e1ab97a
Test the optimized read function for reading more .seq examples
beorostica Jan 23, 2024
4dc29d9
Fix RF angles when writing .seq files
beorostica Jan 24, 2024
e5728b5
Remove some comments when testing the write pulseq functionality
beorostica Jan 24, 2024
fd8822f
Remove the optimized read pulseq fuctionality from the write pulseq …
beorostica Jan 25, 2024
cb07ea1
Fix the precision of RF comparisons and RF delay
beorostica Jan 26, 2024
004dca2
Merge branch 'master' into pulseq
beorostica Apr 11, 2024
0d4d5e0
Fix RF angle when writing .seq files
beorostica Apr 11, 2024
7d05c70
Update KomaMRIBase/src/datatypes/Sequence.jl
beorostica Apr 11, 2024
372b751
Update KomaMRIBase/src/datatypes/Sequence.jl
beorostica Apr 11, 2024
8749d36
Update KomaMRIBase/src/datatypes/Sequence.jl
beorostica Apr 11, 2024
70f584e
Update KomaMRIBase/src/datatypes/sequence/ADC.jl
beorostica Apr 11, 2024
807c0c4
Update KomaMRIBase/src/datatypes/sequence/RF.jl
beorostica Apr 11, 2024
0f1a395
Update KomaMRIFiles/src/Sequence/WritePulseq.jl
beorostica Apr 11, 2024
da90d4c
Update KomaMRIFiles/src/Sequence/WritePulseq.jl
beorostica Apr 11, 2024
a91698b
Update KomaMRIFiles/src/Sequence/WritePulseq.jl
beorostica Apr 11, 2024
e39fcf2
Update KomaMRIFiles/src/Sequence/WritePulseq.jl
beorostica Apr 11, 2024
2afd1fb
Update KomaMRIFiles/src/Sequence/WritePulseq.jl
beorostica Apr 11, 2024
4449abe
Update KomaMRIFiles/src/Sequence/WritePulseq.jl
beorostica Apr 11, 2024
93f7d86
Update KomaMRIFiles/test/runtests.jl
beorostica Apr 11, 2024
e811d18
Update KomaMRIBase/src/datatypes/Sequence.jl
beorostica Apr 11, 2024
98f87db
Update KomaMRIFiles/src/Sequence/WritePulseq.jl
beorostica Apr 11, 2024
ee4305c
Update KomaMRIFiles/src/Sequence/WritePulseq.jl
beorostica Apr 11, 2024
9e1b9b1
Update KomaMRIFiles/src/Sequence/WritePulseq.jl
beorostica Apr 11, 2024
972e623
Update KomaMRIFiles/test/runtests.jl
beorostica Apr 11, 2024
62993c1
Update KomaMRIFiles/src/Sequence/WritePulseq.jl
beorostica Apr 11, 2024
bc4b83c
Update KomaMRIFiles/src/Sequence/WritePulseq.jl
beorostica Apr 11, 2024
6cbf779
Update KomaMRIFiles/test/runtests.jl
beorostica Apr 11, 2024
5eee63a
Update KomaMRIFiles/test/runtests.jl
beorostica Apr 11, 2024
2a31539
Update KomaMRIFiles/test/runtests.jl
beorostica Apr 11, 2024
082668b
Update KomaMRIFiles/src/Sequence/WritePulseq.jl
beorostica Apr 11, 2024
874677e
Update KomaMRIFiles/src/Sequence/WritePulseq.jl
beorostica Apr 11, 2024
5a06916
Update KomaMRIFiles/src/Sequence/WritePulseq.jl
beorostica Apr 11, 2024
eff7f20
Update KomaMRIFiles/src/Sequence/WritePulseq.jl
beorostica Apr 11, 2024
4600a27
Update KomaMRIFiles/src/Sequence/WritePulseq.jl
beorostica Apr 11, 2024
64e9800
Update KomaMRIFiles/src/Sequence/WritePulseq.jl
beorostica Apr 11, 2024
30d1c72
Update KomaMRIFiles/src/Sequence/WritePulseq.jl
beorostica Apr 11, 2024
bfea890
Update KomaMRIFiles/src/Sequence/WritePulseq.jl
beorostica Apr 11, 2024
579031e
Update KomaMRIFiles/src/Sequence/WritePulseq.jl
beorostica Apr 11, 2024
6c3bd4c
Update KomaMRIFiles/src/Sequence/WritePulseq.jl
beorostica Apr 11, 2024
24e6c90
Update KomaMRIFiles/src/Sequence/WritePulseq.jl
beorostica Apr 11, 2024
dd723da
Update KomaMRIFiles/src/Sequence/WritePulseq.jl
beorostica Apr 11, 2024
0f186bd
Update KomaMRIFiles/src/Sequence/WritePulseq.jl
beorostica Apr 11, 2024
ac99a92
Update KomaMRIFiles/src/Sequence/WritePulseq.jl
beorostica Apr 11, 2024
37c0af3
Update KomaMRIFiles/src/Sequence/WritePulseq.jl
beorostica Apr 11, 2024
595df76
Add reviewdog suggestions
beorostica Apr 11, 2024
23c1dc6
Update KomaMRIFiles/src/Sequence/WritePulseq.jl
beorostica Apr 11, 2024
a54fe2f
Update KomaMRIFiles/src/Sequence/WritePulseq.jl
beorostica Apr 11, 2024
54c92eb
Update KomaMRIFiles/src/Sequence/WritePulseq.jl
beorostica Apr 11, 2024
b3c1658
Update KomaMRIFiles/src/Sequence/WritePulseq.jl
beorostica Apr 11, 2024
5cae2ed
Update KomaMRIFiles/src/Sequence/WritePulseq.jl
beorostica Apr 11, 2024
2b0a634
Update KomaMRIFiles/src/Sequence/WritePulseq.jl
beorostica Apr 11, 2024
6daf695
Update KomaMRIFiles/src/Sequence/WritePulseq.jl
beorostica Apr 11, 2024
48e4aaf
Update KomaMRIFiles/src/Sequence/WritePulseq.jl
beorostica Apr 11, 2024
3b3d5c7
Update KomaMRIFiles/src/Sequence/WritePulseq.jl
beorostica Apr 11, 2024
7d25a25
Delete `in` word in write pulseq file
beorostica Apr 11, 2024
a5466e5
Delete blank spaces from write pulseq file
beorostica Apr 11, 2024
04519f0
Apply format style to write pulseq file
beorostica Apr 11, 2024
d729110
Add some reviewdog suggestions
beorostica Apr 11, 2024
c16fd19
Add some reviewdog suggestions
beorostica Apr 11, 2024
32f3295
Add some reviewdog suggestions
beorostica Apr 11, 2024
58a7789
Create common pulseq examples folder for KomaMRIFiles tests
beorostica Apr 11, 2024
2456434
Add write sequence to API documentation
beorostica Apr 11, 2024
bbed561
Fix when writting zero amplitude gradients
beorostica Apr 12, 2024
8147b7b
Remove magsign function when writing pulseq
beorostica Apr 12, 2024
f00f10d
Add reviewdog style suggestion
beorostica Apr 12, 2024
4c7729a
Remove duplicated compress function
beorostica Apr 12, 2024
b5dcbed
Add some spaces to comments
beorostica Apr 12, 2024
177d05d
Replace some reshapes to [x;;] notation
beorostica Apr 12, 2024
99f9328
Add reviewdog style for __VERSION__
beorostica Apr 12, 2024
2f193cd
Update KomaMRIPlots/src/KomaMRIPlots.jl
beorostica Apr 12, 2024
80f055c
Compare angles with exponential expression
beorostica Apr 12, 2024
e9c20d6
Add functions for safe comparison when writing pulseq
beorostica Apr 15, 2024
43dcc62
Refactor safe comparison functions when writing pulseq
beorostica Apr 15, 2024
08cd263
Consider all definitions when writing pulseq
beorostica Apr 15, 2024
bbb0858
Update runtests for KomaMRIFiles
beorostica Apr 15, 2024
0b668ec
Define event on when writing pulseq
beorostica Apr 16, 2024
2dd30b0
Refactor get unique events when writing pulseq
beorostica Apr 16, 2024
bcf5515
Refactor and rewrite some RF related variables and functions when wri…
beorostica Apr 16, 2024
d26108b
Update KomaMRIFiles/src/Sequence/WritePulseq.jl
beorostica Apr 16, 2024
c6a2140
Update KomaMRIFiles/src/Sequence/WritePulseq.jl
beorostica Apr 16, 2024
511dc91
Rename some ADC related variables when writing pulseq
beorostica Apr 16, 2024
72718e6
Rename some Grad related variables when writing pulseq
beorostica Apr 16, 2024
793d2ea
Improve readability of @printf when writing pulseq
beorostica Apr 16, 2024
517d7e2
Update KomaMRIFiles/src/Sequence/WritePulseq.jl
beorostica Apr 16, 2024
5c2da8c
Update KomaMRIFiles/src/Sequence/WritePulseq.jl
beorostica Apr 16, 2024
b835beb
Update KomaMRIFiles/src/Sequence/WritePulseq.jl
beorostica Apr 16, 2024
458609e
Update KomaMRIFiles/src/Sequence/WritePulseq.jl
beorostica Apr 16, 2024
d90bd4c
Update KomaMRIFiles/src/Sequence/WritePulseq.jl
beorostica Apr 16, 2024
69841da
Update KomaMRIFiles/src/Sequence/WritePulseq.jl
beorostica Apr 16, 2024
64ca46b
Update KomaMRIFiles/src/Sequence/WritePulseq.jl
beorostica Apr 16, 2024
bbd5715
Update KomaMRIFiles/src/Sequence/WritePulseq.jl
beorostica Apr 16, 2024
aba0007
Fix @printf bugs when writing pulseq
beorostica Apr 16, 2024
600770b
Refactor runtests for KomaMRIFiles
beorostica Apr 16, 2024
9832de0
Remove extensions section when writing pulseq
beorostica Apr 16, 2024
7fd0f4b
Refactor runtests for KomaMRIFiles
beorostica Apr 16, 2024
35baedd
Update KomaMRIFiles/test/runtests.jl
beorostica Apr 16, 2024
fdd77f8
Update KomaMRIFiles/test/runtests.jl
beorostica Apr 16, 2024
bc5d51f
Rename some Shapes related variables when writing pulseq
beorostica Apr 17, 2024
b7e6e3c
Add table helper functions when writing pulseq
beorostica Apr 17, 2024
cc359cc
Add pacth for considering gradients with zero amplitude when writing …
beorostica Apr 17, 2024
7d6b94e
Refactor some new lines when writing pulseq
beorostica Apr 17, 2024
3d33e3c
Compare angles with isapprox when writing pulseq
beorostica Apr 17, 2024
88e6482
Create intermediate pulseq object when writing pulseq
beorostica Apr 18, 2024
f330473
Add reviewdog suggestions
beorostica Apr 18, 2024
724b10f
Refactor with tuples when writing pulseq
beorostica Apr 18, 2024
6d1a75b
Add get pulseq object function when writing pulseq
beorostica Apr 18, 2024
12c1927
Merge master into pulseq writer branch
beorostica Apr 23, 2024
5c8a96e
Fix bug when writing pulseq
beorostica Apr 23, 2024
ddd53f9
Optimize functions for writing pulseq
beorostica Apr 24, 2024
3f7be9f
Set zero-Grad when reading pulseq gradients with zero amplitude
beorostica Apr 24, 2024
c73dd9a
Optimize function when writing pulseq
beorostica Apr 24, 2024
80aa28b
Revert return conditional when reading pulseq gradients
beorostica Apr 24, 2024
636d359
Add a return statement
beorostica Apr 24, 2024
41588bf
Remove some aux functions when writing pulseq
beorostica Apr 25, 2024
17fbe9b
Merge branch 'master' into pulseq
cncastillo May 30, 2024
1d2df48
Merge branch 'master' into pulseq
cncastillo Jun 4, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Add test code for writing a pulseq file from a Sequence struct
beorostica committed Jan 10, 2024
commit 76260053db1325bdd100a22bdaaf84335abb731c
4,838 changes: 4,838 additions & 0 deletions KomaMRIFiles/src/Sequence/writerTestData/DEMO_gre0.seq

Large diffs are not rendered by default.

4,836 changes: 4,836 additions & 0 deletions KomaMRIFiles/src/Sequence/writerTestData/DEMO_gre1.seq

Large diffs are not rendered by default.

4,838 changes: 4,838 additions & 0 deletions KomaMRIFiles/src/Sequence/writerTestData/DEMO_grep0.seq

Large diffs are not rendered by default.

4,836 changes: 4,836 additions & 0 deletions KomaMRIFiles/src/Sequence/writerTestData/DEMO_grep1.seq

Large diffs are not rendered by default.

7,683 changes: 7,683 additions & 0 deletions KomaMRIFiles/src/Sequence/writerTestData/cine_gre0.seq

Large diffs are not rendered by default.

7,683 changes: 7,683 additions & 0 deletions KomaMRIFiles/src/Sequence/writerTestData/cine_gre1.seq

Large diffs are not rendered by default.

3,463 changes: 3,463 additions & 0 deletions KomaMRIFiles/src/Sequence/writerTestData/epi0.seq

Large diffs are not rendered by default.

3,463 changes: 3,463 additions & 0 deletions KomaMRIFiles/src/Sequence/writerTestData/epi1.seq

Large diffs are not rendered by default.

11,455 changes: 11,455 additions & 0 deletions KomaMRIFiles/src/Sequence/writerTestData/epi_label0.seq

Large diffs are not rendered by default.

13,914 changes: 13,914 additions & 0 deletions KomaMRIFiles/src/Sequence/writerTestData/epi_label1.seq

Large diffs are not rendered by default.

3,292 changes: 3,292 additions & 0 deletions KomaMRIFiles/src/Sequence/writerTestData/epi_rs0.seq

Large diffs are not rendered by default.

5,120 changes: 5,120 additions & 0 deletions KomaMRIFiles/src/Sequence/writerTestData/epi_rs1.seq

Large diffs are not rendered by default.

3,226 changes: 3,226 additions & 0 deletions KomaMRIFiles/src/Sequence/writerTestData/epi_se0.seq

Large diffs are not rendered by default.

3,225 changes: 3,225 additions & 0 deletions KomaMRIFiles/src/Sequence/writerTestData/epi_se1.seq

Large diffs are not rendered by default.

10,353 changes: 10,353 additions & 0 deletions KomaMRIFiles/src/Sequence/writerTestData/epise_rs0.seq

Large diffs are not rendered by default.

10,690 changes: 10,690 additions & 0 deletions KomaMRIFiles/src/Sequence/writerTestData/epise_rs1.seq

Large diffs are not rendered by default.

95 changes: 95 additions & 0 deletions KomaMRIFiles/src/Sequence/writerTestData/external0.seq
Original file line number Diff line number Diff line change
@@ -0,0 +1,95 @@
# Pulseq sequence file
# Created by MATLAB mr toolbox

[VERSION]
major 1
minor 4
revision 1

[DEFINITIONS]
AdcRasterTime 1e-07
BlockDurationRaster 1e-05
GradientRasterTime 1e-05
RadiofrequencyRasterTime 1e-06
TotalDuration 0.61194

# Format of blocks:
# NUM DUR RF GX GY GZ ADC EXT
[BLOCKS]
1 3000 0 0 0 0 0 0
2 1003 0 1 0 0 0 0
3 3000 0 0 0 0 0 0
4 1072 0 2 0 0 0 0
5 3000 0 0 0 0 0 0
6 1003 0 1 1 0 0 0
7 3000 0 0 0 0 0 0
8 1072 0 2 2 0 0 0
9 3000 0 0 0 0 0 0
10 1003 0 1 0 1 0 0
11 3000 0 0 0 0 0 0
12 1072 0 2 0 2 0 0
13 3000 0 0 0 0 0 0
14 1003 0 0 1 0 0 0
15 3000 0 0 0 0 0 0
16 1072 0 0 2 0 0 0
17 3000 0 0 0 0 0 0
18 1003 0 0 1 1 0 0
19 3000 0 0 0 0 0 0
20 1072 0 0 2 2 0 0
21 3000 0 0 0 0 0 0
22 1003 0 0 0 1 0 0
23 3000 0 0 0 0 0 0
24 1072 0 0 0 2 0 0
25 3000 0 0 0 0 0 0
26 1003 0 1 1 1 0 0
27 3000 0 0 0 0 0 0
28 1072 0 2 2 2 0 0
29 3000 0 0 0 0 0 0
30 1003 0 1 1 1 0 0
31 22 1 0 0 0 0 0
32 644 0 0 0 0 1 0

# Format of RF events:
# id amplitude mag_id phase_id time_shape_id delay freq phase
# .. Hz .... .... .... us Hz rad
[RF]
1 2500 1 2 3 100 0 0

# Format of trapezoid gradients:
# id amplitude rise flat fall delay
# .. Hz/m us us us us
[TRAP]
1 55348.8 10 10000 20 0
2 1.32837e+06 240 10000 480 0

# Format of ADC events:
# id num dwell delay freq phase
# .. .. ns us Hz rad
[ADC]
1 512 12500 20 0 0

# Sequence Shapes
[SHAPES]

shape_id 1
num_samples 2
1
1

shape_id 2
num_samples 2
0
0

shape_id 3
num_samples 2
0
100


[SIGNATURE]
# This is the hash of the Pulseq file, calculated right before the [SIGNATURE] section was added
# It can be reproduced/verified with md5sum if the file trimmed to the position right above [SIGNATURE]
# The new line character preceding [SIGNATURE] BELONGS to the signature (and needs to be sripped away for recalculating/verification)
Type md5
Hash eac9a93fec960319a0cfc0d8c3d596d1
95 changes: 95 additions & 0 deletions KomaMRIFiles/src/Sequence/writerTestData/external1.seq
Original file line number Diff line number Diff line change
@@ -0,0 +1,95 @@
# Pulseq sequence file
# Created by KomaMRI.jl

[VERSION]
major 1
minor 4
revision 1

[DEFINITIONS]
AdcRasterTime 1e-07
BlockDurationRaster 1e-05
GradientRasterTime 1e-05
RadiofrequencyRasterTime 1e-06
TotalDuration 0.61194

# Format of blocks:
# NUM DUR RF GX GY GZ ADC EXT
[BLOCKS]
1 3000 0 0 0 0 0 0
2 1003 0 1 0 0 0 0
3 3000 0 0 0 0 0 0
4 1072 0 2 0 0 0 0
5 3000 0 0 0 0 0 0
6 1003 0 1 1 0 0 0
7 3000 0 0 0 0 0 0
8 1072 0 2 2 0 0 0
9 3000 0 0 0 0 0 0
10 1003 0 1 0 1 0 0
11 3000 0 0 0 0 0 0
12 1072 0 2 0 2 0 0
13 3000 0 0 0 0 0 0
14 1003 0 0 1 0 0 0
15 3000 0 0 0 0 0 0
16 1072 0 0 2 0 0 0
17 3000 0 0 0 0 0 0
18 1003 0 0 1 1 0 0
19 3000 0 0 0 0 0 0
20 1072 0 0 2 2 0 0
21 3000 0 0 0 0 0 0
22 1003 0 0 0 1 0 0
23 3000 0 0 0 0 0 0
24 1072 0 0 0 2 0 0
25 3000 0 0 0 0 0 0
26 1003 0 1 1 1 0 0
27 3000 0 0 0 0 0 0
28 1072 0 2 2 2 0 0
29 3000 0 0 0 0 0 0
30 1003 0 1 1 1 0 0
31 22 1 0 0 0 0 0
32 644 0 0 0 0 1 0

# Format of RF events:
# id amplitude mag_id phase_id time_shape_id delay freq phase
# .. Hz .... .... .... us Hz rad
[RF]
1 2500 1 2 3 100 0 0

# Format of trapezoid gradients:
# id amplitude rise flat fall delay
# .. Hz/m us us us us
[TRAP]
1 55348.8 10 10000 20 0
2 1.32837e+06 240 10000 480 0

# Format of ADC events:
# id num dwell delay freq phase
# .. .. ns us Hz rad
[ADC]
1 512 12500 20 0 0

# Sequence Shapes
[SHAPES]

shape_id 1
num_samples 2
1
1

shape_id 2
num_samples 2
0
0

shape_id 3
num_samples 2
0
100


[SIGNATURE]
# This is the hash of the Pulseq file, calculated right before the [SIGNATURE] section was added
# It can be reproduced/verified with md5sum if the file trimmed to the position right above [SIGNATURE]
# The new line character preceding [SIGNATURE] BELONGS to the signature (and needs to be sripped away for recalculating/verification)
Type md5
Hash 8aa60eb05a4f2f2064c515d29235a1fd
1,569 changes: 1,569 additions & 0 deletions KomaMRIFiles/src/Sequence/writerTestData/gre_rad0.seq

Large diffs are not rendered by default.

1,569 changes: 1,569 additions & 0 deletions KomaMRIFiles/src/Sequence/writerTestData/gre_rad1.seq

Large diffs are not rendered by default.

19,063 changes: 19,063 additions & 0 deletions KomaMRIFiles/src/Sequence/writerTestData/spiral0.seq

Large diffs are not rendered by default.

19,062 changes: 19,062 additions & 0 deletions KomaMRIFiles/src/Sequence/writerTestData/spiral1.seq

Large diffs are not rendered by default.

825 changes: 825 additions & 0 deletions KomaMRIFiles/src/Sequence/writerTestData/tabletop_tse_pulseq0.seq

Large diffs are not rendered by default.

814 changes: 814 additions & 0 deletions KomaMRIFiles/src/Sequence/writerTestData/tabletop_tse_pulseq1.seq

Large diffs are not rendered by default.

471 changes: 471 additions & 0 deletions KomaMRIFiles/src/Sequence/writerTestData/test.jl

Large diffs are not rendered by default.