Commit 8e4061c5 authored by Vesa Oikonen's avatar Vesa Oikonen

new simulation

parent 34cc7c0d
# model := 2TCM
Parameters K1[mL/(mL*min)] K1/k2 k3[1/min] Vb[%]
myocardium 0.2 1.0 0.02 0
FIT1 fit_sinf 0.8.9 (c) 2005-2013 by Turku PET Centre
Date: 2014-02-18 10:06:45
Data file: fdg_arterial_plasma.dat
Data unit: kBq/mL
Time unit: min
Nr of VOIs: 1
Region Plane Start End dataNr WSS parNr Type Parameters
Plasma . . 0.0 60 22 0 10 0331 1.0E-01 3.461569E-01 1.111569E+02 7.805481 5.699555 3.386341E-001 4.181790 7.961674E-002 5.705464 1.393305E-002
14/11/2019 09:09:10 18 2 1 SIMUL F-18
0 10
10 20
20 30
30 40
40 50
50 60
60 120
120 180
180 240
240 300
300 600
600 900
900 1200
1200 1500
1500 1800
1800 2400
2400 3000
3000 3600
#!/bin/bash
#: Title : myocardial_fdg
#: Date : 2019-11-14
#: Author : "Vesa Oikonen" <vesa.oikonen@utu.fi>
#: Options : None
#: Description: Simplistic simulation of partial volume errors in FDG heart studies,
#: and testing proposed correction methods.
printf "\n=====================================================================\n"
printf " Making or emptying result folder\n"
if [ ! -d sim1 ]; then
mkdir sim1
else
rm -f sim1/*
fi
printf "=====================================================================\n"
printf "Making 60 min FDG PTAC with 0.05 min (3 s) sample intervals. \n"
printf "PTAC is based on population mean from human FDG studies.\n"
printf "We will assume that plasma and blood TACs are equal.\n"
printf "=====================================================================\n"
fit2dat -c=0,61,0.1 fdg_arterial_plasma.fit sim1/plasma.bld
if [ $? -ne 0 ] ; then printf "Failed!\n" ; exit 1 ; fi
printf "=====================================================================\n"
printf "Simulating FDG TTACs with K1=0.2, K1/k2=1.0, k3=0.02, Vb=0 \n"
printf "Ki=K1*k3/(k2+k3)= 0.004/0.22 = 0.018181818 \n"
printf "Parameters are based on rat FDG study by Mabrouk et al, 2014 \n"
printf "=====================================================================\n"
sim_3tcm fdg.par sim1/plasma.bld none sim1/tissue.bld
if [ $? -ne 0 ] ; then printf "Failed!\n" ; exit 1 ; fi
printf "=====================================================================\n"
printf "Simulating time frames \n"
printf "=====================================================================\n"
simframe sim1/plasma.bld frames.sif sim1/plasma.tac
if [ $? -ne 0 ] ; then printf "Failed!\n" ; exit 1 ; fi
simframe sim1/tissue.bld frames.sif sim1/tissue.tac
if [ $? -ne 0 ] ; then printf "Failed!\n" ; exit 1 ; fi
tacren sim1/plasma.tac 0 blood true
if [ $? -ne 0 ] ; then printf "Failed!\n" ; exit 1 ; fi
tacren sim1/tissue.tac 0 myocardium true
if [ $? -ne 0 ] ; then printf "Failed!\n" ; exit 1 ; fi
printf "=====================================================================\n"
printf "Simulating dynamic FDG PET image of mouse heart \n"
printf "=====================================================================\n"
tacadd -ovr sim1/pet.tac sim1/tissue.tac sim1/plasma.tac
if [ $? -ne 0 ] ; then printf "Failed!\n" ; exit 1 ; fi
simimyoc -3D -FWHM=2 -diameter=3 -diamin=1 -thickness=2 -pxlsize=0.25 -dim=64 sim1/pet.tac sim1/pet.v
if [ $? -ne 0 ] ; then printf "Failed!\n" ; exit 1 ; fi
imgki -v=sim1/patlak_ic.v -thr=1 sim1/plasma.tac sim1/pet.v 10 sim1/patlak_ki.v
if [ $? -ne 0 ] ; then printf "Failed!\n" ; exit 1 ; fi
printf "=====================================================================\n"
printf "Make mask ROIs \n"
printf "=====================================================================\n"
imgthrs -mask=sim1/mask_heart.v sim1/pet.v 50 100
if [ $? -ne 0 ] ; then printf "Failed!\n" ; exit 1 ; fi
imgthrs -mask=sim1/mask_cavity.v -start=0 -end=5 sim1/pet.v 80 100
if [ $? -ne 0 ] ; then printf "Failed!\n" ; exit 1 ; fi
imgthrs -mask=sim1/mask_myocardium.v -start=50 -end=60 sim1/pet.v 90 100
if [ $? -ne 0 ] ; then printf "Failed!\n" ; exit 1 ; fi
img2tif sim1/mask_heart.v
if [ $? -ne 0 ] ; then printf "Failed!\n" ; exit 1 ; fi
img2tif sim1/mask_cavity.v
if [ $? -ne 0 ] ; then printf "Failed!\n" ; exit 1 ; fi
img2tif sim1/mask_myocardium.v
if [ $? -ne 0 ] ; then printf "Failed!\n" ; exit 1 ; fi
printf "=====================================================================\n"
printf "Calculate ROI TACs and plot with correct TACs \n"
printf "=====================================================================\n"
img2dft sim1/pet.v sim1/mask_myocardium.v sim1/mask_myocardium.tac
if [ $? -ne 0 ] ; then printf "Failed!\n" ; exit 1 ; fi
img2dft sim1/pet.v sim1/mask_heart.v sim1/mask_heart.tac
if [ $? -ne 0 ] ; then printf "Failed!\n" ; exit 1 ; fi
img2dft sim1/pet.v sim1/mask_cavity.v sim1/mask_cavity.tac
if [ $? -ne 0 ] ; then printf "Failed!\n" ; exit 1 ; fi
tacren sim1/mask_myocardium.tac 0 myocardium from image
tacren sim1/mask_heart.tac 0 heart from image
tacren sim1/mask_cavity.tac 0 cavity from image
tac2svg -legend=y -mt="" sim1/tacs.svg sim1/plasma.tac sim1/tissue.tac sim1/mask_cavity.tac sim1/mask_myocardium.tac sim1/mask_heart.tac
if [ $? -ne 0 ] ; then printf "Failed!\n" ; exit 1 ; fi
printf "=====================================================================\n"
printf "Do not use simulated image but just mix blood and tissue \n"
printf "=====================================================================\n"
taccalc sim1/tissue.tac x 0.9 sim1/temp1.tac
taccalc sim1/plasma.tac x 0.1 sim1/temp2.tac
taccalc sim1/temp1.tac + sim1/temp2.tac sim1/mix09.tac
tacren sim1/mix09.tac 0 m90b10
taccalc sim1/tissue.tac x 0.8 sim1/temp1.tac
taccalc sim1/plasma.tac x 0.2 sim1/temp2.tac
taccalc sim1/temp1.tac + sim1/temp2.tac sim1/mix08.tac
tacren sim1/mix08.tac 0 m80b20
taccalc sim1/tissue.tac x 0.7 sim1/temp1.tac
taccalc sim1/plasma.tac x 0.3 sim1/temp2.tac
taccalc sim1/temp1.tac + sim1/temp2.tac sim1/mix07.tac
tacren sim1/mix07.tac 0 m70b30
taccalc sim1/tissue.tac x 0.6 sim1/temp1.tac
taccalc sim1/plasma.tac x 0.4 sim1/temp2.tac
taccalc sim1/temp1.tac + sim1/temp2.tac sim1/mix06.tac
tacren sim1/mix06.tac 0 m60b40
taccalc sim1/tissue.tac x 0.5 sim1/temp1.tac
taccalc sim1/plasma.tac x 0.5 sim1/temp2.tac
taccalc sim1/temp1.tac + sim1/temp2.tac sim1/mix05.tac
tacren sim1/mix05.tac 0 m50b50
taccalc sim1/tissue.tac x 0.4 sim1/temp1.tac
taccalc sim1/plasma.tac x 0.6 sim1/temp2.tac
taccalc sim1/temp1.tac + sim1/temp2.tac sim1/mix04.tac
tacren sim1/mix04.tac 0 m40b60
taccalc sim1/tissue.tac x 0.3 sim1/temp1.tac
taccalc sim1/plasma.tac x 0.7 sim1/temp2.tac
taccalc sim1/temp1.tac + sim1/temp2.tac sim1/mix03.tac
tacren sim1/mix03.tac 0 m30b70
taccalc sim1/tissue.tac x 0.2 sim1/temp1.tac
taccalc sim1/plasma.tac x 0.8 sim1/temp2.tac
taccalc sim1/temp1.tac + sim1/temp2.tac sim1/mix02.tac
tacren sim1/mix02.tac 0 m20b80
taccalc sim1/tissue.tac x 0.1 sim1/temp1.tac
taccalc sim1/plasma.tac x 0.9 sim1/temp2.tac
taccalc sim1/temp1.tac + sim1/temp2.tac sim1/mix01.tac
tacren sim1/mix01.tac 0 m10b90
tacadd sim1/mixed.tac sim1/mix0?.tac sim1/tissue.tac
if [ $? -ne 0 ] ; then printf "Failed!\n" ; exit 1 ; fi
tacren sim1/mixed.tac 10 m100
tac2svg -legend=y -mt="" sim1/mixed.svg sim1/mixed.tac
if [ $? -ne 0 ] ; then printf "Failed!\n" ; exit 1 ; fi
patlak -svg=sim1/mixed_patlak.svg -sd=no sim1/mixed.tac sim1/plasma.tac 10 60 sim1/mixed_patlak.res
if [ $? -ne 0 ] ; then printf "Failed!\n" ; exit 1 ; fi
printf "\n===================================================================\n"
printf " All passed! \n"
printf "===================================================================\n"
exit 0
This source diff could not be displayed because it is too large. You can view the blob instead.
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