Last data update: 2014.03.03

R: Compress a MRIaggr object
constCompressMRIaggrR Documentation

Compress a MRIaggr object

Description

Generate from an existing MRIaggr object a new one with lower spatial resolution.

Usage

## S4 method for signature 'MRIaggr'
constCompressMRIaggr(object, compression.factor, param = NULL,
         mask = NULL, threshold = 0.49, verbose = optionsMRIaggr("verbose"))

Arguments

object

an object of class MRIaggr. REQUIRED.

compression.factor

the compression factor. postive integer. REQUIRED.

param

the contrast parameters to load in the new MRIaggr object. character vector or NULL.

mask

the binary contrast parameter(s). character vector.

threshold

the value above which the local mean of the binary parameters is assigned to 1 (and otherwise to 0). numeric between 0 and 1.

verbose

should the execution of the function be traced ? logical.

Details

ARGUMENTS:
Information about the param argument can be found in the details section of initParameter.

FUNCTION:
The fonction uses a local mean to compress the initial parameters maps to a lower resolution.

Value

a MRIaggr object.

Examples

## load a MRIaggr object
data("MRIaggr.Pat1_red", package = "MRIaggr")
 
## compress the MRIaggr object
MRIaggr.compressed <- constCompressMRIaggr(MRIaggr.Pat1_red, compression.factor = 2,
                                           param = c("DWI_t0","T2_FLAIR_t2","MASK_T2_FLAIR_t2"),
                                           mask = "MASK_T2_FLAIR_t2") 

## display
par(mfrow = c(2,4), mar = rep(1.75,4), mgp = c(2,0.75,0))
multiplot(MRIaggr.Pat1_red, param = "DWI_t0", window = NULL, breaks = seq(0,350,1),
             midplane = TRUE, main = "before - slice ")
multiplot(MRIaggr.compressed, param = "DWI_t0", window = NULL, breaks = seq(0,350,1),
             midplane = TRUE, main = "after - slice ")

multiplot(MRIaggr.Pat1_red, param = "MASK_T2_FLAIR_t2", main = "before - slice ")
multiplot(MRIaggr.compressed, param = "MASK_T2_FLAIR_t2", main = "after - slice ")

Results


R version 3.3.1 (2016-06-21) -- "Bug in Your Hair"
Copyright (C) 2016 The R Foundation for Statistical Computing
Platform: x86_64-pc-linux-gnu (64-bit)

R is free software and comes with ABSOLUTELY NO WARRANTY.
You are welcome to redistribute it under certain conditions.
Type 'license()' or 'licence()' for distribution details.

R is a collaborative project with many contributors.
Type 'contributors()' for more information and
'citation()' on how to cite R or R packages in publications.

Type 'demo()' for some demos, 'help()' for on-line help, or
'help.start()' for an HTML browser interface to help.
Type 'q()' to quit R.

> library(MRIaggr)
Loading required package: Rcpp
> png(filename="/home/ddbj/snapshot/RGM3/R_CC/result/MRIaggr/MRIaggr-constCompressMRIaggr.Rd_%03d_medium.png", width=480, height=480)
> ### Name: constCompressMRIaggr
> ### Title: Compress a MRIaggr object
> ### Aliases: constCompressMRIaggr constCompressMRIaggr,MRIaggr-method
> ### Keywords: methods
> 
> ### ** Examples
> 
> ## load a MRIaggr object
> data("MRIaggr.Pat1_red", package = "MRIaggr")
>  
> ## compress the MRIaggr object
> MRIaggr.compressed <- constCompressMRIaggr(MRIaggr.Pat1_red, compression.factor = 2,
+                                            param = c("DWI_t0","T2_FLAIR_t2","MASK_T2_FLAIR_t2"),
+                                            mask = "MASK_T2_FLAIR_t2") 
slice : 1 2 3 
constCompressMRIaggr[MRIaggr] : MRIaggr has been compressed from (x, y) = 78 100
                                                              to (x, y) = 39 50
> 
> ## display
> par(mfrow = c(2,4), mar = rep(1.75,4), mgp = c(2,0.75,0))
> multiplot(MRIaggr.Pat1_red, param = "DWI_t0", window = NULL, breaks = seq(0,350,1),
+              midplane = TRUE, main = "before - slice ")
> multiplot(MRIaggr.compressed, param = "DWI_t0", window = NULL, breaks = seq(0,350,1),
+              midplane = TRUE, main = "after - slice ")
> 
> multiplot(MRIaggr.Pat1_red, param = "MASK_T2_FLAIR_t2", main = "before - slice ")
> multiplot(MRIaggr.compressed, param = "MASK_T2_FLAIR_t2", main = "after - slice ")
> 
> 
> 
> 
> 
> dev.off()
null device 
          1 
>