-
Notifications
You must be signed in to change notification settings - Fork 0
/
split_hipp_4regions.Rout
37 lines (31 loc) · 1.42 KB
/
split_hipp_4regions.Rout
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
R version 4.1.2 (2021-11-01) -- "Bird Hippie"
Copyright (C) 2021 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.
Natural language support but running in an English locale
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(RNifti)
>
> l_hipp <- readNifti("high_res_originals/long_axis_l_1.0mm.nii.gz")
> l_hipp_split <- l_hipp
>
> # the cut generates a factor, but when merged back as a numeric, we get
> # (posterior) 1 = 0 -- 0.25; 2 = .25-.5; 3 = .5-.75; 4 = .75-1 (anterior)
> l_hipp_split[l_hipp_split > 0] <- cut(l_hipp_split[l_hipp_split > 0], breaks=c(0,.25,.5,.75,1))
> writeNifti(l_hipp_split, file = "long_axis_l_split_1.0mm.nii.gz")
>
> r_hipp <- readNifti("high_res_originals/long_axis_r_1.0mm.nii.gz")
> r_hipp_split <- r_hipp
> r_hipp_split[r_hipp_split > 0] <- cut(r_hipp_split[r_hipp_split > 0], breaks=c(0,.25,.5,.75,1))
> writeNifti(r_hipp_split, file = "long_axis_r_split_1.0mm.nii.gz")
>
> proc.time()
user system elapsed
2.343 0.294 2.688