diff --git a/Project.toml b/Project.toml index 281b1aa..3975182 100644 --- a/Project.toml +++ b/Project.toml @@ -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" @@ -16,6 +16,6 @@ ClearswiApp = "ArgParse" [compat] ArgParse = "1" -MriResearchTools = "3.1" +MriResearchTools = "3.1.4" Statistics = "1" julia = "1.7" diff --git a/README.md b/README.md index 0fd7d27..6de7247 100644 --- a/README.md +++ b/README.md @@ -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`. diff --git a/src/magnitude_processing.jl b/src/magnitude_processing.jl index ef9449a..32c470f 100644 --- a/src/magnitude_processing.jl +++ b/src/magnitude_processing.jl @@ -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 diff --git a/src/utility.jl b/src/utility.jl index 5337620..85dda60 100644 --- a/src/utility.jl +++ b/src/utility.jl @@ -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`. @@ -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 diff --git a/test/functions_test.jl b/test/functions_test.jl index b951086..5b465d7 100644 --- a/test/functions_test.jl +++ b/test/functions_test.jl @@ -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 = [