Commit 5dd7c09c authored by Vesa Oikonen's avatar Vesa Oikonen

basic simulation of perfusion ratio in kidneys

parent 425bec30
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 : Basic error simulation for perfusion ratio
#: Date : 2019-03-09
#: 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"
fit2dat -c=0,420,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
printf "\n=====================================================================\n"
printf " Simulate renal TACs \n"
printf "=====================================================================\n"
b2t_h2o -nosub -fpt -voiname=f400 sim/blood.tac 400 0.94 1.0 10 20 sim/renal400.tac
if [ $? -ne 0 ] ; then printf "Failed!\n" ; exit 1 ; fi
b2t_h2o -add -nosub -fpt -voiname=f380 sim/blood.tac 380 0.94 1.0 10 20 sim/renal400.tac
if [ $? -ne 0 ] ; then printf "Failed!\n" ; exit 1 ; fi
b2t_h2o -add -nosub -fpt -voiname=f360 sim/blood.tac 360 0.94 1.0 10 20 sim/renal400.tac
if [ $? -ne 0 ] ; then printf "Failed!\n" ; exit 1 ; fi
b2t_h2o -add -nosub -fpt -voiname=f320 sim/blood.tac 320 0.94 1.0 10 20 sim/renal400.tac
if [ $? -ne 0 ] ; then printf "Failed!\n" ; exit 1 ; fi
b2t_h2o -add -nosub -fpt -voiname=f280 sim/blood.tac 280 0.94 1.0 10 20 sim/renal400.tac
if [ $? -ne 0 ] ; then printf "Failed!\n" ; exit 1 ; fi
b2t_h2o -add -nosub -fpt -voiname=f240 sim/blood.tac 240 0.94 1.0 10 20 sim/renal400.tac
if [ $? -ne 0 ] ; then printf "Failed!\n" ; exit 1 ; fi
b2t_h2o -add -nosub -fpt -voiname=f200 sim/blood.tac 200 0.94 1.0 10 20 sim/renal400.tac
if [ $? -ne 0 ] ; then printf "Failed!\n" ; exit 1 ; fi
b2t_h2o -add -nosub -fpt -voiname=f160 sim/blood.tac 160 0.94 1.0 10 20 sim/renal400.tac
if [ $? -ne 0 ] ; then printf "Failed!\n" ; exit 1 ; fi
b2t_h2o -add -nosub -fpt -voiname=f120 sim/blood.tac 120 0.94 1.0 10 20 sim/renal400.tac
if [ $? -ne 0 ] ; then printf "Failed!\n" ; exit 1 ; fi
b2t_h2o -add -nosub -fpt -voiname=f80 sim/blood.tac 80 0.94 1.0 10 20 sim/renal400.tac
if [ $? -ne 0 ] ; then printf "Failed!\n" ; exit 1 ; fi
b2t_h2o -add -nosub -fpt -voiname=f40 sim/blood.tac 40 0.94 1.0 10 20 sim/renal400.tac
if [ $? -ne 0 ] ; then printf "Failed!\n" ; exit 1 ; fi
tac2svg -mt="" -x2=120 -legend=y sim/rbf_ttacs400.svg -l sim/renal400.tac
if [ $? -ne 0 ] ; then printf "Failed!\n" ; exit 1 ; fi
b2t_h2o -nosub -fpt -voiname=f200 sim/blood.tac 200 0.94 1.0 10 20 sim/renal200.tac
if [ $? -ne 0 ] ; then printf "Failed!\n" ; exit 1 ; fi
b2t_h2o -add -nosub -fpt -voiname=f190 sim/blood.tac 190 0.94 1.0 10 20 sim/renal200.tac
if [ $? -ne 0 ] ; then printf "Failed!\n" ; exit 1 ; fi
b2t_h2o -add -nosub -fpt -voiname=f180 sim/blood.tac 180 0.94 1.0 10 20 sim/renal200.tac
if [ $? -ne 0 ] ; then printf "Failed!\n" ; exit 1 ; fi
b2t_h2o -add -nosub -fpt -voiname=f160 sim/blood.tac 160 0.94 1.0 10 20 sim/renal200.tac
if [ $? -ne 0 ] ; then printf "Failed!\n" ; exit 1 ; fi
b2t_h2o -add -nosub -fpt -voiname=f140 sim/blood.tac 140 0.94 1.0 10 20 sim/renal200.tac
if [ $? -ne 0 ] ; then printf "Failed!\n" ; exit 1 ; fi
b2t_h2o -add -nosub -fpt -voiname=f120 sim/blood.tac 120 0.94 1.0 10 20 sim/renal200.tac
if [ $? -ne 0 ] ; then printf "Failed!\n" ; exit 1 ; fi
b2t_h2o -add -nosub -fpt -voiname=f100 sim/blood.tac 100 0.94 1.0 10 20 sim/renal200.tac
if [ $? -ne 0 ] ; then printf "Failed!\n" ; exit 1 ; fi
b2t_h2o -add -nosub -fpt -voiname=f80 sim/blood.tac 80 0.94 1.0 10 20 sim/renal200.tac
if [ $? -ne 0 ] ; then printf "Failed!\n" ; exit 1 ; fi
b2t_h2o -add -nosub -fpt -voiname=f60 sim/blood.tac 60 0.94 1.0 10 20 sim/renal200.tac
if [ $? -ne 0 ] ; then printf "Failed!\n" ; exit 1 ; fi
b2t_h2o -add -nosub -fpt -voiname=f40 sim/blood.tac 40 0.94 1.0 10 20 sim/renal200.tac
if [ $? -ne 0 ] ; then printf "Failed!\n" ; exit 1 ; fi
b2t_h2o -add -nosub -fpt -voiname=f20 sim/blood.tac 20 0.94 1.0 10 20 sim/renal200.tac
if [ $? -ne 0 ] ; then printf "Failed!\n" ; exit 1 ; fi
tac2svg -mt="" -x2=120 -legend=y sim/rbf_ttacs200.svg -l sim/renal200.tac
if [ $? -ne 0 ] ; then printf "Failed!\n" ; exit 1 ; fi
printf "\n=====================================================================\n"
printf " Make plot of TTACs with very wide range of renal perfusion values \n"
printf "=====================================================================\n"
cp -f sim/blood.tac sim/tacs.tac
if [ $? -ne 0 ] ; then printf "Failed!\n" ; exit 1 ; fi
b2t_h2o -add -fpt -voiname=TTAC_800 sim/blood.tac 800 0.94 1.0 10 20 sim/tacs.tac
if [ $? -ne 0 ] ; then printf "Failed!\n" ; exit 1 ; fi
b2t_h2o -add -fpt -voiname=TTAC_600 sim/blood.tac 600 0.94 1.0 10 20 sim/tacs.tac
if [ $? -ne 0 ] ; then printf "Failed!\n" ; exit 1 ; fi
b2t_h2o -add -fpt -voiname=TTAC_400 sim/blood.tac 400 0.94 1.0 10 20 sim/tacs.tac
if [ $? -ne 0 ] ; then printf "Failed!\n" ; exit 1 ; fi
b2t_h2o -add -fpt -voiname=TTAC_300 sim/blood.tac 300 0.94 1.0 10 20 sim/tacs.tac
if [ $? -ne 0 ] ; then printf "Failed!\n" ; exit 1 ; fi
b2t_h2o -add -fpt -voiname=TTAC_200 sim/blood.tac 200 0.94 1.0 10 20 sim/tacs.tac
if [ $? -ne 0 ] ; then printf "Failed!\n" ; exit 1 ; fi
b2t_h2o -add -fpt -voiname=TTAC_150 sim/blood.tac 150 0.94 1.0 10 20 sim/tacs.tac
if [ $? -ne 0 ] ; then printf "Failed!\n" ; exit 1 ; fi
b2t_h2o -add -fpt -voiname=TTAC_100 sim/blood.tac 100 0.94 1.0 10 20 sim/tacs.tac
if [ $? -ne 0 ] ; then printf "Failed!\n" ; exit 1 ; fi
b2t_h2o -add -fpt -voiname=TTAC_80 sim/blood.tac 80 0.94 1.0 10 20 sim/tacs.tac
if [ $? -ne 0 ] ; then printf "Failed!\n" ; exit 1 ; fi
b2t_h2o -add -fpt -voiname=TTAC_60 sim/blood.tac 60 0.94 1.0 10 20 sim/tacs.tac
if [ $? -ne 0 ] ; then printf "Failed!\n" ; exit 1 ; fi
b2t_h2o -add -fpt -voiname=TTAC_40 sim/blood.tac 40 0.94 1.0 10 20 sim/tacs.tac
if [ $? -ne 0 ] ; then printf "Failed!\n" ; exit 1 ; fi
b2t_h2o -add -fpt -voiname=TTAC_20 sim/blood.tac 20 0.94 1.0 10 20 sim/tacs.tac
if [ $? -ne 0 ] ; then printf "Failed!\n" ; exit 1 ; fi
b2t_h2o -add -fpt -voiname=TTAC_10 sim/blood.tac 10 0.94 1.0 10 20 sim/tacs.tac
if [ $? -ne 0 ] ; then printf "Failed!\n" ; exit 1 ; fi
tac2svg -mt="" -x2=120 -legend=y sim/rbf_tacs.svg -l sim/tacs.tac
if [ $? -ne 0 ] ; then printf "Failed!\n" ; exit 1 ; fi
printf "\n=====================================================================\n"
printf " Calculate perfusion ratios \n"
printf "=====================================================================\n"
perfrat sim/renal400.tac f400 sim/renal400.par
if [ $? -ne 0 ] ; then printf "Failed!\n" ; exit 1 ; fi
perfrat sim/renal200.tac f200 sim/renal200.par
if [ $? -ne 0 ] ; then printf "Failed!\n" ; exit 1 ; fi
printf "\n=====================================================================\n"
printf " Plot the results \n"
printf "=====================================================================\n"
printf "1\t380\n1\t360\n1\t320\n1\t280\n1\t240\n1\t200\n1\t160\n1\t120\n1\t80\n1\t40\n" > sim/x400.dat
printf "0\t0\n400\t1\n" > sim/c400.dat
tacformat -f=tsv sim/renal400.par sim/res400.dat
if [ $? -ne 0 ] ; then printf "Failed!\n" ; exit 1 ; fi
tacsetx sim/res400.dat sim/x400.dat 1
if [ $? -ne 0 ] ; then printf "Failed!\n" ; exit 1 ; fi
tac2svg -legend=n -mt="" -xt="Perfusion" -yt="Perfusion ratio" sim/rbf_pr400.svg -l sim/c400.dat -b sim/res400.dat
if [ $? -ne 0 ] ; then printf "Failed!\n" ; exit 1 ; fi
printf "1\t190\n1\t180\n1\t160\n1\t140\n1\t120\n1\t100\n1\t80\n1\t60\n1\t40\n1\t20\n" > sim/x200.dat
printf "0\t0\n200\t1\n" > sim/c200.dat
tacformat -f=tsv sim/renal200.par sim/res200.dat
if [ $? -ne 0 ] ; then printf "Failed!\n" ; exit 1 ; fi
tacsetx sim/res200.dat sim/x200.dat 1
if [ $? -ne 0 ] ; then printf "Failed!\n" ; exit 1 ; fi
tac2svg -legend=n -mt="" -xt="Perfusion" -yt="Perfusion ratio" sim/rbf_pr200.svg -l sim/c200.dat -b sim/res200.dat
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