CLEARSWI

Documentation for CLEARSWI.

CLEARSWI.DataType
Data(mag, phase, header, TEs)

Defines a struct as input for clearSWI

source
CLEARSWI.OptionsType
Options(;   mag_combine=:SNR,
            mag_sens=nothing,
            mag_softplus=true,
            phase_unwrap=:laplacian,
            phase_hp_sigma=[4,4,0],
            phase_scaling_type=:tanh,
            phase_scaling_strength=4,
            writesteps=nothing)
  • mag_combine selects the echo combination for the magnitude. Options are

    • :SNR
    • :average
    • :last to select the last echo
    • (:CNR => (:gm, :wm)) to optimize the contrast between two selected tissues with the possible tissues classes to select in src/tissue.jl, currently only working for 7T
    • (:echo => 3) to select the 3rd echo
    • (:closest => 15.3) to select the echo that is closest to 15.3 ms
    • (:SE => 15.3) to simulate the contrast that would be achieved using a corresponding single-echo scan with 15.3 ms echo time.
  • If mag_sens is set to an array, it is used instead of CLEAR-SWI sensitivity estimation. This can also be set to mag_sens=[1] to use the constant sensitivity of 1 and effectively avoid sensitivity correction. To change the sigmamm value of the expected bias field size, set it to i.e. `magsens=(:sigma_mm => 7)`. The default is 7mm.

  • To deactivate scaling of the combined magnitude with the softplus function, use mag_softplus=false.

  • phase_unwrap is either :laplacian, :romeo, or :laplacianslice (slicewise laplacian unwrapping)

  • The phase_hp_sigma is used for high-pass filtering and is given in voxel for the [x,y,z]-dimension.

  • phase_scaling_type is the scaling function to create the phase mask and can be :tanh or :negativetanh for sigmoidal filtering, or :positive, :negative, and :triangular for traditional SWI application.

  • phase_scaling_strength adjusts the strength of the created phase mask. A higher phase_scaling_strength is a stronger phase appearance. With a traditional SWI phase_scaling_type it corresponds to the power or number of phase mask multiplications.

  • Set writesteps to the path, where intermediate steps should be saved, e.g. writesteps="/tmp/clearswi_steps". If set to nothing, intermediate steps won't be saved.

  • Set qsm to true

source
CLEARSWI.calculateSWIFunction
calculateSWI(data::Data, options::Options=Options())

Returns the calculated SWI using 'data' and 'options'.

Examples

julia> TEs = [4,8,12]
julia> data = Data(mag, phase, header(mag), TEs);
julia> swi = calculateSWI(data);

With Options

Base.Docs.DocStr(svec(" Options(; magcombine=:SNR,\n magsens=nothing,\n magsoftplus=true,\n phaseunwrap=:laplacian,\n phasehpsigma=[4,4,0],\n phasescalingtype=:tanh,\n phasescalingstrength=4,\n writesteps=nothing)\n\n* mag_combine selects the echo combination for the magnitude. Options are \n * :SNR\n * :average\n * :last to select the last echo\n * (:CNR => (:gm, :wm)) to optimize the contrast between two selected tissues with the possible tissues classes to select in src/tissue.jl, currently only working for 7T\n * (:echo => 3) to select the 3rd echo \n * (:closest => 15.3) to select the echo that is closest to 15.3 ms \n * (:SE => 15.3) to simulate the contrast that would be achieved using a corresponding single-echo scan with 15.3 ms echo time.\n\n* If mag_sens is set to an array, it is used instead of CLEAR-SWI sensitivity estimation. This can also be set to mag_sens=[1] to use the constant sensitivity of 1 and effectively avoid sensitivity correction. To change the sigmamm value of the expected bias field size, set it to i.e. `magsens=(:sigmamm => 7). The default is 7mm.\n\n* To deactivate scaling of the combined magnitude with the softplus function, usemagsoftplus=false.\n\n*phaseunwrapis either:laplacian,:romeo, or:laplacianslice(slicewise laplacian unwrapping)\n\n* Thephasehpsigmais used for high-pass filtering and is given in voxel for the [x,y,z]-dimension. \n\n*phasescalingtypeis the scaling function to create the phase mask and can be:tanhor:negativetanhfor sigmoidal filtering, or:positive,:negative, and:triangularfor traditional SWI application.\n\n*phasescalingstrengthadjusts the strength of the created phase mask. A higherphasescalingstrengthis a stronger phase appearance. With a traditional SWIphasescalingtypeit corresponds to the power or number of phase mask multiplications.\n\n* Setwritestepsto the path, where intermediate steps should be saved, e.g.writesteps=\"/tmp/clearswisteps\". If set tonothing, intermediate steps won't be saved.\n\n* Setqsmto true\n"),`` Options(; magcombine=:SNR, magsens=nothing, magsoftplus=true, phaseunwrap=:laplacian, phasehpsigma=[4,4,0], phasescalingtype=:tanh, phasescalingstrength=4, writesteps=nothing)


  * `mag_combine` selects the echo combination for the magnitude. Options are 

      * `:SNR`
      * `:average`
      * `:last` to select the last echo
      * `(:CNR => (:gm, :wm))` to optimize the contrast between two selected tissues with the possible tissues classes to select in `src/tissue.jl`, currently only working for 7T
      * `(:echo => 3)` to select the 3rd echo
      * `(:closest => 15.3)` to select the echo that is closest to 15.3 ms
      * `(:SE => 15.3)` to simulate the contrast that would be achieved using a corresponding single-echo scan with 15.3 ms echo time.
  * If `mag_sens` is set to an array, it is used instead of CLEAR-SWI sensitivity estimation. This can also be set to `mag_sens=[1]` to use the constant sensitivity of 1 and effectively avoid sensitivity correction. To change the sigma*mm value of the expected bias field size, set it to i.e. `mag*sens=(:sigma_mm => 7)`. The default is 7mm.
  * To deactivate scaling of the combined magnitude with the softplus function, use `mag_softplus=false`.
  * `phase_unwrap` is either `:laplacian`, `:romeo`, or `:laplacianslice` (slicewise laplacian unwrapping)
  * The `phase_hp_sigma` is used for high-pass filtering and is given in voxel for the [x,y,z]-dimension.
  * `phase_scaling_type` is the scaling function to create the phase mask and can be `:tanh` or `:negativetanh` for sigmoidal filtering, or `:positive`, `:negative`, and `:triangular` for traditional SWI application.
  * `phase_scaling_strength` adjusts the strength of the created phase mask. A higher `phase_scaling_strength` is a stronger phase appearance. With a traditional SWI `phase_scaling_type` it corresponds to the power or number of phase mask multiplications.
  * Set `writesteps` to the path, where intermediate steps should be saved, e.g. `writesteps="/tmp/clearswi_steps"`. If set to `nothing`, intermediate steps won't be saved.
  * Set `qsm` to true
, Dict{Symbol, Any}(:typesig => Union{}, :module => CLEARSWI, :linenumber => 20, :binding => CLEARSWI.Options, :path => "/home/runner/work/CLEARSWI.jl/CLEARSWI.jl/src/utility.jl", :fields => Dict{Symbol, Any}()))

# Examples

julia-repl julia> TEs = [4,8,12] julia> data = Data(mag, phase, header(mag), TEs); julia> options = Options(phasehpsigma=[10,10,5], mag_softplus=false) julia> swi = calculateSWI(data, options); ```

source
CLEARSWI.createIntensityProjectionMethod
createIntensityProjection(S::AbstractArray{T,3}, func, d=7) where T

Calculates an intensity projection over the 3rd dimension of S with the function func over d slices. Good function are minimum, maximum, mean, std, ...

Examples

julia> using Statistics
julia> a = rand(Float64, (64,64,20))
julia> createIntensityProjection(a, std)
source
CLEARSWI.createMIPFunction
createMIP(S::AbstractArray{<:Number,3}, d=7)

Creates minimum intensity projection of S over d slices.

Examples

julia> TEs = [4,8,12]
julia> data = Data(mag, phase, header(mag), TEs);
julia> swi = calculateSWI(data);
julia> mip = createMIP(swi);

See also createIntensityProjection

source
CLEARSWI.dirMethod
CLEARSWI.dir(path...)

Construct a path relative to SWI root.

Example

julia> CLEARSWI.dir("test","data","small","Mag.nii")
"/home/korbinian90/.julia/dev/CLEARSWI/test/data/small/Mag.nii"
source
CLEARSWI.saveconfigurationFunction
saveconfiguration(options::Options, path=options.writesteps)

Saves the configuration in the file "settings_swi.txt" under path

source