Skip to content
Snippets Groups Projects
Unverified Commit 9ff2b61a authored by Michiel Cottaar's avatar Michiel Cottaar
Browse files

Add slice selection to SpoiltSliceSelect

parent 3ea78d24
No related branches found
No related tags found
1 merge request!5Resolve "Allow slice selection"
Pipeline #25011 failed
...@@ -4,7 +4,7 @@ import LinearAlgebra: norm ...@@ -4,7 +4,7 @@ import LinearAlgebra: norm
import StaticArrays: SVector import StaticArrays: SVector
import JuMP: @constraint, @objective, objective_function import JuMP: @constraint, @objective, objective_function
import ...BuildSequences: global_scanner import ...BuildSequences: global_scanner
import ...Variables: VariableType, get_pulse, set_simple_constraints!, variables, @defvar, gradient_orientation, adjust_groups, adjust_internal, get_free_variable, apply_simple_constraint! import ...Variables: VariableType, get_pulse, set_simple_constraints!, variables, @defvar, gradient_orientation, adjust, adjust_groups, adjust_internal, get_free_variable, apply_simple_constraint!
import ...Components: ChangingGradient, ConstantGradient, RFPulseComponent import ...Components: ChangingGradient, ConstantGradient, RFPulseComponent
import ...Containers: BaseBuildingBlock import ...Containers: BaseBuildingBlock
...@@ -139,17 +139,17 @@ Returns the time of the [`SpoiltSliceSelect`](@ref) to return to zero. ...@@ -139,17 +139,17 @@ Returns the time of the [`SpoiltSliceSelect`](@ref) to return to zero.
""" """
variables.fall_time variables.fall_time
adjust_groups(::SpoiltSliceSelect) = [ss.group, :slice] adjust_groups(ss::SpoiltSliceSelect) = [ss.group, :slice]
function adjust_internal(ss::SpoiltSliceSelect; shift=0.) function adjust_internal(ss::SpoiltSliceSelect; shift=0.)
return SliceSelect( return SpoiltSliceSelect(
ss.orientation, ss.orientation,
ss.rise_time1, ss.rise_time1,
ss.flat_time1, ss.flat_time1,
ss.diff_time, ss.diff_time,
adjust( adjust(
ss.pulse; ss.pulse;
frequency=variables.all_gradient_strengths(ss)[2] * shift * 1e3 pulse=(frequency=variables.all_gradient_strengths(ss)[2] * shift * 1e3, )
), ),
ss.flat_time2, ss.flat_time2,
ss.fall_time2, ss.fall_time2,
......
...@@ -53,5 +53,15 @@ ...@@ -53,5 +53,15 @@
@test all(variables.qvec(new_dwi[:gradient]) . [qval_orig/√2, qval_orig/√2, 0.]) @test all(variables.qvec(new_dwi[:gradient]) . [qval_orig/√2, qval_orig/√2, 0.])
end end
end end
@testset "Slice selection" begin
dwi = DWI(bval=1., slice_thickness=2., refocus=(spoiler=0.5, ))
@test variables.frequency(dwi) == (excitation=0., refocus=0.)
new_dwi = adjust(dwi, slice=(shift=2., ))
@test variables.frequency(new_dwi).excitation variables.bandwidth(dwi).excitation
@test variables.frequency(new_dwi).refocus variables.bandwidth(dwi).refocus
another_dwi = adjust(new_dwi, slice=(shift=-3., ))
@test variables.frequency(another_dwi).excitation -variables.bandwidth(dwi).excitation * 0.5
@test variables.frequency(another_dwi).refocus -variables.bandwidth(dwi).refocus * 0.5
end
end end
end end
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment