issue running fslsmooth() function
Closed this issue · 1 comments
R studio is kicking the error below when I try to run this code:
# Commented out as all packages are installed now
install.packages("flexdashboard")
install.packages("rmarkdown")
install.packages("knitr")
install.packages("readxl")
install.packages("oro.dicom")
# Install package "devtools" which is used to install package "neurobase" and "fslr"
install.packages("devtools")
# Install neurobase
devtools::install_github("muschellij2/neurobase")
# Install fslr
devtools::install_github("muschellij2/fslr")
# Loading all libraries
library(flexdashboard)
library(rmarkdown)
library(knitr)
library(readxl)
# Load required library to read multiple DICOM files
library(oro.dicom)
library(devtools)
# Load the neurobase and fslr
library(neurobase)
library(fslr)
options(fsl.path="/Library/Frameworks/R.framework/Versions/4.1/Resources/library/fslr")
if (have.fsl()){
system.time({
dims = c(50, 50, 20)
x = array(rnorm(prod(dims)), dim = dims)
img = nifti(x, dim= dims,
datatype = convert.datatype()$FLOAT32, cal.min = min(x),
cal.max = max(x), pixdim = rep(1, 4))
s.img = fslsmooth(img, retimg=TRUE)
})
}
Error:
FSLDIR='/Library/Frameworks/R.framework/Versions/4.1/Resources/library/fslr'; PATH=${FSLDIR}/bin:${PATH};export PATH FSLDIR; FSLOUTPUTTYPE=NIFTI_GZ; export FSLOUTPUTTYPE; ${FSLDIR}/bin/fslmaths "/private/var/folders/1f/n1lfmhwx41gcpl_9k02ln2cr0000gn/T/RtmpMYGT6a/filee3ac73f6c7d1.nii.gz" -s 10 "/var/folders/1f/n1lfmhwx41gcpl_9k02ln2cr0000gn/T//RtmpMYGT6a/filee3ac4eb8a5d1";
rest/of/path/library/fslr/bin/fslmaths: No such file or directory
Error in oro.nifti::readNIfTI(..., reorient = reorient) :
File(s) not found!
Any idea why this might be? I'm lost with it right now.
You need to install FSL: https://fsl.fmrib.ox.ac.uk/fsl/fslwiki
See docs at https://fsl.fmrib.ox.ac.uk/fsl/fslwiki/FslInstallation/MacOsX. The fsl.path
is for FSL not fslr