Type: Package
Title: Plot and Analyse Time-Intensity Data
Version: 1.1.0
Maintainer: Samuel James Tingle <samjamestingle@gmail.com>
Description: Plots and analyzes time-intensity curve data, such as data from (contrast-enhanced) ultrasound. Values such as peak intensity, time to peak, area under the curve, wash in rate and wash out rate are calculated.
License: MIT + file LICENSE
Encoding: UTF-8
RoxygenNote: 7.3.3
URL: https://github.com/sjtingle/tican
BugReports: https://github.com/sjtingle/tican/issues
Suggests: knitr, rmarkdown
VignetteBuilder: knitr
NeedsCompilation: no
Packaged: 2025-11-09 20:45:14 UTC; samueltingle
Author: Samuel James Tingle [aut, cre]
Repository: CRAN
Date/Publication: 2025-11-09 21:10:02 UTC

Plot and analyse time-intensity data

Description

This function plots and analyzes time-intensity data, such as data from (contrast-enhanced) ultrasound cineloops. Peak intensity and time to peak intensity are calculated from a smoothed curve through the data (loess smoother). Area under the curve is calculated from the raw data using the trapezium method for integration. Time to peak proportion (for example time to 90 percent of peak) can also be calculated. If selected, WiR (wash in rate) is the maximum upslope before the peak value. If selected, WoR (wash out rate) is the absolute value of the maximum downslope following the peak value (with larger values representing higher wash out rate). Both WiR and WoR are calculated based on the slope of the LOESS curve, as they are sensitive to noise in the raw data.

Usage

tic_analyse(
  data,
  timevar,
  intensityvar,
  loess.span = 0.1,
  AUCmax = NULL,
  peakproportion = NULL,
  calc_wir = FALSE,
  calc_wor = FALSE,
  plotresult = TRUE,
  ...
)

Arguments

data

A dataframe with time and intensity values as columns.

timevar

A character string (in quotes) with the dataframe column name for the time variable.

intensityvar

A character string (in quotes) with dataframe column name for the intensity variable.

loess.span

A number between 0 and 1, with larger values resulting in a smoother curve.

AUCmax

A number - the maximum time that area under the curve is measured until.

peakproportion

A number between 0 and 1 which is used in the time to peak proportion calculations.

calc_wir

TRUE or FALSE to determine whether WiR is calculated.

calc_wor

TRUE or FALSE to determine whether WoR is calculated.

plotresult

TRUE or FALSE to determine whether a plot of the results is generated.

...

Additional arguments to be passed into the loess() function.

Details

Blue dashed lines represent peak and time to peak values. If selected, solid purple lines represent WiR and WoR, and dashed green lines represent time to peak proportion.

A plot of the data is generated and a dataframe with the results is returned.

Value

A dataframe with the results. Depending on the plotresult argument can also return a plot of the smoothed curve.

Examples


# Example usage: Please see package vignettes on CRAN


Return area under curve from time-intensity data

Description

This function returns area under curve from raw time intensity curves using the trapezoid method. It is recommended that plotresult is set to TRUE in the first instance to visually confirm the analysis.

Usage

tic_auc(data, timevar, intensityvar, AUCmax = NULL, plotresult = FALSE)

Arguments

data

A dataframe with time and intensity values as columns.

timevar

A character string (in quotes) with the dataframe column name for the time variable.

intensityvar

A character string (in quotes) with dataframe column name for the intensity variable.

AUCmax

A number - the maximum time that area under the curve is measured until.

plotresult

TRUE or FALSE to determine whether a plot of the results is generated.

Details

A plot of the data is generated and a dataframe with the results is returned.

Value

Area under the curve. Depending on the plotresult argument can also return a plot of the raw data.

Examples


# Example usage: Please see package vignettes on CRAN


Return wash in rate from time-intensity data

Description

This function returns the wash in rate from time-intensity curve data. Raw data is smoothed using a loess smoother. Wash in rate is calculated as the maximum upward slope of the loess curve before peak intensity is reached. It is recommended that plotresult is set to TRUE in the first instance to visually confirm the analysis.

Usage

tic_wir(data, timevar, intensityvar, loess.span = 0.1, plotresult = FALSE, ...)

Arguments

data

A dataframe with time and intensity values as columns.

timevar

A character string (in quotes) with the dataframe column name for the time variable.

intensityvar

A character string (in quotes) with dataframe column name for the intensity variable.

loess.span

A number between 0 and 1, with larger values resulting in a smoother curve.

plotresult

TRUE or FALSE to determine whether a plot of the results is generated.

...

Additional arguments to be passed into the loess() function.

Value

The wash in rate. Depending on the plotresult argument can also return a plot of the smoothed curve with the calculated slope shown.

Examples


# Example usage: Please see package vignettes on CRAN


Return wash out rate from time-intensity data

Description

This function returns the wash out rate from time-intensity curve data. Raw data is smoothed using a loess smoother. Wash out rate is calculated as the absolute value of the most negative slope of the loess curve after peak intensity is reached. A higher number therefore refers to faster washout. It is recommended that plotresult is set to TRUE in the first instance to visually confirm the analysis.

Usage

tic_wor(data, timevar, intensityvar, loess.span = 0.1, plotresult = FALSE, ...)

Arguments

data

A dataframe with time and intensity values as columns.

timevar

A character string (in quotes) with the dataframe column name for the time variable.

intensityvar

A character string (in quotes) with dataframe column name for the intensity variable.

loess.span

A number between 0 and 1, with larger values resulting in a smoother curve.

plotresult

TRUE or FALSE to determine whether a plot of the results is generated.

...

Additional arguments to be passed into the loess() function.

Value

The wash out rate (negative slope). If plotresult=TRUE also draws a plot.

Examples


# Example usage: Please see package vignettes on CRAN


Return time to peak from time-intensity data

Description

This function returns the time to peak from time-intensity curve data. Raw data is smoothed using a loess smoother, and the time of peak is returned. Time to a specified proportion of the peak (e.g. time to 90% of peak) can be calculated. It is recommended that plotresult is set to TRUE in the first instance to visually confirm the analysis.

Usage

ttpeak(
  data,
  timevar,
  intensityvar,
  loess.span = 0.1,
  peakproportion = NULL,
  plotresult = FALSE,
  ...
)

Arguments

data

A dataframe with time and intensity values as columns.

timevar

A character string (in quotes) with the dataframe column name for the time variable.

intensityvar

A character string (in quotes) with dataframe column name for the intensity variable.

loess.span

A number between 0 and 1, with larger values resulting in a smoother curve.

peakproportion

A number between 0 and 1 which is used in the time to peak proportion calculations. If a number is entered the function will return the time to peak proportion.

plotresult

TRUE or FALSE to determine whether a plot of the results is generated.

...

Additional arguments to be passed into the loess() function.

Value

The time at which the loess curve is at its peak. Depending on the plotresult argument can also return a plot of the smoothed curve.

Examples


# Example usage: Please see package vignettes on CRAN