InputOutput-constMRIaggr: Array constructor for MRIaggr object

Description Usage Arguments Details Value Examples

Description

Construct a MRIaggr object from a list of array, each array corresponding to a different contrast parameters.

Usage

1
2
3
constMRIaggr(ls.array, identifier, param, default_value = NULL,
     pos_default_value = c(1,1,1), tol = 10^{-10},
	 voxelDim = NULL, verbose = optionsMRIaggr("verbose"), rm.ls.array = FALSE)

Arguments

ls.array

the value of the contrast parameter(s) for each observation. list of array. REQUIRED.

identifier

the identifier of the patient to which belong the contrast parameters. character. REQUIRED.

param

the contrast parameter(s). character vector or NULL. REQUIRED.

default_value

the reference values of the contrast parameters (e.g. the background value). character or NULL leading to search the reference value in array[pos_default_value].

pos_default_value

the coordinates of the observations that contains the reference value. numeric vector.

tol

numeric precision for the consistency check. positive numeric.

voxelDim

the voxel size with its unit of measure. A four columns data.frame with names "i", "j", "k" and "unit".

verbose

should the execution of the function be traced ? logical.

rm.ls.array

should the object on which the ls.array argument points be removed form the global environment ? logical.

Details

ARGUMENTS:
All the array in ls.array in must have the same dimensions.

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

pos_default_value is active only if default_value is set to NULL.

Value

a MRIaggr object.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
#### 1- 1st method ####
## load NIFTI files
path.Pat1 <- system.file(file.path("nifti"), package = "MRIaggr")

nifti.Pat1_TTP_t0 <- readMRI(file.path(path.Pat1, "TTP_t0"), format = "nifti")
nifti.Pat1_DWI_t0 <- readMRI(file.path(path.Pat1, "DWI_t0"), format = "nifti")
nifti.Pat1_MASK_DWI_t0 <- readMRI(file.path(path.Pat1, "MASK_DWI_t0"), format = "nifti")
nifti.Pat1_MASK_T2_FLAIR_t2 <- readMRI(file.path(path.Pat1, "MASK_T2_FLAIR_t2"), 
                                       format = "nifti")

## convert them to MRIaggr
MRIaggr.Pat1 <- constMRIaggr(list(nifti.Pat1_TTP_t0, nifti.Pat1_DWI_t0,
                                  nifti.Pat1_MASK_DWI_t0, nifti.Pat1_MASK_T2_FLAIR_t2),
                identifier= "Pat1", param=c("TTP_t0","DWI_t0","MASK_DWI_t0","MASK_T2_FLAIR_t2"))


#### 2- 2nd method ####
## load nifti files
param <- c("DWI_t0.nii","MASK_DWI_t0.nii","MTT_t0.nii","TTP_t0.nii","T1_t0.nii","T2_GRE_t0.nii",
           "MTT_t1.nii","TTP_t1.nii","T2_FLAIR_t2.nii","MASK_T2_FLAIR_t2.nii")

ls.array <- list()
for(iter_param in 1:length(param)){
  ls.array[[iter_param]] <- readMRI(file.path(path.Pat1,param[iter_param]), format = "nifti")
}

## convert them to MRIaggr
param <- gsub(".nii", "", param)

MRIaggr.Pat1 <- constMRIaggr(ls.array, identifier = "Pat1", param = param)

#### additionnal examples
## Not run: 
## load an analyse file (example of oro.nifti::readANALYZE)
path.Pat2 <- system.file("anlz", package = "oro.nifti")
analyse.avg <- readMRI(file.path(path.Pat2, "avg152T1.img.gz"), format = "analyze")
MRIaggr.Pat2 <- constMRIaggr(analyse.avg, param = "avg", identifier = "Pat2")

# display
multiplot(MRIaggr.Pat2, param = "avg",
          mfrow = c(4,6), axes = FALSE, main = "",
          mar = c(0,0,0.75,0), mar.legend = c(0,0,1,0))
		  
### load a nifti file (example of oro.nifti::readNIfTI)
path.Pat3 <- system.file("nifti", package = "oro.nifti")
nifti.ffd <- readMRI(file.path(path.Pat3, "filtered_func_data.nii.gz"), format = "nifti")
MRIaggr.Pat3 <- constMRIaggr(lapply(1:dim(nifti.ffd)[4], 
                                    function(x){nifti.ffd[,,,x, drop = FALSE]}),
             param=paste("ffd", 1:dim(nifti.ffd)[4], sep = "_"), identifier = "Pat3")

# display
multiplot(MRIaggr.Pat3, param = "ffd_1")

## load a dicom file (examples of oro.dicom::readDICOMFile)
path.Pat4 <- system.file("dcm", package = "oro.dicom")
dicom.Abdo <- readMRI(file.path(path.Pat4, "Abdo.dcm"), format = "dicom")
path.Pat4 <- constMRIaggr(dicom.Abdo, param = "Abdo",identifier = "Pat4")

# display
multiplot(path.Pat4, param = "Abdo")
multiplot(path.Pat4, xlim = c(100, 200), param = "Abdo")


## End(Not run)

bozenne/MRIaggr documentation built on May 13, 2019, 1:39 a.m.