Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

KomaMRI v0.7.4: Bug fixes and minor features #163

Merged
merged 142 commits into from
Jul 12, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
142 commits
Select commit Hold shift + click to select a range
6062a30
Edit UI for more name consistency
beorostica Mar 9, 2023
c6964de
Export to .mat on every GUI window
beorostica Mar 22, 2023
737a3bb
Change GUI style and add sidebar button for exporting to .mat
beorostica Apr 4, 2023
88cb312
Remove export to .mat buttons on the plots
beorostica Apr 4, 2023
8b3e60a
Add update logic for object names
beorostica Apr 4, 2023
6c9ba2d
Add loading logic
beorostica Apr 4, 2023
47074a8
Select folder to save data (downgrade InteractBase)
beorostica Apr 20, 2023
86c4e47
Koma v0.7.4
cncastillo Apr 26, 2023
ba5d524
Use savefile to save .mat files
beorostica Apr 27, 2023
72add2f
Add view for scanner parameters
beorostica Apr 27, 2023
6d88c94
Change logo size
beorostica Apr 27, 2023
46389bb
Merge branch 'gui' into koma_v074
beorostica Apr 27, 2023
d589056
Fix head bug
beorostica Apr 27, 2023
df6d52c
Add tests for plotting M1 M2 and eddy-currents
beorostica Apr 28, 2023
22f711b
Add plots for M1 and M2 in GUI
beorostica Apr 28, 2023
2c2fc19
KomaMRIPlots:
cncastillo Apr 29, 2023
37a6383
Added a space.
cncastillo May 2, 2023
fe495b5
Fixed typo.
cncastillo May 2, 2023
5fbadee
Added eps rise/fall time to square RFs in get_rfs
cncastillo May 2, 2023
f4f7240
Added discretize func,
cncastillo May 2, 2023
55e9660
Cleaned sim params andseq discretization.
cncastillo May 2, 2023
ce5c68a
seqd.ADC is now sampled at t_i (before t_i+1)
cncastillo May 2, 2023
9a3e182
New `plot_seqd`,
cncastillo May 2, 2023
f9d3ccb
New `get_sim_ranges` function. EPS = 1e-10.
cncastillo May 2, 2023
0e8c83d
T2prep and FatSat considered for RR delay cal.
cncastillo May 2, 2023
0e21266
Added gap before RF and EC spectra from scanner.
cncastillo May 2, 2023
527fac4
Minor changes.
cncastillo May 2, 2023
b6eae2a
Merge koma_v074 into gui
beorostica May 3, 2023
3e4432e
Add message when loading
beorostica May 3, 2023
f40cd72
Export M0, M1 and M2 to .mat
beorostica May 3, 2023
71b276f
Change logo margin on sidebar
beorostica May 3, 2023
ffcf369
FatSat to Gauss pulse.
cncastillo May 4, 2023
a3a514a
Fixes bug with sim in the CPU.
cncastillo May 4, 2023
4d28e51
Test comparing sim accuracy against Mathematica
cncastillo May 4, 2023
c73d84d
Tests for M1 and M2 plots.
cncastillo May 4, 2023
873164c
plot_seqd now has default simParams
cncastillo May 4, 2023
cc9d2ea
Fixes + of Sequence and ADC/Grad/RF in Julia 1.6
cncastillo May 4, 2023
f6dd24e
Cleaned plotting functions, TODO: kspace, phantom
cncastillo May 4, 2023
53b3b42
Edit displayed phrases, some colors, logo size and use loading.html
beorostica May 5, 2023
660a5f6
Remove image and workingdirectory names and use .seq .h5 .scanner and…
beorostica May 5, 2023
b0ccc8d
Add Toast messages for saving to .mat instead of loading progress bar
beorostica May 5, 2023
49ffdc0
Move .mat export functions to a dedicated file
beorostica May 5, 2023
749f4a9
Merge branch koma_v074 into gui
beorostica May 5, 2023
0b374ba
Solve last merging conflicts
beorostica May 5, 2023
d13e255
Update ci.yaml
beorostica May 5, 2023
c37c638
Update again ci.yaml
beorostica May 8, 2023
a2f1d09
Update ci.yml again
beorostica May 8, 2023
c5b5fd9
Update ci.yml again
beorostica May 8, 2023
7280b43
Removed waits (1s).
cncastillo May 8, 2023
b115cbf
Changed logo size and toast dur.
cncastillo May 8, 2023
93316b6
Submodule dependancy setup for tests
cncastillo May 8, 2023
20d29ef
Added KomaMRICore compat in KomaMRIPlots.
cncastillo May 8, 2023
c415978
Changed the order of KomaCore and KomaPlots tests
cncastillo May 8, 2023
b094b43
Dev deps and build submodule projects
cncastillo May 8, 2023
91ef94f
Update ci.yml
beorostica May 8, 2023
65706ef
Changed project for KomaMRIPlots test
cncastillo May 8, 2023
bd13d87
Removed quotes from project directory in test
cncastillo May 8, 2023
c23c82e
Changed KomaPlots dev setup
cncastillo May 8, 2023
ce1fb70
Added CUDA 4 compat
cncastillo May 10, 2023
2e71dfb
KomaUI only returns Window if dev_tools=true
cncastillo May 10, 2023
2506a1a
Added KomaUI test
cncastillo May 10, 2023
ff4ae45
Added prefix: xvfb-run to KomaMRI tests
cncastillo May 10, 2023
7bfa79f
Changed devTools to dev_tools
cncastillo May 10, 2023
9618081
Only use xvfb-run in Ubuntu.
cncastillo May 10, 2023
7eae363
Fixed tests for ubuntu, new [skip ci] commit arg
cncastillo May 10, 2023
01a9c5c
Removed xvfb for KomaCore (no plots nor UI)
cncastillo May 10, 2023
73fe771
Fixed julia 1.6 bug in UI
cncastillo May 10, 2023
58862a5
CI test
cncastillo May 10, 2023
9e2b459
CI test 2
cncastillo May 10, 2023
fa1609d
Add tests for exporting to .mat files
beorostica May 11, 2023
a613716
Update ci.yml for 1.8 julia version
beorostica May 11, 2023
34e0b3b
Remove CUDA 4 compat
beorostica May 11, 2023
1542c5a
Use CI with KomaMRI development setup
beorostica May 11, 2023
0f78f93
Add tests for KomaMRI and use CI latest version
beorostica May 11, 2023
379b4f0
Add test for plot_seqd
beorostica May 11, 2023
312886b
Add simple tests for GUI
beorostica May 11, 2023
eb11836
Use KomaMRIPlots development for testing KomaMRI in CI
beorostica May 11, 2023
d070920
Fix range bug for julia 1.6
beorostica May 11, 2023
88b652a
Edit some KomaMRIPlosts tests
beorostica May 15, 2023
2cf9ad9
Update tests and docstrings for scanner struct
beorostica May 19, 2023
ed31684
Update tests for Phantom struct
beorostica May 19, 2023
08ae515
Update tests for Delay struct
beorostica May 19, 2023
52d271b
Update some tests for ADC struct
beorostica May 22, 2023
9876358
Remove almost completely the "other" folder
beorostica May 22, 2023
bf8a54b
Update tests for Grad struct
beorostica May 23, 2023
51eb7d8
Update tests for RF struct
beorostica May 23, 2023
377a437
Update tests for RF struct
beorostica May 23, 2023
43c0b3e
Update tests for RF struct
beorostica May 23, 2023
792049a
Remove some unused functions from the Sequence struct
beorostica May 23, 2023
28abea2
Add tests for IO MRiLab
beorostica May 23, 2023
a0bfe91
Add tests for IO ISMRMRD
beorostica May 24, 2023
28d15a1
Fix MRiLab for julia 1.6
beorostica May 24, 2023
ebf9d44
Update README.md [skip ci]
cncastillo May 24, 2023
f8dcba4
Add simple tests for DiscretSequence
beorostica May 24, 2023
2a0fc19
Add simple tests for Spinor struct
beorostica May 24, 2023
ece7350
Add simple tests for Sequence functions
beorostica May 24, 2023
cc23f06
Add simple tests for Sequence math operations
beorostica May 24, 2023
9a67680
Fix bug when deleting some lines in the past commit
beorostica May 24, 2023
3cb298a
Add simple tests for BlochDict
beorostica Jun 1, 2023
90e3814
Edit according to reviews from cncastillo
beorostica Jun 2, 2023
5f55a67
Remove test file
beorostica Jun 2, 2023
dba1aa2
Fix bug for Phantom test
beorostica Jun 2, 2023
126f297
Removed InteractBase from deps.
cncastillo Jun 21, 2023
d82e6d2
Updated some examples.
cncastillo Jun 21, 2023
67a3ec9
Eddy currents are in T/m now.
cncastillo Jun 21, 2023
5e57306
KomaMRIPlots:
cncastillo Jun 21, 2023
8c3348b
Commented out savedialog in KomaUI.
cncastillo Jun 21, 2023
387957d
Commentout for avoiding to use savedialog
beorostica Jun 22, 2023
b07fdea
Remove InteractBase from Project.toml
beorostica Jun 27, 2023
fdc65fe
Change some filenames when exporting to .mat
beorostica Jun 27, 2023
34036cc
Merge koma_v074
beorostica Jun 27, 2023
ae8cc20
Test clicks in the GUI
beorostica Jun 27, 2023
9fa347e
Merge pull request #171 from cncastillo/avoid-dialog
cncastillo Jun 28, 2023
63c8751
Make Blink test synchronous and close window
beorostica Jun 29, 2023
4fd72b0
Add try-catch for testing KomaUI
beorostica Jun 30, 2023
6b74e32
Back to synchronous for testing KomaUI
beorostica Jun 30, 2023
b74dfe8
Test KomaUI without calling Blink
beorostica Jun 30, 2023
cb4cb7b
Fix: Test KomaUI without calling Blink
beorostica Jun 30, 2023
afe93cd
Fix: KomaUI test
beorostica Jun 30, 2023
9bbf372
Test .click() for KomaUI tests on remote
beorostica Jul 5, 2023
22718a9
Test .click() for julia 1.6
beorostica Jul 6, 2023
82a4d53
Test .click() sleep time for for julia 1.6
beorostica Jul 6, 2023
680f8be
Test timeout function for KomaUI on remote
beorostica Jul 6, 2023
867f151
Filter test .click() according to julia version
beorostica Jul 6, 2023
79590e3
Complete filter test
beorostica Jul 6, 2023
d22f81b
Test KomaUI with Window() outside @testset
beorostica Jul 6, 2023
a116589
Test KomaUI() click buttons
beorostica Jul 10, 2023
b5d0b6e
Remove const global variables for testing KomaUI() click buttons
beorostica Jul 10, 2023
74fc4fb
Test get_breaks_in_RF_key_points() function
beorostica Jul 10, 2023
20a9ef6
Make test for get_breaks_in_RF_key_points() more readable
beorostica Jul 10, 2023
6284eba
Update button hidden content at the end of button handlers
beorostica Jul 10, 2023
a2cb21c
Add test for plot_slew_rate() function in KomaMRIPlots
beorostica Jul 11, 2023
04a6418
Test for simulation and reconstuction buttons
beorostica Jul 11, 2023
913fd7a
Add timeout condition for testing KomaUI()
beorostica Jul 11, 2023
41eeb22
Change camelCase format in ExportMATFunctions
beorostica Jul 11, 2023
6c49087
Add for loop for testing KomaUI window
beorostica Jul 12, 2023
4724302
Edit export-to-mat tests in KomaUI
beorostica Jul 12, 2023
4cf87ca
Fixed Grad fwf printing bug
cncastillo Jul 12, 2023
f76961c
Generalized gradients in DiffMRF
cncastillo Jul 12, 2023
ae59ddd
Changed name of function in KomaUI tests.
cncastillo Jul 12, 2023
721f053
Add and test isapprox() functions
beorostica Jul 12, 2023
4a8212f
Updated README [skip ci]
cncastillo Jul 12, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
49 changes: 37 additions & 12 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,29 +8,29 @@ on:
- master
tags: '*'
jobs:
test:
ci:
if: "!contains(github.event.head_commit.message, '[skip ci]')"
name: Julia ${{ matrix.version }} - ${{ matrix.os }} - ${{ matrix.arch }} - ${{ github.event_name }}
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
version:
- '1.6' # Replace this with the minimum Julia version that your package supports. E.g. if your package requires Julia 1.5 or higher, change this to '1.5'.
- '1.8'
- '1' # Leave this line unchanged. '1' will automatically expand to the latest stable 1.x release of Julia.
#- 'nightly'
os:
- ubuntu-latest
- macos-latest
- windows-latest
arch:
- x64
os: [ubuntu-latest, windows-latest, macos-latest]
arch: [x64]
include:
- os: ubuntu-latest
prefix: xvfb-run # julia-actions/julia-runtest/blob/master/README.md
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3
- uses: julia-actions/setup-julia@v1
with:
version: ${{ matrix.version }}
arch: ${{ matrix.arch }}
- uses: actions/cache@v1
- uses: actions/cache@v3
env:
cache-name: cache-artifacts
with:
Expand All @@ -40,14 +40,33 @@ jobs:
${{ runner.os }}-test-${{ env.cache-name }}-
${{ runner.os }}-test-
${{ runner.os }}-
- name: "KomaMRI dev setup"
shell: julia --color=yes --project {0}
run: |
using Pkg
Pkg.develop(PackageSpec(; path="./KomaMRICore"))
Pkg.develop(PackageSpec(; path="./KomaMRIPlots"))
- uses: julia-actions/julia-buildpkg@v1
- uses: julia-actions/julia-runtest@v1
with:
prefix: ${{ matrix.prefix }} # for `xvfb-run`
- name: "KomaMRIPlots dev setup"
shell: bash
run: |
julia --color=yes --project="KomaMRIPlots" -e "using Pkg; Pkg.develop(PackageSpec(; path=\"./KomaMRICore\"))"
- uses: julia-actions/julia-buildpkg@v1
with:
project: KomaMRIPlots
- uses: julia-actions/julia-runtest@v1
with:
project: KomaMRIPlots
prefix: ${{ matrix.prefix }} # for `xvfb-run`
- uses: julia-actions/julia-buildpkg@v1
with:
project: KomaMRICore
- uses: julia-actions/julia-runtest@v1
with:
project: KomaMRIPlots
project: KomaMRICore
- uses: julia-actions/julia-processcoverage@v1
with:
directories: src
Expand All @@ -73,7 +92,7 @@ jobs:
name: Documentation
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3
- uses: julia-actions/setup-julia@v1
with:
version: '1'
Expand All @@ -91,3 +110,9 @@ jobs:
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
DOCUMENTER_KEY: ${{ secrets.DOCUMENTER_KEY }}
Skip:
if: contains(github.event.head_commit.message, '[skip ci]')
runs-on: ubuntu-latest
steps:
- name: Skip CI 🚫
run: echo skip ci
162 changes: 50 additions & 112 deletions KomaMRICore/src/datatypes/Phantom.jl
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
"""
phantom = Phantom(name, x, y, z, ρ, T1, T2, T2s, Δw, Dλ1, Dλ2, Dθ, ux, uy, uz)
obj = Phantom(name, x, y, z, ρ, T1, T2, T2s, Δw, Dλ1, Dλ2, Dθ, ux, uy, uz)

The Phantom struct.

# Arguments
- `name`: (`::String`) name of the Phantom
- `name`: (`::String`) name of the phantom
- `x`: (`::AbstractVector{T}`, `[m]`) vector of x-positions of the spins
- `y`: (`::AbstractVector{T}`, `[m]`) vector of y-positions of the spins
- `z`: (`::AbstractVector{T}`, `[m]`) vector of z-positions of the spins
Expand All @@ -21,10 +21,17 @@ The Phantom struct.
- `uz`: (`::Function`) displacement field in the z-axis

# Returns
- `phantom`: (`::Phantom`) Phantom struct
- `obj`: (`::Phantom`) Phantom struct

# Examples
```julia-repl
julia> obj = Phantom()

julia> obj.ρ
```
"""
@with_kw mutable struct Phantom{T<:Real}
name::String = "spins"
name::String = "spins"
x::AbstractVector{T}
y::AbstractVector{T} = zeros(size(x))
z::AbstractVector{T} = zeros(size(x))
Expand All @@ -45,10 +52,26 @@ The Phantom struct.
uy::Function = (x,y,z,t)->0
uz::Function = (x,y,z,t)->0
end
# Phantom() = Phantom(name="spin",x=zeros(1,1))

"""Size and length of a phantom"""
size(x::Phantom) = size(x.ρ)
Base.length(x::Phantom) = length(x.ρ)

"""Compare two phantoms"""
Base.isapprox(obj1::Phantom, obj2::Phantom) = begin
obj1.x ≈ obj2.x &&
obj1.y ≈ obj2.y &&
obj1.z ≈ obj2.z &&
obj1.ρ ≈ obj2.ρ &&
obj1.T1 ≈ obj2.T1 &&
obj1.T2 ≈ obj2.T2 &&
obj1.T2s ≈ obj2.T2s &&
obj1.Δw ≈ obj2.Δw &&
obj1.Dλ1 ≈ obj2.Dλ1 &&
obj1.Dλ2 ≈ obj2.Dλ2 &&
obj1.Dθ ≈ obj2.Dθ
end

"""Separate object spins in a sub-group."""
Base.getindex(obj::Phantom, p::AbstractRange) = begin
Phantom(name=obj.name,
Expand All @@ -70,7 +93,8 @@ Base.getindex(obj::Phantom, p::AbstractRange) = begin
uz=obj.uz
)
end
"""Separate object spins in a sub-group."""

"""Separate object spins in a sub-group (lightweigth)."""
Base.view(obj::Phantom, p::AbstractRange) = begin
@views Phantom(name=obj.name,
x=obj.x[p],
Expand All @@ -92,9 +116,8 @@ Base.view(obj::Phantom, p::AbstractRange) = begin
)
end

# Compartment enabling routines:
# Addition of compartments
+(s1::Phantom,s2::Phantom) =begin
"""Addition of phantoms"""
+(s1::Phantom,s2::Phantom) = begin
Phantom(name=s1.name*"+"*s2.name,
x=[s1.x;s2.x],
y=[s1.y;s2.y],
Expand All @@ -114,7 +137,8 @@ end
uz=s1.uz
)
end
#Fraction of compartments

"""Scalar multiplication of a phantom"""
*(α::Real,obj::Phantom) = begin
Phantom(name=obj.name,
x=obj.x,
Expand All @@ -136,92 +160,6 @@ end
)
end

# Movement related commands
# StartAt(s::Phantom,t0::Float64) = Phantom(s.name,s.x,s.y,s.ρ,s.T2,s.Δw,s.Dλ1,s.Dλ2,s.Dθ,(x,y,t)->s.ux(x,y,t.+t0),(x,y,t)->s.uy(x,y,t.+t0))
# FreezeAt(s::Phantom,t0::Float64) = Phantom(s.name*"STILL",s.x.+s.ux(s.x,s.y,t0),s.y.+s.uy(s.x,s.y,t0),s.ρ,s.T2,s.Δw,s.Dλ1,s.Dλ2,s.Dθ,(x,y,t)->0,(x,y,t)->0)

#TODO: jaw-pitch-roll, expand, contract, functions

# Getting maps
# get_DxDy2D(obj::Phantom) = begin
# P(i) = rotz(obj.Dθ[i])[1:2,1:2];
# D(i) = [obj.Dλ1[i] 0;0 obj.Dλ2[i]]
# nx = [1;0]; ny = [0;1]
# Dx = [nx'*P(i)'*D(i)*P(i)*nx for i=1:prod(size(obj.Dλ1))]
# Dy = [ny'*P(i)'*D(i)*P(i)*ny for i=1:prod(size(obj.Dλ1))]
# Dx, Dy
# end

"""
phantom = heart_phantom(α=1, β=1, γ=1, fat_bool::Bool=false)

Heart-like LV phantom. The variable `α` is for streching, `β` for contraction, and `γ` for
rotation.

# Arguments
- `α`: (`::Real`, `=1`) streching parameter
- `β`: (`::Real`, `=1`) contraction parameter
- `γ`: (`::Real`, `=1`) rotation parameter
- `fat_bool`: (`::Bool`, `=false`) fat boolean parameter

# Returns
- `phantom`: (`::Phantom`) Heart-like LV phantom struct
"""
heart_phantom(α=1, β=1, γ=1, fat_bool::Bool=false) = begin
beorostica marked this conversation as resolved.
Show resolved Hide resolved
#PARAMETERS
FOV = 10e-2 #m Diameter ventricule
N = 21
Δxr = FOV/(N-1) #Aprox rec resolution, use Δx_pix and Δy_pix
Ns = 50 #number of spins per voxel
Δx = Δxr/sqrt(Ns) #spin separation
#POSITIONS
x = y = -FOV/2:Δx:FOV/2-Δx #spin coordinates
x, y = x .+ y'*0, x*0 .+ y' #grid points
#PHANTOM
⚪(R) = (x.^2 .+ y.^2 .<= R^2)*1. #Circle of radius R
v = FOV/4 #m/s 1/16 th of the FOV during acquisition
ωHR = 2π/1 #One heart-beat in one second

# θ(t) = -π/4*γ*(sin.(ωHR*t).*(sin.(ωHR*t).>0)+0.25.*sin.(ωHR*t).*(sin.(ωHR*t).<0) )
ux(x,y,t) = begin
strech = 0 #α * v * (x.^2 .+ y.^2) / (FOV/2)^2 .* sign.(x)
contract = - β * v * x / (FOV/2) #expand
rotate = - γ * v * y / (FOV/2)
def = (strech .+ contract .+ rotate) .* sin.(ωHR*t)
end
uy(x,y,t) = begin
strech = 0 #α * v * (x.^2 .+ y.^2) / (FOV/2)^2 .* sign.(y)
contract = - β * v * y / (FOV/2)
rotate = γ * v * x / (FOV/2)
def = (strech .+ contract .+ rotate) .* sin.(ωHR*t)
end
# Water spins
R = 9/10*FOV/2
r = 6/11*FOV/2
ring = ⚪(R) .- ⚪(r)
ρ = ⚪(r) .+ 0.9*ring #proton density
# Diffusion tensor model
D = 2e-9 #Diffusion of free water m2/s
D1, D2 = D, D/20
Dλ1 = D1*⚪(R) #Diffusion map
Dλ2 = D1*⚪(r) .+ D2*ring #Diffusion map
Dθ = atan.(x,-y) .* ring #Diffusion map
T1 = (1400*⚪(r) .+ 1026*ring)*1e-3 #Myocardial T1
T2 = ( 308*⚪(r) .+ 42*ring )*1e-3 #T2 map [s]
# Generating Phantoms
heart = Phantom("LeftVentricle",x,y,ρ,T2,Dλ1,Dλ2,Dθ,ux,uy)
# Fat spins
ring2 = ⚪(FOV/2) .- ⚪(R) #outside fat layer
ρ_fat = .5*ρ.*ring2
Δw_fat = 2π*220*ring2 #fat should be dependant on B0
T1_fat = 800*ring2*1e-3
T2_fat = 120*ring2*1e-3 #T2 map [s]
fat = Phantom("fat",x,y,ρ_fat,T2_fat,Δw_fat)
#Resulting phantom
obj = fat_bool ? heart + fat : heart #concatenating spins
end


"""
phantom = brain_phantom2D(;axis="axial", ss=4)

Expand Down Expand Up @@ -313,14 +251,14 @@ function brain_phantom2D(;axis="axial", ss=4)
T2 = T2*1e-3
T2s = T2s*1e-3
phantom = Phantom{Float64}(name="brain2D_"*axis,
x=y[ρ.!=0],
y=x[ρ.!=0],
z=0*x[ρ.!=0],
ρ=ρ[ρ.!=0],
T1=T1[ρ.!=0],
T2=T2[ρ.!=0],
T2s=T2s[ρ.!=0],
Δw=Δw[ρ.!=0])
x=y[ρ.!=0],
y=x[ρ.!=0],
z=0*x[ρ.!=0],
ρ=ρ[ρ.!=0],
T1=T1[ρ.!=0],
T2=T2[ρ.!=0],
T2s=T2s[ρ.!=0],
Δw=Δw[ρ.!=0])
phantom
end

Expand Down Expand Up @@ -418,13 +356,13 @@ function brain_phantom3D(;ss=4)
T2 = T2*1e-3
T2s = T2s*1e-3
phantom = Phantom{Float64}(name ="brain3D",
x = y[ρ.!=0],
y = x[ρ.!=0],
z = z[ρ.!=0],
ρ = ρ[ρ.!=0],
T1 = T1[ρ.!=0],
T2 = T2[ρ.!=0],
T2s = T2s[ρ.!=0],
Δw = Δw[ρ.!=0])
x = y[ρ.!=0],
y = x[ρ.!=0],
z = z[ρ.!=0],
ρ = ρ[ρ.!=0],
T1 = T1[ρ.!=0],
T2 = T2[ρ.!=0],
T2s = T2s[ρ.!=0],
Δw = Δw[ρ.!=0])
phantom
end
20 changes: 12 additions & 8 deletions KomaMRICore/src/datatypes/Scanner.jl
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
"""
scanner = Scanner(B0, B1, Gmax, Smax, ADC_Δt, seq_Δt, GR_Δt, RF_Δt,
sys = Scanner(B0, B1, Gmax, Smax, ADC_Δt, seq_Δt, GR_Δt, RF_Δt,
RF_ring_down_T, RF_dead_time_T, ADC_dead_time_T)

The Scanner struct.

# Arguments
- `B0`: (`::Real`, `=1.5`, `[T]`) main magnetic field
- `B0`: (`::Real`, `=1.5`, `[T]`) main magnetic field strength
- `B1`: (`::Real`, `=10e-6`, `[T]`) maximum RF amplitude
- `Gmax`: (`::Real`, `=60e-3`, `[T/m]`) maximum Gradient
- `Smax`: (`::Real`, `=500`, `[mT/m/ms]`) maximum slew-rate
- `Gmax`: (`::Real`, `=60e-3`, `[T/m]`) maximum gradient amplitude
- `Smax`: (`::Real`, `=500`, `[mT/m/ms]`) gradient maximum slew-rate
- `ADC_Δt`: (`::Real`, `=2e-6`, `[s]`) ADC raster time
- `seq_Δt`: (`::Real`, `=1e-5`, `[s]`) sequence-block raster time
- `GR_Δt`: (`::Real`, `=1e-5`, `[s]`) gradient raster time
Expand All @@ -18,7 +18,14 @@ The Scanner struct.
- `ADC_dead_time_T`: (`::Real`, `=10e-6`, `[s]`) ADC dead time

# Returns
- `scanner`: (`::Scanner`) Scanner struct
- `sys`: (`::Scanner`) Scanner struct

# Examples
```julia-repl
julia> sys = Scanner()

julia> sys.B0
```
"""
@with_kw mutable struct Scanner
#Main
Expand All @@ -36,6 +43,3 @@ The Scanner struct.
RF_dead_time_T::Real=100e-6
ADC_dead_time_T::Real=10e-6
end

#Functions that check that Sequence satisfy hardware requirements:
#check_sys_req(seq::Sequence,sys::Scanner)
Loading