########## 1. Set Working Directory to Download Folder ########## rm(list = ls()) setwd("~/Downloads") ########## 2. Load DCE file ########## DCE <- read.table(file="DCEraw.txt", header=T, sep="\t") DCE <- DCE[,1:2] ########## 3. Calculate DCE Parameters ########## tr <- DCE[3,1] - DCE[2,1] # Temporal Resolution ttp <- which.max(DCE[,2])*tr # Time To Peak auc <- sum(DCE[,2]*tr) # Area under the Curve washout <- (max(DCE[,2])-DCE[(nrow(DCE)),2])/max(DCE[,2]) # Washout pe <- max(DCE[,2]) # Peak Enhancement ########## 4. Combine Parameters into Data Table and Save ########## Parameter <- data.frame(TR=tr, AUC=auc, PE=pe, TTP=ttp, Washout=washout) ########## 5. Inspect the Results ########## View(Parameter) ########## 6. Save the Results (optional) ########## write.table(data, file="Results.csv", row.names=F, col.names=T, sep=",")