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
b0d93fc8
Verified
Commit
b0d93fc8
authored
1 year ago
by
Michiel Cottaar
Browse files
Options
Downloads
Patches
Plain Diff
Set single InstantGradient constructor
parent
49885ce8
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/components/components.jl
+1
-1
1 addition, 1 deletion
src/components/components.jl
src/components/instant_gradients.jl
+15
-37
15 additions, 37 deletions
src/components/instant_gradients.jl
with
16 additions
and
38 deletions
src/components/components.jl
+
1
−
1
View file @
b0d93fc8
...
@@ -8,7 +8,7 @@ include("delayed_events.jl")
...
@@ -8,7 +8,7 @@ include("delayed_events.jl")
import
.
AbstractTypes
:
BaseComponent
,
GradientWaveform
,
EventComponent
,
RFPulseComponent
,
ReadoutComponent
import
.
AbstractTypes
:
BaseComponent
,
GradientWaveform
,
EventComponent
,
RFPulseComponent
,
ReadoutComponent
import
.
GradientWaveforms
:
ConstantGradient
,
ChangingGradient
,
NoGradient
,
split_gradient
import
.
GradientWaveforms
:
ConstantGradient
,
ChangingGradient
,
NoGradient
,
split_gradient
import
.
InstantGradients
:
InstantGradient
1D
,
InstantGradient3D
import
.
InstantGradients
:
InstantGradient
import
.
Pulses
:
GenericPulse
,
InstantPulse
,
SincPulse
,
ConstantPulse
import
.
Pulses
:
GenericPulse
,
InstantPulse
,
SincPulse
,
ConstantPulse
import
.
Readouts
:
ADC
,
SingleReadout
import
.
Readouts
:
ADC
,
SingleReadout
import
.
DelayedEvents
:
DelayedEvent
import
.
DelayedEvents
:
DelayedEvent
...
...
This diff is collapsed.
Click to expand it.
src/components/instant_gradients.jl
+
15
−
37
View file @
b0d93fc8
module
InstantGradients
module
InstantGradients
import
StaticArrays
:
SVector
,
SMatrix
import
StaticArrays
:
SVector
,
SMatrix
import
...
Variables
:
VariableType
,
duration
,
qval
,
bmat_gradient
,
get_free_variable
,
set_simple_constraints!
,
qval
,
effective_time
,
make_generic
import
...
Variables
:
VariableType
,
duration
,
qval
,
bmat_gradient
,
get_free_variable
,
set_simple_constraints!
,
effective_time
,
make_generic
import
..
AbstractTypes
:
EventComponent
,
GradientWaveform
import
..
AbstractTypes
:
EventComponent
,
GradientWaveform
"""
"""
InstantGradient1D(; orientation=
[1, 0, 0]
, group=nothing, variables...)
InstantGradient1D(; orientation=
nothing
, group=nothing, variables...)
Defines an instantaneous gradient with given fixed `orientation` (default: x-direction).
If the `orientation` is set an [`InstantGradient1D`](@ref) is returned, otherwise an [`InstantGradient3D`](@ref).
To have a variable `orientation`, see [`InstantGradient3D`](@ref).
## Parameters
## Parameters
- `orientation` sets the gradient orienation as a length-3 vector. If not set, the gradient can be in any direction.
- `orientation` sets the gradient orienation as a length-3 vector. If not set, the gradient can be in any direction.
...
@@ -20,20 +18,18 @@ To have a variable `orientation`, see [`InstantGradient3D`](@ref).
...
@@ -20,20 +18,18 @@ To have a variable `orientation`, see [`InstantGradient3D`](@ref).
"""
"""
abstract type
InstantGradient
<:
EventComponent
end
abstract type
InstantGradient
<:
EventComponent
end
"""
function
(::
Type
{
InstantGradient
})(;
orientation
=
nothing
,
group
=
nothing
,
qval
=
nothing
,
variables
...
)
InstantGradient1D(; orientation=[1, 0, 0], group=nothing, variables...)
if
isnothing
(
orientaiton
)
res
=
InstantGradient3D
(
get_free_variable
.
(
qval
),
group
)
Defines an instantaneous gradient with given fixed `orientation` (default: x-direction).
else
res
=
InstantGradient1D
(
get_free_variable
(
qval
),
orientation
,
group
)
To have a variable `orientation`, see [`InstantGradient3D`](@ref).
end
set_simple_constraints!
(
res
,
variables
)
## Parameters
return
res
- `orientation` sets the gradient orienation as a length-3 vector (default: x-direction).
end
- `group`: name of the group to which this gradient belongs (used for scaling and rotating).
## Variables
"""
- [`qval`](@ref): Spatial frequency on which spins will be dephased due to this pulsed gradient in rad/um.
An [`InstantGradient`](@ref) with a fixed orientation.
- [`spoiler_scale`](@ref): Length-scale on which spins will be dephased by exactly 2π in mm.
"""
"""
struct
InstantGradient1D
<:
InstantGradient
struct
InstantGradient1D
<:
InstantGradient
qval
::
VariableType
qval
::
VariableType
...
@@ -41,28 +37,10 @@ struct InstantGradient1D <: InstantGradient
...
@@ -41,28 +37,10 @@ struct InstantGradient1D <: InstantGradient
group
::
Union
{
Nothing
,
Symbol
}
group
::
Union
{
Nothing
,
Symbol
}
end
end
function
InstantGradient1D
(;
orientation
=
[
1
,
0
,
0
],
group
=
nothing
,
qval
=
nothing
,
variables
...
)
res
=
InstantGradient1D
(
qval
,
orientation
,
group
)
set_simple_constraints!
(
res
,
variables
)
return
res
end
qval
(
ig
::
InstantGradient1D
)
=
ig
.
qval
qval
(
ig
::
InstantGradient1D
)
=
ig
.
qval
"""
"""
InstantGradient3D(; group=nothing, variables...)
An [`InstantGradient`](@ref) with a variable orientation.
Defines an instantaneous gradient without a fixed orientation.
To have a fixed `orientation`, see [`InstantGradient1D`](@ref).
## Parameters
- `group`: name of the group to which this gradient belongs (used for scaling and rotating).
## Variables
- [`qval`](@ref): Vector of spatial frequency on which spins will be dephased due to this pulsed gradient in rad/um.
- [`spoiler_scale`](@ref): Vector with length-scale on which spins will be dephased by exactly 2π in mm.
"""
"""
struct
InstantGradient3D
<:
InstantGradient
struct
InstantGradient3D
<:
InstantGradient
qvec
::
SVector
{
3
,
VariableType
}
qvec
::
SVector
{
3
,
VariableType
}
...
...
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