Learn R Programming

MRIaggr (version 1.1.5)

calcTableHypoReperf: Compute reperfusion and hypoperfusion tables

Description

Compute of the reperfusion and hypoperfusion values.

Usage

"calcTableHypoReperf"(object, param, timepoint, threshold = 1:10, sep = "_", norm_mu = FALSE, norm_sigma = FALSE, mask = NULL, numeric2logical = FALSE, param.update = "reperf", verbose = optionsMRIaggr("verbose"), update.object = FALSE, overwrite = FALSE)

Arguments

object
an object of class MRIaggr. REQUIRED.
param
the perfusion parameter(s). character vector. REQUIRED.
timepoint
one or two time points. character vector. REQUIRED.
threshold
the value of the hypoperfusion thresholds. numeric vector.
sep
the separator between the parameter names and the time points. character.
mask
the binary contrast parameter indentifing the lesion at timepoint[1]. character or NULL if no mask is available.
numeric2logical
should mask be converted to logical ? logical.
norm_mu
the type of centering to apply on the parameter values. character.
norm_sigma
the type of scaling to apply on the parameter values. character.
verbose
should the execution of the function be traced ? logical.
param.update
which type of parameter should be stored in the object ? Any of "shift" "reperf" "reperf_pc" "deperf" "deperf_pc".
update.object
should the resulting values be stored in object ? logical.
overwrite
if reperfusion or hypoperfusion values are already stored in object@table_reperfusion or object@table_hypofusion, can they be overwritten ? logical.

Value

An list containing :
  • [[voxel]] : a data.frame containing the coordinates and the reperfusion values.
  • [[volume_hypo]] : the number of hypoperfused observations for the various thresholds.
  • [[volume_reperf]] : the number of reperfused observations for the various thresholds.

Details

ARGUMENTS: Information about the norm_mu and norm_sigma arguments can be found in the details section of selectContrast.

FUNCTION: If mask is set to NULL, no mismatch volume will not be computed.

See Also

calcThresholdMRIaggr to process contrast parameters. selectTable to select the reperfusion/hypoperfusion tables. calcW to compute the neighboring matrix.

Examples

Run this code
## load a MRIaggr object
data("MRIaggr.Pat1_red", package = "MRIaggr")

#### 1- directly ####
res <- calcTableHypoReperf(MRIaggr.Pat1_red, param = c("TTP","MTT"), timepoint=c("t0","t1"),
     mask="MASK_DWI_t0", numeric2logical = TRUE,
     update.object = TRUE, overwrite = TRUE)

carto_TTP_t0 <- selectContrast(MRIaggr.Pat1_red, param = "TTP_t0")
carto_TTP_t1 <- selectContrast(MRIaggr.Pat1_red, param = "TTP_t1")

## hypoperfusion
sum( (carto_TTP_t0 >= 4) )
selectTable(MRIaggr.Pat1_red, "hypoperfusion")["4","Vhypo.TTP_t0"]

## mismatch
testN <- (selectContrast(MRIaggr.Pat1_red, param = "MASK_DWI_t0") == 0)

sum( (carto_TTP_t0 >= 4) * testN )
selectTable(MRIaggr.Pat1_red, "hypoperfusion")["4","Vmismatch.TTP"]

sum( (carto_TTP_t0 >= 4) * testN ) / sum( testN == FALSE )
selectTable(MRIaggr.Pat1_red, "hypoperfusion")["4","PCmismatch.TTP"]


## reperfusion
sum((carto_TTP_t0 >= 4) * (carto_TTP_t1 < 4))
selectTable(MRIaggr.Pat1_red, "reperfusion")["4","Vreperf.TTP"]

sum((carto_TTP_t0 >= 4) * (carto_TTP_t1 < 4)) / sum( (carto_TTP_t0>=4) )
selectTable(MRIaggr.Pat1_red, "reperfusion")["4","PCreperf.TTP"]

## W reperfusion
carto_TTPth_t0 <- carto_TTP_t0
carto_TTPth_t0[carto_TTPth_t0 > 10] <- 10
carto_TTPth_t0[carto_TTPth_t0 < 0] <- 0

carto_TTPth_t1 <- carto_TTP_t1
carto_TTPth_t1[carto_TTP_t1 > 10] <- 10
carto_TTPth_t1[carto_TTP_t1 < 0] <- 0

weight <- (carto_TTPth_t0 - carto_TTPth_t1) / carto_TTPth_t0
weight[ ((carto_TTPth_t0 == 0) + (carto_TTP_t0 < 4) + (carto_TTP_t1 >= 4)) > 0 ] <- 0

sum((carto_TTP_t0 >= 4) * (carto_TTP_t1 < 4) * weight)
selectTable(MRIaggr.Pat1_red, "reperfusion")["4","VreperfW.TTP"]

sum((carto_TTP_t0 >= 4) * (carto_TTP_t1 < 4) * weight) / sum( (carto_TTP_t0 >= 4) )
selectTable(MRIaggr.Pat1_red, "reperfusion")["4","PCreperfW.TTP"]


## deperfusion
sum((carto_TTP_t0 < 4) * (carto_TTP_t1 >= 4))
selectTable(MRIaggr.Pat1_red, "reperfusion")["4","Vdeperf.TTP"]

sum((carto_TTP_t0 < 4) * (carto_TTP_t1 >= 4)) / sum( (carto_TTP_t0 >= 4) )
selectTable(MRIaggr.Pat1_red, "reperfusion")["4","PCdeperf.TTP"]

## shift
sum((carto_TTPth_t0 - carto_TTPth_t1 >= 4))
selectTable(MRIaggr.Pat1_red, "reperfusion")["4","Vshift_reperf.TTP"]

sum((carto_TTPth_t0-carto_TTPth_t1 >= 4)) / sum( (carto_TTP_t0>=4) )
selectTable(MRIaggr.Pat1_red, "reperfusion")["4","PCshift_reperf.TTP"]

#### 2- via calcThresholdMRIaggr ####
## perform segmentation  (call mritc)
## Not run: 
# calcThresholdMRIaggr(MRIaggr.Pat1_red, param = c("TTP_t0","MTT_t0","TTP_t1","MTT_t1"),
#          threshold=1:10, name_newparam = c("TTP.GR_t0","MTT.GR_t0","TTP.GR_t1","MTT.GR_t1"),
#          rm.CSF=TRUE, hemisphere = "lesion",
#          GRalgo=TRUE, seed = c("MASK_T2_FLAIR_t2","MASK_DWI_t0"), W.range  = sqrt(2),
#          update.object = TRUE, overwrite = TRUE)
# 
# res <- calcTableHypoReperf(MRIaggr.Pat1_red, param = c("TTP.GR","MTT.GR"),
#          timepoint = c("t0","t1"), mask = "MASK_DWI_t0", numeric2logical = TRUE,
#          update.object = TRUE, overwrite = TRUE)
# 		 
# ## display
# selectTable(MRIaggr.Pat1_red, "hypoperfusion")["4","Vhypo.TTP.GR_t0"]
# 
# par(mfrow = c(2,4), mar = rep(1.5,4), mgp = c(2,0.5,0))
# multiplot(MRIaggr.Pat1_red, param = "TTP_t0", num = 1:3,
#              palette = rainbow(10), window = NULL, main = "raw - slice ", 
# 			 breaks=(0:10)-10^{-10})
# multiplot(MRIaggr.Pat1_red, param = "TTP.GR_t0", num = 1:3,
#              palette = rainbow(10), window = NULL, main = "GR - slice ", 
# 			 breaks=(0:10)-10^{-10})
# ## End(Not run)

Run the code above in your browser using DataLab