muschellij2/fslr

Help mid_sagittal_align function

AcostaFranco opened this issue · 3 comments

Hi everyone,

I want to use the function mid_sagittal_align in R. I already have installed FSL5.0, R, R studio, fslr, etc...
So, when I use it, it gives me the next error:

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/fslhd "/tmp/Rtmpveqwpe/file14d614372173.nii.gz"
/usr/share/fsl/5.0/bin/fslhd: error while loading shared libraries: libfslio.so: cannot open shared object file: No such file or directory
Error in system(cmd, intern = TRUE) : error in running command

I checked to have the fslhs and libfslio.so files
I am using Ubuntu 16.10
Does anyone knows what could be the problem?

Thanks in advance.

Neurodebian has caused some issues in the past for me. I used the following script to just shotgun copy everything.

You may want to symlink instead:

FSLDIR=/usr/local/fsl
FSLSHARE=/usr/share/data

mkdir -p ${FSLDIR}/bin && cp /usr/lib/fsl/5.0/* ${FSLDIR}/bin/
mkdir -p ${FSLDIR}/data/standard && mkdir -p ${FSLDIR}/data/atlases 


#######################################
# Setting things up like other installers
#######################################
cp -R ${FSLSHARE}/fsl-mni152-templates/* ${FSLDIR}/data/standard/

# setting up atlases
cp -R ${FSLSHARE}/harvard-oxford-atlases/* ${FSLDIR}/data/atlases/ 
cp -R ${FSLSHARE}/juelich-histological-atlas/* ${FSLDIR}/data/atlases/ 
cp -R ${FSLSHARE}/bangor-cerebellar-atlas/* ${FSLDIR}/data/atlases/ 
cp -R ${FSLSHARE}/jhu-dti-whitematter-atlas/* ${FSLDIR}/data/atlases/ 
cp -R ${FSLSHARE}/forstmann-subthalamic-nucleus-atlas/* ${FSLDIR}/data/atlases/ 
cp -R ${FSLSHARE}/fsl-resting-connectivity-parcellation-atlases/* ${FSLDIR}/data/atlases/ 
cp -R ${FSLSHARE}/mni-structural-atlas/* ${FSLDIR}/data/atlases/ 
cp -R ${FSLSHARE}/oxford-thalamic-connectivity-atlas/* ${FSLDIR}/data/atlases/ 
cp -R ${FSLSHARE}/talairach-daemon-atlas/* ${FSLDIR}/data/atlases/ 

Hey John, thanks for all the great work. Is this hack still the preferred way to play nice with neurodebian, or is there a more elegant solution? thx!

I think the current implementation works out of the box:
Can you try in a new R session:

devtools::install_github("muschellij2/fslr")
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)
  })
}