Commit be13e417 authored by Vesa Oikonen's avatar Vesa Oikonen

simulation of plasma-to-blood ratio using surge plus recirculation function

parent b4941938
HCT_lower := 0.45
HCT_upper := 0.45
A_lower := 1e-05
A_upper := 3
L_lower := 1e-03
L_upper := 1
k_lower := 0
k_upper := 1.2
HCT_lower := 0.45
HCT_upper := 0.45
A_lower := 1e-05
A_upper := 1
L_lower := 1e-03
L_upper := 0.1
k_lower := 0
k_upper := 0.1
FIT1 madeup 0.7.1 (c) 2019 by Turku PET Centre
Date: 2019-05-12 13:55:37
Data file: rbc2p.dat
Data unit: unitless
Time unit: min
Nr of VOIs: 4
Region Plane Start End dataNr WSS parNr Type Parameters
sim 1 . 0 90 16 0 3 1433 0.0002 0.01 1.0
sim 2 . 0 90 16 0 3 1433 0.05 0.1 0.2
sim 3 . 0 90 16 0 3 1433 0.08 0.03 0.001
sim 4 . 0 90 16 0 3 1433 2.0 0.9 0.1
#!/bin/bash
#: Title : Plasma-to-blood ratio sim1
#: Date : 2019-05-12
#: Author : "Vesa Oikonen" <vesa.oikonen@utu.fi>
#: Options : None
printf "\n=====================================================================\n"
printf " Making or emptying result folder to not mess with data and script \n"
if [ ! -d res ]; then
mkdir res
else
rm -f res/*
fi
printf "\n=====================================================================\n"
printf " Calculate discrete RBC-to-plasma curves from function parameters \n"
printf "=====================================================================\n"
fit2dat -c=0,90,0.02 rbc2p.fit res/rbc2p.bld
if [ $? -ne 0 ] ; then printf "Failed!\n" ; exit 1 ; fi
printf "\n ok \n"
printf "\n=====================================================================\n"
printf " Plot the curves \n"
printf "=====================================================================\n"
tac2svg -mt="RBC-to-plasma ratio" -x2=55 res/sim_rbc2p.svg -l res/rbc2p.bld
if [ $? -ne 0 ] ; then printf "Failed!\n" ; exit 1 ; fi
printf "\n ok \n"
printf "\n=====================================================================\n"
printf " Convert to blood-to-plasma ratios and plot \n"
printf "=====================================================================\n"
taccalc res/rbc2p.bld - 1 res/temp1.bld
if [ $? -ne 0 ] ; then printf "Failed!\n" ; exit 1 ; fi
printf "\n ok \n"
taccalc res/temp1.bld x 0.45 res/temp2.bld
if [ $? -ne 0 ] ; then printf "Failed!\n" ; exit 1 ; fi
printf "\n ok \n"
taccalc res/temp2.bld + 1 res/b2p.bld
if [ $? -ne 0 ] ; then printf "Failed!\n" ; exit 1 ; fi
printf "\n ok \n"
tac2svg -mt="Blood-to-plasma ratio" -x2=55 -y1=0.5 res/sim_b2p.svg -l res/b2p.bld
if [ $? -ne 0 ] ; then printf "Failed!\n" ; exit 1 ; fi
printf "\n ok \n"
printf "\n=====================================================================\n"
printf " Convert to plasma-to-blood ratios and plot \n"
printf "=====================================================================\n"
tacinv res/b2p.bld res/p2b.bld
if [ $? -ne 0 ] ; then printf "Failed!\n" ; exit 1 ; fi
printf "\n ok \n"
tac2svg -mt="Plasma-to-blood ratio" -x2=55 -y1=0.8 res/sim_p2b.svg -l res/p2b.bld
if [ $? -ne 0 ] ; then printf "Failed!\n" ; exit 1 ; fi
printf "\n ok \n"
printf "\n=====================================================================\n"
printf " Try to fit plasma-to-blood ratios \n"
printf "=====================================================================\n"
interpol -x=0.1,0.5,1,2,3,4,5,7,10,15,20,30,40,50,60 res/p2b.bld res/p2b_sparse.bld
tacadd -ovr res/p2b_sparse_1.bld res/p2b_sparse.bld 1
tacadd -ovr res/p2b_sparse_2.bld res/p2b_sparse.bld 2
tacadd -ovr res/p2b_sparse_3.bld res/p2b_sparse.bld 3
tacadd -ovr res/p2b_sparse_4.bld res/p2b_sparse.bld 4
if [ $? -ne 0 ] ; then printf "Failed!\n" ; exit 1 ; fi
printf "\n ok \n"
fit_pbr -lim=fit_pbr.lim res/p2b_sparse_1.bld res/p2b_1.fit
if [ $? -ne 0 ] ; then printf "Failed!\n" ; exit 1 ; fi
printf "\n ok \n"
fit_pbr -lim=fit_pbr.lim res/p2b_sparse_2.bld res/p2b_2.fit
if [ $? -ne 0 ] ; then printf "Failed!\n" ; exit 1 ; fi
printf "\n ok \n"
# Note that different constraints are needed for this curve
fit_pbr -lim=fit_pbr3.lim res/p2b_sparse_3.bld res/p2b_3.fit
if [ $? -ne 0 ] ; then printf "Failed!\n" ; exit 1 ; fi
printf "\n ok \n"
fit_pbr -lim=fit_pbr.lim res/p2b_sparse_4.bld res/p2b_4.fit
if [ $? -ne 0 ] ; then printf "Failed!\n" ; exit 1 ; fi
printf "\n ok \n"
fit2dat -c=0,60,0.02 res/p2b_1.fit res/p2b_1_fitted.bld
if [ $? -ne 0 ] ; then printf "Failed!\n" ; exit 1 ; fi
printf "\n ok \n"
fit2dat -c=0,60,0.02 res/p2b_2.fit res/p2b_2_fitted.bld
if [ $? -ne 0 ] ; then printf "Failed!\n" ; exit 1 ; fi
printf "\n ok \n"
fit2dat -c=0,60,0.02 res/p2b_3.fit res/p2b_3_fitted.bld
if [ $? -ne 0 ] ; then printf "Failed!\n" ; exit 1 ; fi
printf "\n ok \n"
fit2dat -c=0,60,0.02 res/p2b_4.fit res/p2b_4_fitted.bld
if [ $? -ne 0 ] ; then printf "Failed!\n" ; exit 1 ; fi
printf "\n ok \n"
tac2svg -mt="Fitted plasma-to-blood ratio" -x2=55 -y1=0.8 res/sim_fitted_p2b.svg -s res/p2b_sparse_1.bld -l res/p2b_1_fitted.bld -s res/p2b_sparse_2.bld -l res/p2b_2_fitted.bld -s res/p2b_sparse_3.bld -l res/p2b_3_fitted.bld -s res/p2b_sparse_4.bld -l res/p2b_4_fitted.bld
if [ $? -ne 0 ] ; then printf "Failed!\n" ; exit 1 ; fi
printf "\n ok \n"
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