Last data update: 2014.03.03

R: Allocate the position of the mid-saggital plan
allocHemisphereR Documentation

Allocate the position of the mid-saggital plan

Description

Allocate information about the position of the mid-saggital plan to a MRIaggr object.

Usage

## S4 replacement method for signature 'MRIaggr'
allocHemisphere(object, 
         overwrite = FALSE, verbose = optionsMRIaggr("verbose")) <- value

Arguments

object

an object of class MRIaggr. REQUIRED.

value

a list of data.frame. Names must be among "midplane", "hemispheres" "data". See the Details section. REQUIRED.

overwrite

if the characteristics of a mid-saggital plan are already stored in object, can they be overwritten ? logical.

verbose

should the execution of the function be traced ? logical.

Details

ARGUMENTS:
The "midplane" element indicates the position of the observations of the mid-saggital plan. It has to be a two columns data.frame with the coordinates ("i","j") in columns and the observations in rows.

The "data" element must contains the position of each voxel with respect to the mid-sagittal plan (column "i_hemisphere" and "j_hemisphere") the hemisphere ("left", "right" or "undefined") to which the voxel belongs (column "hemisphere").

The "hemispheres" element indicates in which hemisphere is the lesion (denoted by "lesion"). The others hemispheries are denoted by "contralateral". It has to be a one line two columns data.frame with names "left" "right".

Value

None.

See Also

calcHemisphere to obtain the position of the mid-saggital plan and the position of the lesion in the hemispheres.
selectParameter to extract the previous elements.

Examples

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

## automatic allocation
resHemi <- calcHemisphere(MRIaggr.Pat1_red, param = "T2_GRE_t0", gridSearch = FALSE, num = 1,
                          update.object = TRUE, overwrite = TRUE)

## manual allocation
allocHemisphere(MRIaggr.Pat1_red, overwrite = TRUE) <- list(midplane = resHemi$midplane,
                                                            data = resHemi$data)

## display
index1 <- data.frame(selectMidplane(MRIaggr.Pat1_red), 15)
names(index1) <- c("i","j","k")
multiplot(MRIaggr.Pat1_red, param = "T2_GRE_t0", num = 1, midplane = TRUE, window = FALSE,
             index1 = list(coords = index1, pch = 20, cex = 2, col = "purple")
             
)

selectMidplane(MRIaggr.Pat1_red)
selectHemispheres(MRIaggr.Pat1_red)

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-allocHemisphere.Rd_%03d_medium.png", width=480, height=480)
> ### Name: allocHemisphere
> ### Title: Allocate the position of the mid-saggital plan
> ### Aliases: allocHemisphere<- allocHemisphere<-,MRIaggr-method
> ### Keywords: methods
> 
> ### ** Examples
> 
> ## load a MRIaggr object
> data("MRIaggr.Pat1_red", package = "MRIaggr")
> 
> ## automatic allocation
> resHemi <- calcHemisphere(MRIaggr.Pat1_red, param = "T2_GRE_t0", gridSearch = FALSE, num = 1,
+                           update.object = TRUE, overwrite = TRUE)
Nelder-Mead with optim 
allocContrast[MRIaggr] : Cartographies "i_hemisphere" "j_hemisphere" "hemisphere" 
                         have been updated 
allocHemisphere[MRIaggr] : @midplane has been updated
 allocHemisphere[MRIaggr] : @hemispheres has been updated
 > 
> ## manual allocation
> allocHemisphere(MRIaggr.Pat1_red, overwrite = TRUE) <- list(midplane = resHemi$midplane,
+                                                             data = resHemi$data)
allocContrast[MRIaggr] : Cartographies "i_hemisphere" "j_hemisphere" "hemisphere" 
                         have been updated 
allocHemisphere[MRIaggr] : @midplane has been updated
 > 
> ## display
> index1 <- data.frame(selectMidplane(MRIaggr.Pat1_red), 15)
> names(index1) <- c("i","j","k")
> multiplot(MRIaggr.Pat1_red, param = "T2_GRE_t0", num = 1, midplane = TRUE, window = FALSE,
+              index1 = list(coords = index1, pch = 20, cex = 2, col = "purple")
+              
+ )
> 
> selectMidplane(MRIaggr.Pat1_red)
           i        j
1   38.84687  6.00000
2   38.87559  6.89899
3   38.90431  7.79798
4   38.93303  8.69697
5   38.96175  9.59596
6   38.99047 10.49495
7   39.01919 11.39394
8   39.04792 12.29293
9   39.07664 13.19192
10  39.10536 14.09091
11  39.13408 14.98990
12  39.16280 15.88889
13  39.19152 16.78788
14  39.22024 17.68687
15  39.24896 18.58586
16  39.27768 19.48485
17  39.30640 20.38384
18  39.33513 21.28283
19  39.36385 22.18182
20  39.39257 23.08081
21  39.42129 23.97980
22  39.45001 24.87879
23  39.47873 25.77778
24  39.50745 26.67677
25  39.53617 27.57576
26  39.56489 28.47475
27  39.59361 29.37374
28  39.62233 30.27273
29  39.65106 31.17172
30  39.67978 32.07071
31  39.70850 32.96970
32  39.73722 33.86869
33  39.76594 34.76768
34  39.79466 35.66667
35  39.82338 36.56566
36  39.85210 37.46465
37  39.88082 38.36364
38  39.90954 39.26263
39  39.93827 40.16162
40  39.96699 41.06061
41  39.99571 41.95960
42  40.02443 42.85859
43  40.05315 43.75758
44  40.08187 44.65657
45  40.11059 45.55556
46  40.13931 46.45455
47  40.16803 47.35354
48  40.19675 48.25253
49  40.22548 49.15152
50  40.25420 50.05051
51  40.28292 50.94949
52  40.31164 51.84848
53  40.34036 52.74747
54  40.36908 53.64646
55  40.39780 54.54545
56  40.42652 55.44444
57  40.45524 56.34343
58  40.48396 57.24242
59  40.51268 58.14141
60  40.54141 59.04040
61  40.57013 59.93939
62  40.59885 60.83838
63  40.62757 61.73737
64  40.65629 62.63636
65  40.68501 63.53535
66  40.71373 64.43434
67  40.74245 65.33333
68  40.77117 66.23232
69  40.79989 67.13131
70  40.82862 68.03030
71  40.85734 68.92929
72  40.88606 69.82828
73  40.91478 70.72727
74  40.94350 71.62626
75  40.97222 72.52525
76  41.00094 73.42424
77  41.02966 74.32323
78  41.05838 75.22222
79  41.08710 76.12121
80  41.11582 77.02020
81  41.14455 77.91919
82  41.17327 78.81818
83  41.20199 79.71717
84  41.23071 80.61616
85  41.25943 81.51515
86  41.28815 82.41414
87  41.31687 83.31313
88  41.34559 84.21212
89  41.37431 85.11111
90  41.40303 86.01010
91  41.43176 86.90909
92  41.46048 87.80808
93  41.48920 88.70707
94  41.51792 89.60606
95  41.54664 90.50505
96  41.57536 91.40404
97  41.60408 92.30303
98  41.63280 93.20202
99  41.66152 94.10101
100 41.69024 95.00000
> selectHemispheres(MRIaggr.Pat1_red)
     left   right
1 defined defined
> 
> 
> 
> 
> 
> dev.off()
null device 
          1 
>