Commit eacb5a73 authored by Vesa Oikonen's avatar Vesa Oikonen

started new simulation

parent 3287d047
FIT1 fit_sinf 0.6.19 (c) 2018 by Turku PET Centre
Date: 2018-02-12 09:00:05
Data file: popinp\blend_lvcav.tac
Data unit: g/mL
Time unit: sec
Nr of VOIs: 1
Region Plane Start End dataNr WSS parNr Type Parameters
LV cav . -2.092 290.000 1336 1.80E+004 8 0331 7.856170E+000 1.154150E+001 5.697422E+000 1.384451E-003 3.790469E+001 8.092264E-002 4.240644E+000 9.999998E+001
#!/bin/bash
#: Title : Very simple demonstration of bootstrapping radiowater PET data
#: Date : 2019-09-13
#: Author : "Vesa Oikonen" <vesa.oikonen@utu.fi>
#: Options : None
printf "\n=====================================================================\n"
printf " Making or emptying result folder\n"
if [ ! -d sim ]; then
mkdir sim
else
rm -f sim/*
fi
printf "\n=====================================================================\n"
printf " Compute BTAC at 0.5 s sampling times \n"
printf "=====================================================================\n\n"
fit2dat -c=0,480,0.5 blend_lvcav.fit sim/blood.tac
if [ $? -ne 0 ] ; then printf "Failed!\n" ; exit 1 ; fi
tacren --silent sim/blood.tac 1 blood_artery
if [ $? -ne 0 ] ; then printf "Failed!\n" ; exit 1 ; fi
tacstudy --force sim/blood.tac sim1
if [ $? -ne 0 ] ; then printf "Failed!\n" ; exit 1 ; fi
printf "\n=====================================================================\n"
printf " Simulate GM TTAC \n"
printf "=====================================================================\n\n"
b2t_h2o -nosub -fpt -voiname="GM" sim/blood.tac 50 1.00 1.0 0 0 sim/gm.tac
if [ $? -ne 0 ] ; then printf "Failed!\n" ; exit 1 ; fi
tacstudy --force sim/gm.tac sim1
if [ $? -ne 0 ] ; then printf "Failed!\n" ; exit 1 ; fi
tac2svg -mt="" -x2=300 -legend=y sim/cbf_gm_tac.svg -l sim/gm.tac sim/blood.tac
if [ $? -ne 0 ] ; then printf "Failed!\n" ; exit 1 ; fi
printf "\n=====================================================================\n"
printf " Simulate noise \n"
printf "=====================================================================\n\n"
# Remove decay correction
tacdecay -decay=off -i=O-15 sim/gm.tac sim/gm_nondecaycorrected.tac
if [ $? -ne 0 ] ; then printf "Failed!\n" ; exit 1 ; fi
# Make noise realizations
svar4tac -minsd=0.2 -x=10 sim/gm_nondecaycorrected.tac 20 sim/gm_nondecaycorrected_noisy.tac
if [ $? -ne 0 ] ; then printf "Failed!\n" ; exit 1 ; fi
tac2svg -mt="Noisy simulated TTACs" -legend=n sim/gm_nondecaycorrected_noisy.svg -l sim/gm_nondecaycorrected_noisy.tac
if [ $? -ne 0 ] ; then printf "Failed!\n" ; exit 1 ; fi
printf "\n=====================================================================\n"
printf " Simulate frames \n"
printf "=====================================================================\n\n"
printf "9/13/2019 14:15:12 22 2 1 sim1 O-15\n" > sim/frames.sif
printf "0 5\n" >> sim/frames.sif
printf "5 10\n" >> sim/frames.sif
printf "10 15\n" >> sim/frames.sif
printf "15 20\n" >> sim/frames.sif
printf "20 25\n" >> sim/frames.sif
printf "25 30\n" >> sim/frames.sif
printf "30 40\n" >> sim/frames.sif
printf "40 50\n" >> sim/frames.sif
printf "50 60\n" >> sim/frames.sif
printf "60 80\n" >> sim/frames.sif
printf "80 100\n" >> sim/frames.sif
printf "100 120\n" >> sim/frames.sif
printf "120 140\n" >> sim/frames.sif
printf "140 160\n" >> sim/frames.sif
printf "160 180\n" >> sim/frames.sif
printf "180 210\n" >> sim/frames.sif
printf "210 240\n" >> sim/frames.sif
printf "240 270\n" >> sim/frames.sif
printf "270 300\n" >> sim/frames.sif
printf "300 330\n" >> sim/frames.sif
printf "330 360\n" >> sim/frames.sif
printf "360 420\n" >> sim/frames.sif
if [ $? -ne 0 ] ; then printf "Failed!\n" ; exit 1 ; fi
simframe sim/gm_nondecaycorrected_noisy.tac sim/frames.sif sim/ttacs_nondecaycorrected.tac
if [ $? -ne 0 ] ; then printf "Failed!\n" ; exit 1 ; fi
# Correct for decay
tacdecay -decay=on -i=O-15 sim/ttacs_nondecaycorrected.tac sim/ttacs.tac
if [ $? -ne 0 ] ; then printf "Failed!\n" ; exit 1 ; fi
tac2svg -mt="Noisy framed TTACs" -legend=n sim/ttacs.svg -l sim/ttacs.tac
if [ $? -ne 0 ] ; then printf "Failed!\n" ; exit 1 ; fi
printf "\n=====================================================================\n"
printf " Calculate perfusion using CM fit \n"
printf "=====================================================================\n\n"
fit_h2o -fpt -Vb=0 -delay=0 -k2 -fit=sim/cbf_sim1_fit_h2o.tac sim/blood.tac sim/ttacs.tac 999 sim/fit_h2o.par
if [ $? -ne 0 ] ; then printf "Failed!\n" ; exit 1 ; fi
tac2svg -mt="" -legend=y sim/cbf_sim1_fit_h2o.svg -s sim/ttacs.tac -l sim/cbf_sim1_fit_h2o.tac
if [ $? -ne 0 ] ; then printf "Failed!\n" ; exit 1 ; fi
printf "\n===================================================================\n"
printf " All done! \n"
printf "===================================================================\n"
exit 0
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment