muschellij2/fslr

fslviewer not found from within r

Closed this issue · 4 comments

After some trouble with packrat and updating fslr I am getting the following error, when I try to open a nifit from within R:

library(fslr)
ld = Sys.getenv("LD_LIBRARY_PATH")
Sys.setenv("LD_LIBRARY_PATH"=paste0(ld, ":/usr/lib/fsl/5.0"))
mni <-  readNIfTI("data/Input/mni.nii.gz",
                  reorient = FALSE)
> fslr::fslview(mni)
FSLDIR='/usr/share/fsl/5.0'; PATH=${FSLDIR}/bin:${PATH};export PATH FSLDIR; sh "${FSLDIR}/etc/fslconf/fsl.sh"; FSLOUTPUTTYPE=NIFTI_GZ; export FSLOUTPUTTYPE; ${FSLDIR}/bin/fslview '/tmp/Rtmpc9D8No/file126f73c02102.nii.gz' 

sh: 1: /usr/share/fsl/5.0/bin/fslview: not found
Error in system(cmd, intern = intern) : error in running command
In addition: Warning messages:
1: In get.fsl() : Setting fsl.path to /usr/share/fsl/5.0
2: In get.fsloutput() : Can't find FSLOUTPUTTYPE, setting to NIFTI_GZ

Here my (local) .bash_profile:

. ~/.profile
. ~/.bashrc

export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/lib/fsl/5.0

And the last lines of my (local) .bash_rc

# fslr tipp, 01.03.17
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/lib/fsl/5.0 in your .bashrc

# from terminal man fsl
 . /etc/fsl/5.0/fsl.sh

## bash
export FREESURFER_HOME=/usr/local/freesurfer
source $FREESURFER_HOME/SetUpFreeSurfer.sh

My Ubuntu version is: 16.04.2 LTS (Xenial Xerus)
R version: 3.3.4
fslr version: 2.13.1 (but I get the same error, when using the cran version).

Any ideas?

Does /usr/share/fsl/5.0/bin/fslview exist? What do you get when you put

which fslview

in the terminal?

No it is in 'usr/bin/fslview'

That is why it's failing. How was fsl installed? One option is to either symlink or copy fslview to /usr/share/fsl/5.0

I don't remember how it was installed, but the symlink option works
$ sudo ln -s /usr/bin/fslview /usr/share/fsl/5.0/bin
Thanks!