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
f1ddc162
Verified
Commit
f1ddc162
authored
1 year ago
by
Michiel Cottaar
Browse files
Options
Downloads
Patches
Plain Diff
Add center_halfway flag
parent
d9eafa60
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/readouts/ADCs.jl
+10
-9
10 additions, 9 deletions
src/readouts/ADCs.jl
with
10 additions
and
9 deletions
src/readouts/ADCs.jl
+
10
−
9
View file @
f1ddc162
...
...
@@ -11,11 +11,12 @@ Adds a readout event with `nsamples` readouts.
## Parameters
- `nsamples`: number of samples in the readout.
- `center_halfway`: by default the `time_to_center` is assumed to be half of the `duration`. Set this to false to disable this assumption.
## Variables
- `dwell_time`: Time between each readout sample in ms.
- `duration`: Total duration of the ADC event in ms.
- `time_to_center`: time till the center of k-space
(assumed to be `duration/2` if not set explicitly)
.
- `time_to_center`: time till the center of k-space.
"""
struct
ADC
<:
BuildingBlock
nsamples
::
Integer
...
...
@@ -23,18 +24,18 @@ struct ADC <: BuildingBlock
time_to_center
::
Union
{
Nothing
,
VariableType
}
end
function
ADC
(
nsamples
;
dwell_time
=
nothing
,
time_to_center
=
nothing
,
kwargs
...
)
function
ADC
(
nsamples
;
dwell_time
=
nothing
,
time_to_center
=
nothing
,
center_halfway
=
true
,
kwargs
...
)
res
=
ADC
(
nsamples
,
get_free_variable
(
dwell_time
),
time_to_center
isa
VariableType
?
time_to_center
:
nothing
get_free_variable
(
time_to_center
),
)
@constraint
global_model
()
res
.
dwell_time
>=
0
if
time_to_center
isa
VariableType
@constraint
global_model
()
time_to_center
>=
0
@constraint
global_model
()
time_to_center
<=
duration
(
res
)
if
center_halfway
@constraint
global_model
()
2
*
res
.
time_to_center
==
duration
(
res
)
else
apply_simple_constraint!
(
effective_time
(
res
),
time_to_center
)
@constraint
global_model
()
res
.
time_to_center
>=
0
@constraint
global_model
()
res
.
time_to_center
<=
duration
(
res
)
end
set_simple_constraints!
(
res
,
kwargs
)
return
res
...
...
@@ -42,9 +43,9 @@ end
dwell_time
(
adc
::
ADC
)
=
adc
.
dwell_time
duration
(
adc
::
ADC
)
=
adc
.
nsamples
*
dwell_time
(
adc
)
time_to_center
(
adc
::
ADC
)
=
isnothing
(
adc
.
time_to_center
)
?
duration
(
adc
)
/
2
:
adc
.
time_to_center
time_to_center
(
adc
::
ADC
)
=
adc
.
time_to_center
effective_time
(
adc
::
ADC
)
=
time_to_center
(
adc
)
variables
(
::
Type
{
<:
ADC
})
=
[
dwell_time
,
duration
,
effec
ti
v
e_t
ime
]
variables
(
::
Type
{
<:
ADC
})
=
[
dwell_time
,
duration
,
ti
m
e_t
o_center
]
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