Susceptibility Weighted Imaging (CLEAR-SWI)
Published at the ISMRM as CLEAR-SWI. It provides magnetic resonance images with improved vein and iron contrast by weighting a combined magnitude image with a preprocessed phase image. This package has the additional capability of multi-echo SWI, intensity correction, contrast enhancement and improved phase processing. The reason for the development of this package was to solve artefacts at ultra-high field strength (7T), however, it also drastically improves the SWI quality at lower field strength.
A Julia installation ≥ 1.3 (Official Julia Webpage)
Single-echo or multi-echo Magnitude and Phase images in NIfTI fileformat (4D images with echoes in the 4th dimension)
Run the following commands in Julia (either interactively in the REPL or as a script)
using Pkg Pkg.add(PackageSpec(url="https://github.com/korbinian90/CLEARSWI.jl"))
This is a simple multi-echo case without changing default behavior
using CLEARSWI TEs = [4,8,12] # change this to the Echo Time of your sequence. For multi-echoes, set a list of TE values, else set a list with a single TE value. nifti_folder = CLEARSWI.dir("test","testData","small") # replace with path to your folder e.g. nifti_folder="/data/clearswi" magfile = joinpath(nifti_folder, "Mag.nii") # Path to the magnitude image in nifti format, must be .nii or .hdr phasefile = joinpath(nifti_folder, "Phase.nii") # Path to the phase image mag = readmag(magfile); phase = readphase(phasefile); data = Data(mag, phase, mag.header, TEs); swi = calculateSWI(data); mip = createMIP(swi); savenii(swi, "<outputpath>/swi.nii"; header=mag.header) # change <outputpath> with the path where you want to save the reconstructed SWI savenii(mip, "<outputpath>/mip.nii"; header=mag.header)
To apply custom options use the following keyword syntax (example to apply 3D high-pass filtering for the phase with the given kernel size and deactivate softplus magnitude scaling):
options = Options(phase_hp_σ=[10,10,5], mag_softplus=false) swi = calculateSWI(data, options);
All the possible options with the default values are
mag_combine=:SNR mag_sens=nothing mag_softplus=true phase_unwrap=:laplacian phase_hp_σ=[4,4,0] phase_scaling_type=:tanh phase_scaling_strength=4 writesteps=nothing
mag_combineselects the echo combination for the magnitude. Options are
:lastto 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.
mag_sensis set to an array, it is used instead of CLEAR-SWI sensitivity estimation. This can also be set to
mag_sens=to use the constant sensitivity of 1 and effectively avoid sensitivity correction.
To deactivate scaling of the combined magnitude with the softplus function, use
:laplacianslice(slicewise laplacian unwrapping)
phase_hp_σis used for high-pass filtering and is given in voxel for the [x,y,z]-dimension.
phase_scaling_typeis the scaling function to create the phase mask and can be
:tanhfor sigmoidal filtering, or
:triangularfor traditional SWI application. If the scaling has the wrong sign, the phase input can be simply inverted by a minus sign:
phase = -readphase(phasefile);
phase_scaling_strengthadjusts the strength of the created phase mask. A higher phase_scaling_strength is a stronger phase appearance. With a traditional SWI
phase_scaling_typeit corresponds to the power or number of phase mask multiplications.
writestepsto the path, where intermediate steps should be saved, e.g.
writesteps="/tmp/clearswi_steps". If set to
nothing, intermediate steps won't be saved.
This project is licensed under the MIT License - see the LICENSE for details