Skip to content

Commit

Permalink
🐛 FIX no_vol uses mean value not voxel value to correct
Browse files Browse the repository at this point in the history
  • Loading branch information
WillForan committed Jul 19, 2024
1 parent 4a442d3 commit 63e7aed
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 14 deletions.
22 changes: 15 additions & 7 deletions t/tat2.bats
Original file line number Diff line number Diff line change
Expand Up @@ -454,13 +454,6 @@ x_cmp_y(){
[[ $output == "(x/m)*1" ]]
}

@test gen_calc_nonorm {
# TODO: THIS IS WRONG?
source tat2
parse_args -no_vol
run args_to_3dcalc_expr
[[ $output == "(x/m)*x*1" ]]
}
@test gen_calc_zscore {
# TODO: this should error?
source tat2
Expand All @@ -482,3 +475,18 @@ x_cmp_y(){
run args_to_3dcalc_expr
[[ $output == "-1*log(x/m)*1" ]]
}

@test gen_calc_no_vol_noscale {
source tat2
parse_args -no_vol -no_voxscale
run args_to_3dcalc_expr
[[ $output == "(x/m)*m*1" ]]
}
@test gen_calc_no_vol {
source tat2
parse_args -no_vol
numvox="NVOX"
run args_to_3dcalc_expr
[[ $output == "(x/m)*m*$SCALE/NVOX" ]]
}

16 changes: 9 additions & 7 deletions tat2
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ declare -a GLOBFILES

filedesc_whichvol=""

TAT2_VER="20240719-calc_ln"
TAT2_VER="20240719-calc_ln+BUGFIX-no_vol"
# 20201116
# back to mean default
# add
Expand Down Expand Up @@ -58,9 +58,9 @@ USAGE
SYNOPSIS
calculates time averaged T2* like:
1) 3dROIstats > volnorm.1D
# tune with -{median,mean,zscor}_vol, and -mask, -mkmask, or -mask_rel
# tune with -{median,mean,no}_vol, and -mask, -mkmask, or -mask_rel
2) 3dcalc -x input_1 -m volnorm_1.1D -expr "(x/m)*SCALE/numvox #rep. f.ea. input
# tune with -no_voxscale, -scale
# tune with -no_voxscale, -scale, -calc_zscore, -calc_ln
# numvox derived from mask (but output not masked)
3) 3dTstat allnormed_concated.nii.gz
# tune with -{median,mean}_time
Expand Down Expand Up @@ -106,7 +106,7 @@ OPTIONS (in order of relevance)
-median_vol or -mean_vol or -no_vol
set value used to scale across volume (each TR, 3dROIstats)
vol norm default: '$volnorm_opt'
(history: median [20210302], mean [20201116], median [20201016]. no_vol added 20210921)
(history: median [20210302], mean [20201116], median [20201016]. no_vol added 20210921 but *x instead of *m. fixed 20240719)
-calc_zscore or -calc_log
for 3dcalc per volume voxelwise normalization:
Expand Down Expand Up @@ -323,9 +323,11 @@ args_to_3dcalc_expr(){
[ $vox_scale -eq 0 ] && calc_scale="1"

# 20210921 - BL measure effect of volume normalization
[ $volnorm_opt == "none" ] && calc_scale="x*1"
# TODO BUG? should calc_scale = m*1 ?
# TODO BUG? should '$vox_scale -ne 0' => calc_scale "x*$SCALE/$numvox"
# 20240719 - BUGFIX
# 1. had 'x*1' but want to undo x/m. is now (x/m)*m
# 2. did not respect scaling
# now can do: x/m*m * scale/nvox (but thats a bad idea?)
[ $volnorm_opt == "none" ] && calc_scale="m*$calc_scale"


# normalize each voxel by the volume average or median
Expand Down

0 comments on commit 63e7aed

Please sign in to comment.