Skip to content

Commit d84cb1e

Browse files
committed
coil_sens removal from Phantom structure
1 parent 6cfdfad commit d84cb1e

File tree

4 files changed

+7
-27
lines changed

4 files changed

+7
-27
lines changed

KomaMRIBase/src/datatypes/Phantom.jl

+3-4
Original file line numberDiff line numberDiff line change
@@ -76,17 +76,16 @@ end
7676
"""Separate object spins in a sub-group"""
7777
function Base.getindex(obj::Phantom, p)
7878
fields = []
79-
for field in Iterators.filter(x -> !(x == :name) && !(x == :coil_sens), fieldnames(Phantom))
79+
for field in NON_STRING_PHANTOM_FIELDS
8080
push!(fields, (field, getfield(obj, field)[p]))
8181
end
82-
push!(fields, (:coil_sens, getfield(obj, :coil_sens)[p, :]))
82+
return Phantom(; name=obj.name, fields...)
8383
end
8484
function Base.view(obj::Phantom, p)
8585
fields = []
86-
for field in Iterators.filter(x -> !(x == :name) && !(x == :coil_sens), fieldnames(Phantom))
86+
for field in NON_STRING_PHANTOM_FIELDS
8787
push!(fields, (field, @view(getfield(obj, field)[p])))
8888
end
89-
push!(fields, (:coil_sens, @view(getfield(obj, :coil_sens)[p, :])))
9089
return Phantom(; name=obj.name, fields...)
9190
end
9291

KomaMRICore/src/simulation/SimMethods/BlochSimple/BlochSimple.jl

-20
Original file line numberDiff line numberDiff line change
@@ -6,26 +6,6 @@ struct BlochSimple <: SimulationMethod end
66

77
export BlochSimple
88

9-
10-
function sim_output_dim(
11-
obj::Phantom{T}, seq::Sequence, sys::Scanner, sim_method::SimulationMethod
12-
) where {T<:Real}
13-
# Determine the number of coils
14-
n_coils = size(obj.coil_sens, 2)
15-
return (sum(seq.ADC.N), n_coils) # Nt x Ncoils
16-
end
17-
18-
"""Magnetization initialization for Bloch simulation method."""
19-
function initialize_spins_state(
20-
obj::Phantom{T}, sim_method::SimulationMethod
21-
) where {T<:Real}
22-
Nspins = length(obj)
23-
Mxy = zeros(T, Nspins)
24-
Mz = obj.ρ
25-
Xt = Mag{T}(Mxy, Mz)
26-
return Xt, obj
27-
end
28-
299
"""
3010
run_spin_precession(obj, seq, Xt, sig)
3111

KomaMRICore/src/simulation/SimMethods/SimulationMethod.jl

+1-1
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ function sim_output_dim(
1111
obj::Phantom{T}, seq::Sequence, sys::Scanner, sim_method::SimulationMethod
1212
) where {T<:Real}
1313
# Determine the number of coils
14-
n_coils = size(obj.coil_sens, 2)
14+
n_coils = size(sys.rf_coils.coil_sens, 2)
1515
return (sum(seq.ADC.N), n_coils) # Nt x Ncoils
1616
end
1717

examples/3.tutorials/lit-08-CoilsCircle.jl

+3-2
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,8 @@ end
2323
coil_sens = hcat(coil_sensitivities...)
2424

2525
# Assign to object
26-
sys.rf_coils = ArbitraryRFCoils(obj.x, obj.y, obj.z, complex.(coil_sens), complex.(ones(size(coil_sens))))
26+
sys.rf_coils = RFCoilsSensDefinedAtPhantomPositions(complex.(coil_sens))
27+
#sys.rf_coils = ArbitraryRFCoils(obj.x, obj.y, obj.z, complex.(coil_sens), complex.(ones(size(coil_sens))))
2728

2829
seq_file = joinpath(
2930
dirname(pathof(KomaMRI)),
@@ -33,7 +34,7 @@ seq = read_seq(seq_file)
3334
# And simulate:
3435

3536
sim_params = KomaMRICore.default_sim_params()
36-
sim_params["sim_method"] = BlochSimple()
37+
sim_params["sim_method"] = Bloch()
3738
raw = simulate(obj, seq, sys; sim_params)
3839

3940
acq = AcquisitionData(raw) # hide

0 commit comments

Comments
 (0)