Skip to content

Commit

Permalink
update sensitivity correction:
Browse files Browse the repository at this point in the history
more robust default estimation for smaller FoV sizes;
expose setting to options
  • Loading branch information
Korbinian Eckstein committed Jun 16, 2024
1 parent 1b3dc42 commit 41e8284
Show file tree
Hide file tree
Showing 5 changed files with 9 additions and 6 deletions.
4 changes: 2 additions & 2 deletions Project.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
name = "CLEARSWI"
uuid = "06ae4d9b-ce5e-4813-a1b3-426e46312ec2"
authors = ["Korbinian Eckstein"]
version = "1.3.1"
version = "1.3.2"

[deps]
ArgParse = "c7e460c6-2fb9-53a9-8c5b-16f535851c63"
Expand All @@ -16,6 +16,6 @@ ClearswiApp = "ArgParse"

[compat]
ArgParse = "1"
MriResearchTools = "3.1"
MriResearchTools = "3.1.4"
Statistics = "1"
julia = "1.7"
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ qsm=false
* `(: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.
* 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`.

Expand Down
4 changes: 3 additions & 1 deletion src/magnitude_processing.jl
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,9 @@ end
function sensitivity_correction(combined_mag, data, options)
sensitivity = options.mag_sens
if isnothing(sensitivity)
sensitivity = getsensitivity(data.mag[:,:,:,1], getpixdim(data))
sensitivity = getsensitivity(data.mag, getpixdim(data))
elseif sensitivity isa Pair && first(sensitivity) == :sigma_mm
sensitivity = getsensitivity(data.mag, getpixdim(data); sigma_mm=last(sensitivity))
end
savenii(sensitivity, "sensitivity", options.writesteps, data.header)
return combined_mag ./ sensitivity
Expand Down
4 changes: 2 additions & 2 deletions src/utility.jl
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ end
* `(: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.
* 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`.
Expand All @@ -54,7 +54,7 @@ end
"""
struct Options
mag_combine
mag_sens::Union{AbstractArray, Nothing}
mag_sens::Union{AbstractArray, Nothing, Pair}
mag_softplus
phase_unwrap::Symbol
phase_hp_sigma::AbstractArray
Expand Down
1 change: 1 addition & 0 deletions test/functions_test.jl
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ options = [
Options(mag_combine=:last) # 3
Options(mag_softplus=false)
Options(mag_sens=[1])
Options(mag_sens=(:sigma_mm => 3))
]
# TODO
wrong_options = [
Expand Down

2 comments on commit 41e8284

@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/109120

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.3.2 -m "<description of version>" 41e82846a05cd750ab99139495b3387879348956
git push origin v1.3.2

Please sign in to comment.