Commit 3287d047 authored by vesoik@utu.fi's avatar vesoik@utu.fi

RBC-to-plasma ratio with rational function

parent 9a35d467
FIT1 fit_ratf 0.7.1 (c) 2019 by Turku PET Centre
Date: 2019-05-25 08:43:47
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 6 0222 0 1 5 5 0.002 0
sim 2 . 0 90 16 0 6 0222 0 1 0.001 0 0 0
sim 3 . 0 90 16 0 6 0222 0 1 0 0 5.0E-05 0
sim 4 . 0 90 16 0 6 0222 0 1 0.7 0 0.001 0.2
#!/bin/bash
#: Title : Plasma-to-blood ratio sim2
#: Date : 2019-05-25
#: 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 rational 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_ratf.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_ratf.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_ratf.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 RBC-to-plasma ratios \n"
printf "=====================================================================\n"
interpol -x=0.1,0.5,1,2,3,4,5,7,10,15,20,30,40,50,60 res/rbc2p.bld res/rbc2p_sparse.bld
tacadd -ovr res/rbc2p_sparse_1.bld res/rbc2p_sparse.bld 1
tacadd -ovr res/rbc2p_sparse_2.bld res/rbc2p_sparse.bld 2
tacadd -ovr res/rbc2p_sparse_3.bld res/rbc2p_sparse.bld 3
tacadd -ovr res/rbc2p_sparse_4.bld res/rbc2p_sparse.bld 4
if [ $? -ne 0 ] ; then printf "Failed!\n" ; exit 1 ; fi
printf "\n ok \n"
fit_ratf -wf -p2p1 res/rbc2p_sparse_1.bld res/rbc2p_1.fit
if [ $? -ne 0 ] ; then printf "Failed!\n" ; exit 1 ; fi
printf "\n ok \n"
fit_ratf -wf -p1p1 res/rbc2p_sparse_2.bld res/rbc2p_2.fit
if [ $? -ne 0 ] ; then printf "Failed!\n" ; exit 1 ; fi
printf "\n ok \n"
fit_ratf -wf -p2p1 res/rbc2p_sparse_3.bld res/rbc2p_3.fit
if [ $? -ne 0 ] ; then printf "Failed!\n" ; exit 1 ; fi
printf "\n ok \n"
fit_ratf -wf -p2p2 res/rbc2p_sparse_4.bld res/rbc2p_4.fit
if [ $? -ne 0 ] ; then printf "Failed!\n" ; exit 1 ; fi
printf "\n ok \n"
fit2dat -c=0,60,0.02 res/rbc2p_1.fit res/rbc2p_1_fitted.bld
if [ $? -ne 0 ] ; then printf "Failed!\n" ; exit 1 ; fi
printf "\n ok \n"
fit2dat -c=0,60,0.02 res/rbc2p_2.fit res/rbc2p_2_fitted.bld
if [ $? -ne 0 ] ; then printf "Failed!\n" ; exit 1 ; fi
printf "\n ok \n"
fit2dat -c=0,60,0.02 res/rbc2p_3.fit res/rbc2p_3_fitted.bld
if [ $? -ne 0 ] ; then printf "Failed!\n" ; exit 1 ; fi
printf "\n ok \n"
fit2dat -c=0,60,0.02 res/rbc2p_4.fit res/rbc2p_4_fitted.bld
if [ $? -ne 0 ] ; then printf "Failed!\n" ; exit 1 ; fi
printf "\n ok \n"
tac2svg -mt="Fitted RBC-to-plasma ratio" -x2=55 -y1=0.0 res/sim_fitted_rbc2p_ratf.svg -s res/rbc2p_sparse_1.bld -l res/rbc2p_1_fitted.bld -s res/rbc2p_sparse_2.bld -l res/rbc2p_2_fitted.bld -s res/rbc2p_sparse_3.bld -l res/rbc2p_3_fitted.bld -s res/rbc2p_sparse_4.bld -l res/rbc2p_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