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
ace8f940
Verified
Commit
ace8f940
authored
1 year ago
by
Michiel Cottaar
Browse files
Options
Downloads
Patches
Plain Diff
Add helper to intepret fov/resolution/voxel_size parameters
parent
2ff6cd3d
No related branches found
No related tags found
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
src/MRIBuilder.jl
+2
-2
2 additions, 2 deletions
src/MRIBuilder.jl
src/parts/helper_functions.jl
+45
-0
45 additions, 0 deletions
src/parts/helper_functions.jl
src/parts/parts.jl
+1
-1
1 addition, 1 deletion
src/parts/parts.jl
with
48 additions
and
3 deletions
src/MRIBuilder.jl
+
2
−
2
View file @
ace8f940
...
...
@@ -30,8 +30,8 @@ export ContainerBlock, start_time, end_time, waveform, waveform_sequence, events
import
.
Pathways
:
Pathway
,
duration_transverse
,
duration_dephase
,
bval
,
bmat
,
get_pathway
export
Pathway
,
duration_transverse
,
duration_dephase
,
bval
,
bmat
,
get_pathway
import
.
Parts
:
dwi_gradients
,
readout_event
,
excitation_pulse
,
refocus_pulse
,
Trapezoid
,
SliceSelect
,
LineReadout
,
opposite_kspace_lines
,
SpoiltSliceSelect
,
SliceSelectRephase
,
EPIReadout
export
dwi_gradients
,
readout_event
,
excitation_pulse
,
refocus_pulse
,
Trapezoid
,
SliceSelect
,
LineReadout
,
opposite_kspace_lines
,
SpoiltSliceSelect
,
SliceSelectRephase
,
EPIReadout
import
.
Parts
:
dwi_gradients
,
readout_event
,
excitation_pulse
,
refocus_pulse
,
Trapezoid
,
SliceSelect
,
LineReadout
,
opposite_kspace_lines
,
SpoiltSliceSelect
,
SliceSelectRephase
,
EPIReadout
,
interpret_image_size
export
dwi_gradients
,
readout_event
,
excitation_pulse
,
refocus_pulse
,
Trapezoid
,
SliceSelect
,
LineReadout
,
opposite_kspace_lines
,
SpoiltSliceSelect
,
SliceSelectRephase
,
EPIReadout
,
interpret_image_size
import
JuMP
:
@constraint
,
@objective
,
objective_function
,
value
,
Model
export
@constraint
,
@objective
,
objective_function
,
value
,
Model
...
...
This diff is collapsed.
Click to expand it.
src/parts/helper_functions.jl
+
45
−
0
View file @
ace8f940
...
...
@@ -217,4 +217,49 @@ function dwi_gradients(; type=:trapezoid, optimise=false, scanner=nothing, refoc
end
"""
interpret_image_size(fov, resolution, voxel_size, slice_thickness)
Combines the user-provided information of the image size to produce a tuple with:
- `slice_thickness`: if not set explicitly, will be set to the third element of `voxel_size`
- `resolution_z`: number of voxels in the slice-select direction.
- keywords parameters for the [`readout_event`](@ref) functions with the `fov`, `resolution`, and `voxel_size` in the x- and y- dimensions.
"""
function
interpret_image_size
(
fov
,
resolution
,
voxel_size
,
slice_thickness
)
_real_value
(
n
::
Number
)
=
true
_real_value
(
n
::
NTuple
{
N
,
<:
Number
})
where
{
N
}
=
true
_real_value
(
n
::
AbstractVector
{
<:
Number
})
=
true
_real_value
(
other
)
=
false
if
all
(
isnothing
.
((
fov
,
resolution
,
voxel_size
)))
return
(
slice_thickness
,
nothing
,
(
fov
=
nothing
,
resolution
=
nothing
,
voxel_size
=
nothing
))
end
if
!
_real_value
(
resolution
)
if
!
(
_real_value
(
fov
)
&&
_real_value
(
voxel_size
))
error
(
"`resolution` needs to be fully defined; either by setting it directly or by setting `fov` and `voxel_size` to concrete values."
)
end
resolution
=
Int
.
(
div
.
(
fov
,
voxel_size
,
RoundUp
))
fov
=
resolution
.*
voxel_size
end
getz
(
v
::
Union
{
Tuple
,
AbstractVector
})
=
length
(
v
)
==
2
?
nothing
:
v
[
3
]
getz
(
v
)
=
v
if
isnothing
(
slice_thickness
)
slice_thickness
=
getz
(
voxel_size
)
if
isnothing
(
slice_thickness
)
fovz
=
getz
(
fov
)
if
isnothing
(
fovz
)
slice_thickness
=
Inf
else
slice_thickness
=
fovz
/
getz
(
resolution
)
end
end
end
getxy
(
v
::
Union
{
Tuple
,
AbstractVector
})
=
[
v
[
1
],
v
[
2
]]
getxy
(
v
)
=
[
v
,
v
]
return
(
slice_thickness
,
getz
(
resolution
),
(
fov
=
getxy
(
fov
),
resolution
=
getxy
(
resolution
),
voxel_size
=
getxy
(
voxel_size
)))
end
end
\ No newline at end of file
This diff is collapsed.
Click to expand it.
src/parts/parts.jl
+
1
−
1
View file @
ace8f940
...
...
@@ -9,7 +9,7 @@ import .Trapezoids: Trapezoid, SliceSelect, LineReadout, opposite_kspace_lines
import
.
SpoiltSliceSelects
:
SpoiltSliceSelect
import
.
SliceSelectRephases
:
SliceSelectRephase
import
.
EPIReadouts
:
EPIReadout
import
.
HelperFunctions
:
excitation_pulse
,
refocus_pulse
,
readout_event
,
dwi_gradients
import
.
HelperFunctions
:
excitation_pulse
,
refocus_pulse
,
readout_event
,
dwi_gradients
,
interpret_image_size
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