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
98814ce2
Verified
Commit
98814ce2
authored
1 year ago
by
Michiel Cottaar
Browse files
Options
Downloads
Patches
Plain Diff
Support for building-block containing just single EventComponent
parent
045c71c9
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/all_building_blocks/building_blocks.jl
+25
-3
25 additions, 3 deletions
src/all_building_blocks/building_blocks.jl
src/all_sequences/sequences.jl
+4
-2
4 additions, 2 deletions
src/all_sequences/sequences.jl
with
29 additions
and
5 deletions
src/all_building_blocks/building_blocks.jl
+
25
−
3
View file @
98814ce2
module
BuildingBlocks
import
LinearAlgebra
:
norm
import
..
BaseBuildingBlocks
:
BaseBuildingBlock
,
events
,
waveform_sequence
import
...
Variables
:
VariableType
,
duration
,
make_generic
import
...
Components
:
BaseComponent
,
DelayedEvent
import
...
Variables
:
VariableType
,
duration
,
make_generic
,
get_pulse
,
get_readout
import
...
Components
:
BaseComponent
,
DelayedEvent
,
RFPulseComponent
,
ReadoutComponent
import
...
Readouts
:
InstantReadout
,
ADC
import
...
Pulses
:
RFPulseBlock
import
...
Gradients
:
GradientBlock
...
...
@@ -70,6 +70,28 @@ make_generic(other_block::BaseBuildingBlock) = BuildingBlock(duration(other_bloc
Base
.
keys
(
bb
::
BuildingBlock
)
=
1
:
length
(
bb
.
parts
)
Base
.
getindex
(
bb
::
BuildingBlock
,
i
::
Integer
)
=
bb
.
parts
[
i
]
duration
(
go
::
BuildingBlock
)
=
go
.
duration
duration
(
bb
::
BuildingBlock
)
=
sum
(
duration
,
waveform_sequence
(
bb
);
init
=
0.
)
function
get_pulse
(
bb
::
BuildingBlock
)
pulses
=
[
p
for
p
in
events
(
bb
)
if
p
isa
RFPulseComponent
]
if
length
(
pulses
)
==
0
error
(
"BuildingBlock does not contain any pulses."
)
end
if
length
(
pulses
)
==
1
return
pulses
[
1
]
else
error
(
"BuildingBlock contains more than one pulse. Not sure which one to return."
)
end
function
get_readout
(
bb
::
BuildingBlock
)
readouts
=
[
r
for
r
in
events
(
bb
)
if
r
isa
ReadoutComponent
]
if
length
(
readouts
)
==
0
error
(
"BuildingBlock does not contain any readouts."
)
end
if
length
(
readouts
)
==
1
return
readouts
[
1
]
else
error
(
"BuildingBlock contains more than one readout. Not sure which one to return."
)
end
end
\ No newline at end of file
This diff is collapsed.
Click to expand it.
src/all_sequences/sequences.jl
+
4
−
2
View file @
98814ce2
...
...
@@ -2,8 +2,9 @@ module Sequences
import
StaticArrays
:
SVector
import
JuMP
:
@constraint
import
...
Variables
:
get_free_variable
,
TR
,
VariableType
import
...
BuildingBlocks
:
WaitBlock
import
...
BuildingBlocks
:
WaitBlock
,
BuildingBlock
import
...
BuildSequences
:
get_global_model
import
...
Components
:
EventComponent
import
..
BaseSequences
:
ContainerBlock
,
BaseSequence
,
nrepeat
"""
...
...
@@ -42,11 +43,12 @@ Base.getindex(s::Sequence, i::Integer) = s.blocks[i]
Converst object into something that can be included in the sequence:
- :min/:max/number/variable/nothing => [`WaitBlock`](@ref).
- `building_block` or `sequence` => no change.
- RF pulse/readout => will be embedded within a [`BuildingBlock`](@ref).
"""
to_block
(
cb
::
ContainerBlock
)
=
cb
to_block
(
s
::
Symbol
)
=
to_block
(
Val
(
s
))
to_block
(
s
::
Union
{
VariableType
,
Nothing
,
Val
{
:
min
},
Val
{
:
max
}})
=
WaitBlock
(
s
)
to_block
(
ec
::
EventComponent
)
=
BuildingBlock
([],
[(
0
,
ec
)];
duration
=
duration
(
ec
))
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