View source: R/kinfitr_bloodfuncs.R
shift_timings_df | R Documentation |
This function sorts out all the time shifting of the input and TACs so that they are in the
same time. This function makes several 'editorial decisions'. i) If the TACs are shifted positively, all frames
will be shifted positively, but the time=0 frame will remain at time=0, i.e. there are no extra frames added.
Shifting of the TAC only occurs if the input is shifted negatively (and can be turned off using shifttac=F
).
ii) If the input is shifted, and is subsequently shorter than the TAC, an extra measurement will be
added at max(t_tac)
with the same value as the last measurement. iii) If the input is shifted positively,
all interpolated times will be shifted by the specified amount, but an extra measurement is added at time=0 of
0,0,1 for blood, plasma and parent fraction respectively (followed by interpolation into 6000 equally spaced time
intervals in the new time window) i.e. not the same process as for the TACs: I figure that since the blood changes
so quickly, this is likely more close to the true kinetics. Get in touch if you have suggestions for this.
shift_timings_df(t_tac, tacsdf, input, inpshift, shifttac = T)
t_tac |
Numeric vector of times for each frame in minutes. We use the time halfway through the frame as well as a zero. If a time zero frame is not included, it will be added. |
tacsdf |
Dataframe of radioactivity concentrations in the target tissues for each frame in wide format, i.e. each TAC should be a column. We include zero at time zero: if not included, it is added. |
input |
Data frame containing the blood, plasma, and parent fraction concentrations over time. This can be generated
using the |
inpshift |
The number of minutes by which the times of the input data frame should be adjusted. |
shifttac |
Optional. Can the TACs be shifted. If the input is shifted negatively, it will then
contain negative time values. If |
Function to shift backwards and forwards the timings of the TAC vector and input data frame
to make them consistent. Similar to shift_timings
but for a dataframe of TACs.
A list containing the following after time shifting: the times of the TACs out$t_tac
,
the TACs out$tacdf
, the input dataframe out$input
, the interpolated time out$interptime
(which is the same as the time in the input dataframe), and the interpolated TACs out$i_tacdf
.
Granville J Matheson, mathesong@gmail.com
## Not run:
inpshift <- 0.25 # 15 seconds
newValues <- shift_timings(t_tac, tac, input, inpshift)
t_tac <- newValues$t_tac
tac <- newValues$tac
input <- newValues$input
## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.