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
38c40462
Verified
Commit
38c40462
authored
1 year ago
by
Michiel Cottaar
Browse files
Options
Downloads
Patches
Plain Diff
Set start_time/effective_time for BuildingBlock
parent
7f790386
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/containers/building_blocks.jl
+24
-3
24 additions, 3 deletions
src/containers/building_blocks.jl
src/parts/trapezoids.jl
+2
-0
2 additions, 0 deletions
src/parts/trapezoids.jl
with
26 additions
and
3 deletions
src/containers/building_blocks.jl
+
24
−
3
View file @
38c40462
...
...
@@ -4,7 +4,7 @@ Defines [`BaseBuildingBlock`](@ref), [`BuildingBlock`](@ref) and [`Wait`](@ref).
module
BuildingBlocks
import
LinearAlgebra
:
norm
import
JuMP
:
@constraint
import
..
Abstract
:
ContainerBlock
import
..
Abstract
:
ContainerBlock
,
start_time
import
...
BuildSequences
:
global_model
import
...
Components
:
BaseComponent
,
GradientWaveform
,
EventComponent
,
NoGradient
,
ChangingGradient
,
ConstantGradient
,
split_gradient
,
DelayedEvent
,
RFPulseComponent
,
ReadoutComponent
import
...
Variables
:
qval
,
bmat_gradient
,
effective_time
,
get_free_variable
...
...
@@ -33,6 +33,7 @@ Base.length(c::BaseBuildingBlock) = length(keys(c))
Base
.
eltype
(
::
Type
{
<:
BaseBuildingBlock
})
=
BaseComponent
Base
.
iterate
(
c
::
BaseBuildingBlock
)
=
Base
.
iterate
(
c
,
1
)
Base
.
iterate
(
c
::
BaseBuildingBlock
,
index
::
Integer
)
=
length
(
c
)
<
index
?
nothing
:
(
c
[
keys
(
c
)[
index
]],
index
+
1
)
Base
.
getindex
(
bb
::
BaseBuildingBlock
,
s
::
Symbol
)
=
bb
[
Val
(
s
)]
"""
...
...
@@ -104,6 +105,26 @@ function waveform(bb::BaseBuildingBlock)
return
result
end
equal_key
(
i1
::
Val
,
i2
)
=
i1
==
Val
(
i2
)
equal_key
(
i1
,
i2
::
Val
)
=
Val
(
i1
)
==
i2
equal_key
(
i1
::
Val
,
i2
::
Val
)
=
i1
==
i2
equal_key
(
i1
,
i2
)
=
i1
==
i2
function
start_time
(
building_block
::
BaseBuildingBlock
,
index
)
time
=
0.
prev_time
=
0.
for
key
in
keys
(
building_block
)
if
equal_key
(
key
,
index
)
return
prev_time
end
component
=
building_block
[
key
]
if
component
isa
GradientWaveform
prev_time
=
time
time
+=
duration
(
component
)
end
end
error
(
"Building block with index '
$
index' not found"
)
end
# Pathway support
"""
...
...
@@ -126,12 +147,12 @@ function waveform_sequence(bb::BaseBuildingBlock, first, last)
current_grad_key
=
key
current_start
=
nothing
end
if
key
==
first
||
key
==
Val
(
first
)
if
equal_key
(
key
,
first
)
@assert
!
started
started
=
true
current_start
=
effective_time
(
bb
[
key
])
end
if
key
==
last
||
key
==
Val
(
last
)
if
equal_key
(
key
,
last
)
@assert
started
if
isnothing
(
current_start
)
push!
(
parts
,
(
current_grad_key
,
split_gradient
(
bb
[
current_grad_key
],
effective_time
(
bb
[
key
]))[
1
]))
...
...
This diff is collapsed.
Click to expand it.
src/parts/trapezoids.jl
+
2
−
0
View file @
38c40462
...
...
@@ -150,6 +150,7 @@ inverse_slice_thickness(ss::SliceSelect) = 1e3 * gradient_strength(ss.trapezoid)
get_pulse
(
ss
::
SliceSelect
)
=
ss
.
pulse
get_gradient
(
ss
::
SliceSelect
)
=
ss
.
trapezoid
effective_time
(
ss
::
SliceSelect
)
=
effective_time
(
lr
,
:
pulse
)
"""
LineReadout(adc; ramp_overlap=1., orientation=nothing, group=nothing, variables...)
...
...
@@ -193,6 +194,7 @@ Base.getindex(lr::LineReadout, ::Val{:adc}) = lr.adc
ramp_overlap
(
lr
::
LineReadout
)
=
lr
.
ramp_overlap
inverse_fov
(
lr
::
LineReadout
)
=
1e3
*
dwell_time
(
lr
.
adc
)
*
gradient_strength
(
lr
.
trapezoid
)
inverse_voxel_size
(
lr
::
LineReadout
)
=
1e3
*
duration
(
lr
.
adc
)
*
gradient_strength
(
lr
.
trapezoid
)
effective_time
(
lr
::
LineReadout
)
=
effective_time
(
lr
,
:
adc
)
get_readout
(
lr
::
LineReadout
)
=
lr
.
adc
get_gradient
(
lr
::
LineReadout
)
=
lr
.
trapezoid
...
...
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