Lecture 4 Data Manipulation
This lecture covers: - Masking - Operations
4.1 Open data
The code below downloads opens the T1-weighted image and downloads the mask for this data.
fname = "113-01-MPRAGE.nii.gz"
fpath = file.path("Neurohacking_data/kirby21/visit_1/113", fname)
maskurl = "https://raw.githubusercontent.com/muschellij2/Neurohacking/master/Basic_Data_Manipulations/Kirby21/SUBJ0001_mask.nii.gz"
maskfname = "SUBJ0001_mask.nii.gz"
maskfpath = file.path("Neurohacking_data", maskfname)
download.file(maskurl, maskfpath, mode="wb")# NIfTI is binaryfile format
library(oro.nifti)
T1 = readNIfTI(fpath,reorient=FALSE)
mask = readNIfTI(maskfpath, reorient=FALSE) 4.2 Visualization
This brain was collected with a bigger FOV than the previous scans. Thus a lot of body parts other than brain are shown.



