Hi, I am currently using 3dNLfim to apply gamma variate model to fit our tracer kinetics data and extract useful parameters such as time-to-peak, onset time, etc.
During this process, I've encountered an issue where all the f-test values were coming out as zeroes even though the resulting fit was very decent.
I've attached my code and snapshot of the fit vs. the signal. I am looking forward to hear back from you soon.
#!/bin/tcsh -xef
# Where is data located? It is FITC-Dextran data that was used to compute the arrival time of the tracer in miniscope paper.
# First: convert each image to text using FIJI. Maybe write a script to do this either in Python or any language.
# 600x600 ROI was used before converting to text images
# Get number of CPUs: afni_system_check.py -check_all | grep CPU
set in_path = "/media/vu/Elements/Vu/FITC/M5/Cropped_FITC_25x25"
set out_path = "/media/vu/Elements/Vu/FITC/M5/AFNI_25x25"
set prefix = "FITC"
# in ms
set tr = 50
# go and delete everything
mkdir "$out_path"
cd "$out_path"
rm ${prefix}*
cd "$in_path"
set num_img = `ls -1 | wc -l`
# make brik
to3d -prefix $prefix -orient LAI -time:tz ${num_img} 1 ${tr} ZERO -datum float *.txt
3drefit -xdel 0.005 -ydel 0.005 -zdel 0.005 -keepcen "$prefix+orig"
# move new briks to output directory
mv ${prefix}+orig* "$out_path"
# change directory
cd "$out_path"
# compute average of the first 300 time points
3dTstat -mean -prefix "${prefix}_avg_baseline" "${prefix}+orig.BRIK'[0..300]'"
# get the max and min offset
set min_offset = `3dBrickStat -min FITC_avg_baseline+orig.BRIK`
set max_offset = `3dBrickStat -max FITC_avg_baseline+orig.BRIK`
# compute constraints
set tol = `python ../calc.py "0.5 *$min_offset"`
echo "++ Tolerance: $tol"
set new_min_offset = `python ../calc.py "$min_offset - $tol"`
set max_offset = `python ../calc.py "$min_offset"`
echo "++ Offset minimum: ${new_min_offset}"
echo "++ Offset maximum: ${max_offset}"
# t0, k, r, b
3dNLfim -input "${prefix}+orig.HEAD" \
-inTR \
-signal GammaVar \
-noise Constant \
-nconstr 0 $new_min_offset $max_offset \
-nabs \
-sconstr 0 15 30 \
-sconstr 1 240 250 \
-sconstr 2 4.5 5.1 \
-sconstr 3 0.4 0.5 \
-nbest 20 \
-nrand 19999 \
-BOTH \
-sfit "${prefix}_signal_fit" \
-snfit "${prefix}_sig_and_noise_fit" \
-bucket 0 "${prefix}_abucket" \
-voxel_count \
-fdisp 1 \
-jobs 16