Skip to content

Commit

Permalink
add B0 weighting options;
Browse files Browse the repository at this point in the history
add B0_snr output
  • Loading branch information
korbinian90 committed Oct 14, 2024
1 parent aafac97 commit f18871a
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 3 deletions.
2 changes: 1 addition & 1 deletion Project.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
name = "ROMEO"
uuid = "1ea8258b-a15d-4adb-ad20-01632f467a84"
authors = ["Korbinian Eckstein", "Barbara Dymerska", "Simon Robinson"]
version = "1.3.0"
version = "1.4.0"

[deps]
ArgParse = "c7e460c6-2fb9-53a9-8c5b-16f535851c63"
Expand Down
4 changes: 4 additions & 0 deletions ext/RomeoApp/argparse.jl
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,10 @@ function getargs(args::AbstractVector, version)
default = ""
nargs = '?'
constant = "B0"
"--B0-phase-weighting"
help = """phase_snr | average | TEs | mag | magTEs | simulated_mag
Set the weighting for the B0 calculation."""
default = "phase_snr"
"--phase-offset-correction"
help = """on | off | bipolar.
Applies the MCPC3Ds method to perform phase offset
Expand Down
6 changes: 4 additions & 2 deletions ext/RomeoApp/caller.jl
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
function ROMEO.unwrapping_main(args; version="App 4.4")
function ROMEO.unwrapping_main(args; version="App 4.5")
settings = getargs(args, version)
data = load_data_and_resolve_args!(settings)

Expand Down Expand Up @@ -242,8 +242,10 @@ function computeB0(settings, data)
end
data["mag"] = to_dim(exp.(-settings["TEs"]/20), 4) # T2*=20ms decay (low value to reduce noise contribution of later echoes)
end
B0 = calculateB0_unwrapped(data["phase"], data["mag"], settings["TEs"])
B0 = calculateB0_unwrapped(data["phase"], data["mag"], settings["TEs"], Symbol(settings["B0-phase-weighting"]))
save(B0, settings["compute-B0"], settings)
snr = get_B0_snr(data["mag"], settings["TEs"], Symbol(settings["B0-phase-weighting"]))
save(snr, settings["compute-B0"]*"_snr", settings)
end

function write_qualitymap(settings, data, keyargs)
Expand Down
8 changes: 8 additions & 0 deletions test/RomeoApp/dataset_small.jl
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,12 @@ configurations_me(pm) = [
[pm..., "--phase-offset-correction", "bipolar", "-t", "[2,4,6]"],
[pm..., "--phase-offset-correction", "-t", "[2,4,6]", "--phase-offset-smoothing-sigma-mm", "[5,8,4]"],
[pm..., "--phase-offset-correction", "-t", "[2,4,6]", "--write-phase-offsets"],
[pm..., "-t", "[2,4,6]", "-B", "--B0-phase-weighting", "phase_snr"],
[pm..., "-t", "[2,4,6]", "-B", "--B0-phase-weighting", "average"],
[pm..., "-t", "[2,4,6]", "-B", "--B0-phase-weighting", "TEs"],
[pm..., "-t", "[2,4,6]", "-B", "--B0-phase-weighting", "mag"],
[pm..., "-t", "[2,4,6]", "-B", "--B0-phase-weighting", "magTEs"],
[pm..., "-t", "[2,4,6]", "-B", "--B0-phase-weighting", "simulated_mag"],
]

files = [(phasefile_1eco, magfile_1eco), (phasefile_1arreco, magfile_1arreco), (phasefile_1eco, magfile_1arreco), (phasefile_1arreco, magfile_1eco), (phasefile_2D, magfile_2D)]
Expand Down Expand Up @@ -192,11 +198,13 @@ unwrapping_main([phasefile_me, "-o", testpath, "-m", magfile_me, "-t", "[2,4,6]"
testpath = joinpath(tmpdir, "testB0_1")
unwrapping_main([phasefile_me, "-o", testpath, "-m", magfile_me, "-t", "[2,4,6]", "-B"])
@test isfile(joinpath(testpath, "B0.nii"))
@test isfile(joinpath(testpath, "B0_snr.nii"))

testpath = joinpath(tmpdir, "testB0_2")
name = "B0_output"
unwrapping_main([phasefile_me, "-o", testpath, "-m", magfile_me, "-t", "[2,4,6]", "-B", name])
@test isfile(joinpath(testpath, "$name.nii"))
@test isfile(joinpath(testpath, "$(name)_snr.nii"))

## TODO add and test homogeneity corrected output

Expand Down

2 comments on commit f18871a

@korbinian90
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@JuliaRegistrator
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Registration pull request created: JuliaRegistries/General/117263

Tip: Release Notes

Did you know you can add release notes too? Just add markdown formatted text underneath the comment after the text
"Release notes:" and it will be added to the registry PR, and if TagBot is installed it will also be added to the
release that TagBot creates. i.e.

@JuliaRegistrator register

Release notes:

## Breaking changes

- blah

To add them here just re-invoke and the PR will be updated.

Tagging

After the above pull request is merged, it is recommended that a tag is created on this repository for the registered package version.

This will be done automatically if the Julia TagBot GitHub Action is installed, or can be done manually through the github interface, or via:

git tag -a v1.4.0 -m "<description of version>" f18871ac852400adbf03e2e5f3fae6abc44d19c1
git push origin v1.4.0

Also, note the warning: Version 1.4.0 skips over 1.3.0
This can be safely ignored. However, if you want to fix this you can do so. Call register() again after making the fix. This will update the Pull request.

Please sign in to comment.