Skip to content

Commit

Permalink
Merge branch 'master' of github.com:MagneticParticleImaging/MPIFiles.jl
Browse files Browse the repository at this point in the history
  • Loading branch information
nHackel committed Dec 15, 2023
2 parents e1e9190 + eed348b commit 3ec32dc
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 7 deletions.
2 changes: 1 addition & 1 deletion Project.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
name = "MPIFiles"
uuid = "371237a9-e6c1-5201-9adb-3d8cfa78fa9f"
authors = ["Tobias Knopp <[email protected]>"]
version = "0.14.0"
version = "0.14.1"

[deps]
AxisArrays = "39de3d68-74b9-583c-8d2d-e117c070f3a9"
Expand Down
2 changes: 1 addition & 1 deletion src/MDFInMemory.jl
Original file line number Diff line number Diff line change
Expand Up @@ -520,7 +520,7 @@ Reconstruction group of an in-memory MDF
"""
mutable struct MDFv2Reconstruction <: MDFv2InMemoryPart
"Reconstructed data"
data::Union{Array{Number, 3}, Missing}
data::Union{Array{Float32, 3}, Missing}
"Field of view of reconstructed data; optional"
fieldOfView::Union{Vector{Float64}, Nothing}
"Center of the reconstructed data (relative to scanner origin/center); optional"
Expand Down
13 changes: 8 additions & 5 deletions src/Measurements.jl
Original file line number Diff line number Diff line change
Expand Up @@ -196,10 +196,14 @@ function getMeasurements(f::MPIFile, neglectBGFrames=true;

data = getAveragedMeasurements(f; frames=idx[frames],
numAverages=numAverages, kargs...)

if bgCorrection

idxBG = measBGFrameIdx(f)
hasBGFrames = length(idxBG) > 0
if bgCorrection && !hasBGFrames
@warn "Background correction was selected but there are no background frames in the file."
elseif bgCorrection && hasBGFrames
@debug "Applying bg correction ..."
idxBG = measBGFrameIdx(f)

dataBG = getAveragedMeasurements(f; frames=idxBG, kargs...)
if interpolateBG
blockLen = measBGFrameBlockLengths(measIsBGFrame(f))
Expand Down Expand Up @@ -245,8 +249,7 @@ function getMeasurements(f::MPIFile, neglectBGFrames=true;
data = getAveragedMeasurements(f; frames=frames, numAverages=numAverages, kargs...)
end

if bgCorrection
idxBG = measBGFrameIdx(f)
if bgCorrection && hasBGFrames
dataBG = getAveragedMeasurements(f; frames=idxBG, kargs...)

data[:,:,:,:] .-= mean(dataBG, dims=4)
Expand Down

0 comments on commit 3ec32dc

Please sign in to comment.