-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
916cda8
commit c57cb19
Showing
8 changed files
with
52 additions
and
51 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,9 @@ | ||
name = "QuantitativeSusceptibilityMappingTGV" | ||
uuid = "bd393529-335a-4aed-902f-5de61cc7ff49" | ||
authors = ["Korbinian Eckstein [email protected]"] | ||
version = "0.2.1" | ||
version = "0.3.0" | ||
|
||
[deps] | ||
CUDA = "052768ef-5323-5732-b1bb-66c8b64840ba" | ||
ImageFiltering = "6a3955dd-da59-5b1f-98d4-e7296123deb5" | ||
ImageMorphology = "787d08f9-d448-5407-9aad-5290dd7ab264" | ||
Interpolations = "a98d9a8b-a2ab-59e6-89dd-64a1c18fca59" | ||
|
@@ -18,7 +17,6 @@ StaticArrays = "90137ffa-7385-5640-81b9-e52037218182" | |
Statistics = "10745b16-79ce-11e8-11f9-7d13ad32a3b2" | ||
|
||
[compat] | ||
CUDA = "4,5" | ||
ImageFiltering = "0.7" | ||
ImageMorphology = "0.4" | ||
Interpolations = "0.14" | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,5 @@ | ||
[deps] | ||
Aqua = "4c88cf16-eb10-579e-8560-4a9242c79595" | ||
CUDA = "052768ef-5323-5732-b1bb-66c8b64840ba" | ||
Test = "8dfed614-e22c-5e08-85e1-65c5234f0b40" | ||
TestItemRunner = "f8b46487-2199-4994-9208-9a1283c18c0a" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
#!/usr/bin/env -S julia --color=yes --startup-file=no --threads=auto | ||
|
||
## Usage | ||
|
||
# Call with: `<path-to-file>/tgv_qsm.jl ARGS` | ||
# On windows use: `julia --threads=auto <path-to-file>/tgv_qsm.jl ARGS` | ||
|
||
# Example call: | ||
# `./tgv_qsm.jl phase.nii.gz mask.nii.gz --TE 0.025 --output output.nii.gz --no-gpu | ||
|
||
import Pkg | ||
|
||
## Uncomment to use a local julia package directory instead of the global one | ||
# package_dir = joinpath(@__DIR__, ".tgv_cmd_packages") | ||
# mkpath(package_dir) | ||
# Pkg.activate(package_dir) | ||
|
||
try | ||
using CUDA, QuantitativeSusceptibilityMappingTGV, MriResearchTools, Comonicon | ||
catch | ||
Pkg.add(["CUDA", "QuantitativeSusceptibilityMappingTGV", "MriResearchTools", "Comonicon"]) | ||
using CUDA, QuantitativeSusceptibilityMappingTGV, MriResearchTools, Comonicon | ||
end | ||
|
||
version = Comonicon.get_version(QuantitativeSusceptibilityMappingTGV) | ||
Comonicon.get_version(::Module) = version | ||
|
||
@main function tgv_qsm(fn_phase, fn_mask; TE::Float64, output::String="output.nii.gz", fieldstrength::Float64=3.0, regularization::Float64=2.0, erosions::Int=3, B0_dir::Array{Int}=[0,0,1], dedimensionalize::Bool=false, no_laplacian_correction::Bool=false, step_size::Float64=3.0, type::DataType=Float32, nblocks::Int=32) | ||
println("Starting calculation...") | ||
phase = readphase(fn_phase) | ||
mask = niread(fn_mask) .!= 0 | ||
res = header(phase).pixdim[2:4] | ||
println("Resolution from NIfTI header [mm]: $(round.(Float64.(res); digits=2))") | ||
chi = qsm_tgv(phase, mask, res; TE, B0_dir, fieldstrength, regularization, erosions, dedimensionalize, correct_laplacian=!no_laplacian_correction, gpu=!no_gpu, step_size, type, nblocks, gpu=CUDA) | ||
println("Writing output") | ||
savenii(chi, output; header=header(phase)) | ||
end |