if (have.fsl()){
system.time({
x = array(rnorm(1e5), dim = c(100, 100, 10))
img = nifti(x, dim= c(100, 100, 10),
datatype = convert.datatype()$FLOAT32, cal.min = min(x),
cal.max = max(x), pixdim = rep(1, 4))
mask = img > .5
masked = fslmask(img, mask = mask, retimg=TRUE)
})
}
Run the code above in your browser using DataLab