Skip to content

Commit 9bf8da7

Browse files
authored
Merge pull request #37 from mathesong/fix_patlak_plot_labels
Small bug with including a region name in patlak plot fits
2 parents 6783acc + cda4013 commit 9bf8da7

File tree

1 file changed

+4
-12
lines changed

1 file changed

+4
-12
lines changed

R/kinfitr_patlakplot.R

Lines changed: 4 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,9 @@
1111
#' @param input Data frame containing the blood, plasma, and parent fraction
1212
#' concentrations over time. This can be generated using the
1313
#' \code{blood_interp} function.
14-
#' @param tstar The t* specification for regression. If tstar_type="frames",
14+
#' @param tstar The t* specification for regression. If tstar_type="frames",
1515
#' this is the number of frames from the end to include (e.g., 10 means last 10 frames).
16-
#' If tstar_type="time", this is the time point (in minutes) after which all frames
16+
#' If tstar_type="time", this is the time point (in minutes) after which all frames
1717
#' with midpoints later than this time are included. This value can be estimated using \code{Patlak_tstar}.
1818
#' @param tstar_type Either "frames" (default) or "time", specifying how to interpret tstar.
1919
#' @param tstarIncludedFrames Deprecated. Use 'tstar' with 'tstar_type="frames"' instead.
@@ -71,7 +71,7 @@ Patlakplot <- function(t_tac, tac, input, tstar, weights = NULL,
7171

7272
# Convert timeStartEnd to frameStartEnd if needed
7373
if (is.null(frameStartEnd) && !is.null(timeStartEnd)) {
74-
frameStartEnd <- c(which(t_tac >= timeStartEnd[1])[1],
74+
frameStartEnd <- c(which(t_tac >= timeStartEnd[1])[1],
7575
tail(which(t_tac <= timeStartEnd[2]), 1))
7676
}
7777

@@ -219,14 +219,6 @@ plot_Patlakfit <- function(patlakout, roiname = NULL) {
219219
Equilibrium = as.character("Before")
220220
)
221221

222-
if (is.null(roiname)) {
223-
roiname <- "ROI"
224-
}
225-
226-
if (roiname != "ROI") {
227-
plotdf <- dplyr::rename(plotdf, !!roiname := ROI_measured)
228-
}
229-
230222
plotdf$Equilibrium <- as.character(plotdf$Equilibrium)
231223
plotdf$Equilibrium [ (nrow(plotdf) - (patlakout$tstarIncludedFrames - 1)):nrow(plotdf) ] <- "After"
232224

@@ -300,7 +292,7 @@ plot_Patlakfit <- function(patlakout, roiname = NULL) {
300292
Patlak_tstar <- function(t_tac, lowroi, medroi, highroi, input, filename = NULL, inpshift = 0, vB = 0, frameStartEnd = NULL, timeStartEnd = NULL, gridbreaks = 2) {
301293
# Convert timeStartEnd to frameStartEnd if needed
302294
if (is.null(frameStartEnd) && !is.null(timeStartEnd)) {
303-
frameStartEnd <- c(which(t_tac >= timeStartEnd[1])[1],
295+
frameStartEnd <- c(which(t_tac >= timeStartEnd[1])[1],
304296
tail(which(t_tac <= timeStartEnd[2]), 1))
305297
}
306298

0 commit comments

Comments
 (0)