-
Notifications
You must be signed in to change notification settings - Fork 21
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
beorostica
wants to merge
128
commits into
master
Choose a base branch
from
pulseq
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Write Pulseq #284
Changes from 106 commits
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 7626005
Add test code for writing a pulseq file from a Sequence struct
beorostica 071ce8d
Merge branch 'master' into pulseq
beorostica 20914f9
Organize code and tests for writing Pulseq functionality
beorostica 5239213
Remove Pulseq written test files
beorostica d9aef17
Merge branch 'master' into pulseq
beorostica 3b9d4d1
Merge branch 'master' into pulseq
beorostica cae64de
Load pulseq sequences faster and allow comparison
gabuzi efadc1a
Add a test for fast read sequence
beorostica b086efd
Restore previous tests in KomaMRIFiles
beorostica db4e10a
Merge read .seq optimization branch into pulseq
beorostica 4be6f65
Merge branch 'master' into pulseq
beorostica e1ab97a
Test the optimized read function for reading more .seq examples
beorostica 4dc29d9
Fix RF angles when writing .seq files
beorostica e5728b5
Remove some comments when testing the write pulseq functionality
beorostica fd8822f
Remove the optimized read pulseq fuctionality from the write pulseq …
beorostica cb07ea1
Fix the precision of RF comparisons and RF delay
beorostica 004dca2
Merge branch 'master' into pulseq
beorostica 0d4d5e0
Fix RF angle when writing .seq files
beorostica 7d05c70
Update KomaMRIBase/src/datatypes/Sequence.jl
beorostica 372b751
Update KomaMRIBase/src/datatypes/Sequence.jl
beorostica 8749d36
Update KomaMRIBase/src/datatypes/Sequence.jl
beorostica 70f584e
Update KomaMRIBase/src/datatypes/sequence/ADC.jl
beorostica 807c0c4
Update KomaMRIBase/src/datatypes/sequence/RF.jl
beorostica 0f1a395
Update KomaMRIFiles/src/Sequence/WritePulseq.jl
beorostica da90d4c
Update KomaMRIFiles/src/Sequence/WritePulseq.jl
beorostica a91698b
Update KomaMRIFiles/src/Sequence/WritePulseq.jl
beorostica e39fcf2
Update KomaMRIFiles/src/Sequence/WritePulseq.jl
beorostica 2afd1fb
Update KomaMRIFiles/src/Sequence/WritePulseq.jl
beorostica 4449abe
Update KomaMRIFiles/src/Sequence/WritePulseq.jl
beorostica 93f7d86
Update KomaMRIFiles/test/runtests.jl
beorostica e811d18
Update KomaMRIBase/src/datatypes/Sequence.jl
beorostica 98f87db
Update KomaMRIFiles/src/Sequence/WritePulseq.jl
beorostica ee4305c
Update KomaMRIFiles/src/Sequence/WritePulseq.jl
beorostica 9e1b9b1
Update KomaMRIFiles/src/Sequence/WritePulseq.jl
beorostica 972e623
Update KomaMRIFiles/test/runtests.jl
beorostica 62993c1
Update KomaMRIFiles/src/Sequence/WritePulseq.jl
beorostica bc4b83c
Update KomaMRIFiles/src/Sequence/WritePulseq.jl
beorostica 6cbf779
Update KomaMRIFiles/test/runtests.jl
beorostica 5eee63a
Update KomaMRIFiles/test/runtests.jl
beorostica 2a31539
Update KomaMRIFiles/test/runtests.jl
beorostica 082668b
Update KomaMRIFiles/src/Sequence/WritePulseq.jl
beorostica 874677e
Update KomaMRIFiles/src/Sequence/WritePulseq.jl
beorostica 5a06916
Update KomaMRIFiles/src/Sequence/WritePulseq.jl
beorostica eff7f20
Update KomaMRIFiles/src/Sequence/WritePulseq.jl
beorostica 4600a27
Update KomaMRIFiles/src/Sequence/WritePulseq.jl
beorostica 64e9800
Update KomaMRIFiles/src/Sequence/WritePulseq.jl
beorostica 30d1c72
Update KomaMRIFiles/src/Sequence/WritePulseq.jl
beorostica bfea890
Update KomaMRIFiles/src/Sequence/WritePulseq.jl
beorostica 579031e
Update KomaMRIFiles/src/Sequence/WritePulseq.jl
beorostica 6c3bd4c
Update KomaMRIFiles/src/Sequence/WritePulseq.jl
beorostica 24e6c90
Update KomaMRIFiles/src/Sequence/WritePulseq.jl
beorostica dd723da
Update KomaMRIFiles/src/Sequence/WritePulseq.jl
beorostica 0f186bd
Update KomaMRIFiles/src/Sequence/WritePulseq.jl
beorostica ac99a92
Update KomaMRIFiles/src/Sequence/WritePulseq.jl
beorostica 37c0af3
Update KomaMRIFiles/src/Sequence/WritePulseq.jl
beorostica 595df76
Add reviewdog suggestions
beorostica 23c1dc6
Update KomaMRIFiles/src/Sequence/WritePulseq.jl
beorostica a54fe2f
Update KomaMRIFiles/src/Sequence/WritePulseq.jl
beorostica 54c92eb
Update KomaMRIFiles/src/Sequence/WritePulseq.jl
beorostica b3c1658
Update KomaMRIFiles/src/Sequence/WritePulseq.jl
beorostica 5cae2ed
Update KomaMRIFiles/src/Sequence/WritePulseq.jl
beorostica 2b0a634
Update KomaMRIFiles/src/Sequence/WritePulseq.jl
beorostica 6daf695
Update KomaMRIFiles/src/Sequence/WritePulseq.jl
beorostica 48e4aaf
Update KomaMRIFiles/src/Sequence/WritePulseq.jl
beorostica 3b3d5c7
Update KomaMRIFiles/src/Sequence/WritePulseq.jl
beorostica 7d25a25
Delete `in` word in write pulseq file
beorostica a5466e5
Delete blank spaces from write pulseq file
beorostica 04519f0
Apply format style to write pulseq file
beorostica d729110
Add some reviewdog suggestions
beorostica c16fd19
Add some reviewdog suggestions
beorostica 32f3295
Add some reviewdog suggestions
beorostica 58a7789
Create common pulseq examples folder for KomaMRIFiles tests
beorostica 2456434
Add write sequence to API documentation
beorostica bbed561
Fix when writting zero amplitude gradients
beorostica 8147b7b
Remove magsign function when writing pulseq
beorostica f00f10d
Add reviewdog style suggestion
beorostica 4c7729a
Remove duplicated compress function
beorostica b5dcbed
Add some spaces to comments
beorostica 177d05d
Replace some reshapes to [x;;] notation
beorostica 99f9328
Add reviewdog style for __VERSION__
beorostica 2f193cd
Update KomaMRIPlots/src/KomaMRIPlots.jl
beorostica 80f055c
Compare angles with exponential expression
beorostica e9c20d6
Add functions for safe comparison when writing pulseq
beorostica 43dcc62
Refactor safe comparison functions when writing pulseq
beorostica 08cd263
Consider all definitions when writing pulseq
beorostica bbb0858
Update runtests for KomaMRIFiles
beorostica 0b668ec
Define event on when writing pulseq
beorostica 2dd30b0
Refactor get unique events when writing pulseq
beorostica bcf5515
Refactor and rewrite some RF related variables and functions when wri…
beorostica d26108b
Update KomaMRIFiles/src/Sequence/WritePulseq.jl
beorostica c6a2140
Update KomaMRIFiles/src/Sequence/WritePulseq.jl
beorostica 511dc91
Rename some ADC related variables when writing pulseq
beorostica 72718e6
Rename some Grad related variables when writing pulseq
beorostica 793d2ea
Improve readability of @printf when writing pulseq
beorostica 517d7e2
Update KomaMRIFiles/src/Sequence/WritePulseq.jl
beorostica 5c2da8c
Update KomaMRIFiles/src/Sequence/WritePulseq.jl
beorostica b835beb
Update KomaMRIFiles/src/Sequence/WritePulseq.jl
beorostica 458609e
Update KomaMRIFiles/src/Sequence/WritePulseq.jl
beorostica d90bd4c
Update KomaMRIFiles/src/Sequence/WritePulseq.jl
beorostica 69841da
Update KomaMRIFiles/src/Sequence/WritePulseq.jl
beorostica 64ca46b
Update KomaMRIFiles/src/Sequence/WritePulseq.jl
beorostica bbd5715
Update KomaMRIFiles/src/Sequence/WritePulseq.jl
beorostica aba0007
Fix @printf bugs when writing pulseq
beorostica 600770b
Refactor runtests for KomaMRIFiles
beorostica 9832de0
Remove extensions section when writing pulseq
beorostica 7fd0f4b
Refactor runtests for KomaMRIFiles
beorostica 35baedd
Update KomaMRIFiles/test/runtests.jl
beorostica fdd77f8
Update KomaMRIFiles/test/runtests.jl
beorostica bc5d51f
Rename some Shapes related variables when writing pulseq
beorostica b7e6e3c
Add table helper functions when writing pulseq
beorostica cc359cc
Add pacth for considering gradients with zero amplitude when writing …
beorostica 7d6b94e
Refactor some new lines when writing pulseq
beorostica 3d33e3c
Compare angles with isapprox when writing pulseq
beorostica 88e6482
Create intermediate pulseq object when writing pulseq
beorostica f330473
Add reviewdog suggestions
beorostica 724b10f
Refactor with tuples when writing pulseq
beorostica 6d1a75b
Add get pulseq object function when writing pulseq
beorostica 12c1927
Merge master into pulseq writer branch
beorostica 5c8a96e
Fix bug when writing pulseq
beorostica ddd53f9
Optimize functions for writing pulseq
beorostica 3f7be9f
Set zero-Grad when reading pulseq gradients with zero amplitude
beorostica c73dd9a
Optimize function when writing pulseq
beorostica 80aa28b
Revert return conditional when reading pulseq gradients
beorostica 636d359
Add a return statement
beorostica 41588bf
Remove some aux functions when writing pulseq
beorostica 17fbe9b
Merge branch 'master' into pulseq
cncastillo 1d2df48
Merge branch 'master' into pulseq
cncastillo File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -121,22 +121,35 @@ | |
-(x::Sequence) = Sequence(-x.GR, x.RF, x.ADC, x.DUR, x.DEF) | ||
*(x::Sequence, α::Real) = Sequence(α .* x.GR, x.RF, x.ADC, x.DUR, x.DEF) | ||
*(α::Real, x::Sequence) = Sequence(α .* x.GR, x.RF, x.ADC, x.DUR, x.DEF) | ||
*(x::Sequence, α::ComplexF64) = Sequence(x.GR, α.*x.RF, x.ADC, x.DUR, x.DEF) | ||
*(α::ComplexF64, x::Sequence) = Sequence(x.GR, α.*x.RF, x.ADC, x.DUR, x.DEF) | ||
*(x::Sequence, A::Matrix{Float64}) = Sequence(A*x.GR, x.RF, x.ADC, x.DUR, x.DEF) #TODO: change this, Rotation fo waveforms is broken | ||
*(A::Matrix{Float64}, x::Sequence) = Sequence(A*x.GR, x.RF, x.ADC, x.DUR, x.DEF) #TODO: change this, Rotation fo waveforms is broken | ||
/(x::Sequence, α::Real) = Sequence(x.GR/α, x.RF, x.ADC, x.DUR, x.DEF) | ||
*(x::Sequence, α::ComplexF64) = Sequence(x.GR, α .* x.RF, x.ADC, x.DUR, x.DEF) | ||
*(α::ComplexF64, x::Sequence) = Sequence(x.GR, α .* x.RF, x.ADC, x.DUR, x.DEF) | ||
*(x::Sequence, A::Matrix{Float64}) = Sequence(A * x.GR, x.RF, x.ADC, x.DUR, x.DEF) #TODO: change this, Rotation fo waveforms is broken | ||
*(A::Matrix{Float64}, x::Sequence) = Sequence(A * x.GR, x.RF, x.ADC, x.DUR, x.DEF) #TODO: change this, Rotation fo waveforms is broken | ||
/(x::Sequence, α::Real) = Sequence(x.GR / α, x.RF, x.ADC, x.DUR, x.DEF) | ||
#Grad operations | ||
+(s::Sequence, g::Grad) = s + Sequence(reshape([g],1,1)) #Changed [a;;] for reshape(a,1,1) for Julia 1.6 | ||
+(g::Grad, s::Sequence) = Sequence(reshape([g],1,1)) + s #Changed [a;;] for reshape(a,1,1) for Julia 1.6 | ||
+(s::Sequence, g::Grad) = s + Sequence([g;;]) | ||
+(g::Grad, s::Sequence) = Sequence([g;;]) + s | ||
#RF operations | ||
+(s::Sequence, r::RF) = s + Sequence(reshape([Grad(0.0,0.0)],1,1),reshape([r],1,1)) #Changed [a;;] for reshape(a,1,1) for Julia 1.6 | ||
+(r::RF, s::Sequence) = Sequence(reshape([Grad(0.0,0.0)],1,1),reshape([r],1,1)) + s #Changed [a;;] for reshape(a,1,1) for Julia 1.6 | ||
+(s::Sequence, r::RF) = s + Sequence([Grad(0.0, 0.0);;], [r;;]) | ||
+(r::RF, s::Sequence) = Sequence([Grad(0.0, 0.0);;], [r;;]) + s | ||
#ADC operations | ||
+(s::Sequence, a::ADC) = s + Sequence(reshape([Grad(0.0,0.0)],1,1),reshape([RF(0.0,0.0)],1,1),[a]) #Changed [a;;] for reshape(a,1,1) for Julia 1.6 | ||
+(a::ADC, s::Sequence) = Sequence(reshape([Grad(0.0,0.0)],1,1),reshape([RF(0.0,0.0)],1,1),[a]) + s #Changed [a;;] for reshape(a,1,1) for Julia 1.6 | ||
+(s::Sequence, a::ADC) = s + Sequence([Grad(0.0, 0.0);;], [RF(0.0, 0.0);;], [a]) | ||
+(a::ADC, s::Sequence) = Sequence([Grad(0.0, 0.0);;], [RF(0.0, 0.0);;], [a]) + s | ||
#Sequence object functions | ||
size(x::Sequence) = size(x.GR[1,:]) | ||
size(x::Sequence) = size(x.GR[1, :]) | ||
|
||
""" | ||
For comparing two `Sequence`s custom types | ||
""" | ||
Base.isapprox(s1::Sequence, s2::Sequence) = begin | ||
beorostica marked this conversation as resolved.
Show resolved
Hide resolved
|
||
(length(s1) != length(s2)) && return false | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Is this syntax Julia blue? |
||
return all([ | ||
s1.ADC[i] ≈ s2.ADC[i] && | ||
s1.RF[i] ≈ s2.RF[i] && | ||
s1.GR[i] ≈ s2.GR[i] && | ||
s1.DUR[i] ≈ s2.DUR[i] for i in 1:length(s1) | ||
]) | ||
end | ||
|
||
""" | ||
y = is_ADC_on(x::Sequence) | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The syntax
Base.isapprox
instead ofimport Base: isapprox
is not consistent with the rest of the code. Julia Blue (#187) recommendsBase.isapprox
, we need to choose one or the other.