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
2f9e4bb3
Verified
Commit
2f9e4bb3
authored
1 year ago
by
Michiel Cottaar
Browse files
Options
Downloads
Patches
Plain Diff
Make nsamples a non-integer variable
parent
20ed1a0a
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/readouts/ADCs.jl
+16
-8
16 additions, 8 deletions
src/readouts/ADCs.jl
with
16 additions
and
8 deletions
src/readouts/ADCs.jl
+
16
−
8
View file @
2f9e4bb3
module
ADCs
import
JuMP
:
@constraint
import
...
Variables
:
variables
,
dwell_time
,
duration
,
effective_time
,
get_free_variable
,
VariableType
import
...
BuildingBlocks
:
BuildingBlock
,
apply_simple_constraint!
,
set_simple_constraints!
import
...
Variables
:
variables
,
dwell_time
,
duration
,
effective_time
,
get_free_variable
,
VariableType
,
nsamples
import
...
BuildingBlocks
:
BuildingBlock
,
apply_simple_constraint!
,
set_simple_constraints!
,
fixed
import
...
BuildSequences
:
global_model
"""
...
...
@@ -10,23 +10,23 @@ import ...BuildSequences: global_model
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
- `nsamples`: number of samples in the readout. This can be a non-integer value during optimisation
- `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.
"""
struct
ADC
<:
BuildingBlock
nsamples
::
Integer
nsamples
::
VariableType
dwell_time
::
VariableType
time_to_center
::
VariableType
end
function
ADC
(
nsamples
;
dwell_time
=
nothing
,
time_to_center
=
nothing
,
center_halfway
=
true
,
kwargs
...
)
function
ADC
(
nsamples
=
nothing
,
dwell_time
=
nothing
,
time_to_center
=
nothing
,
center_halfway
=
true
,
kwargs
...
)
res
=
ADC
(
nsamples
,
get_free_variable
(
nsamples
)
,
get_free_variable
(
dwell_time
),
get_free_variable
(
time_to_center
),
)
...
...
@@ -41,11 +41,19 @@ function ADC(nsamples; dwell_time=nothing, time_to_center=nothing, center_halfwa
return
res
end
nsamples
(
adc
::
ADC
)
=
adc
.
nsamples
dwell_time
(
adc
::
ADC
)
=
adc
.
dwell_time
duration
(
adc
::
ADC
)
=
adc
.
nsamples
*
dwell_time
(
adc
)
duration
(
adc
::
ADC
)
=
nsamples
(
adc
)
*
dwell_time
(
adc
)
time_to_center
(
adc
::
ADC
)
=
adc
.
time_to_center
effective_time
(
adc
::
ADC
)
=
time_to_center
(
adc
)
variables
(
::
Type
{
<:
ADC
})
=
[
dwell_time
,
duration
,
time_to_center
]
variables
(
::
Type
{
<:
ADC
})
=
[
nsamples
,
dwell_time
,
duration
,
time_to_center
]
function
fixed
(
adc
::
ADC
)
# round nsamples during fixing
nsamples
=
Int
(
round
(
adc
.
nsamples
))
dwell_time
=
duration
(
adc
)
/
nsamples
return
ADC
(
nsamples
,
dwell_time
,
time_to_center
(
adc
))
end
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