muschellij2/fslr

error while loading shared libraries: libnewimage.so

Closed this issue · 40 comments

Dear guys,

I'm using fslr package with FSL 5.0 installed in Ubuntu. I have set up the path successfully as:

library(fslr)
options(fsl.path='/usr/share/fsl/5.0')
options(fsl.outputtype = 'NIFTI')

However, when I call flirt.help(), I get an error message:

usr/share/fsl/5.0/bin/flirt: error while loading shared libraries: libnewimage.so: cannot open shared object file: No such file or directory
Error in system(cmd, intern = TRUE) : error in running command

The similar error also happens when I call fslbet.help(), as:

/usr/share/fsl/5.0/bin/bet2: error while loading shared libraries: libmeshclass.so: cannot open shared object file: No such file or directory
Error in system(cmd, intern = TRUE) : error in running command

Could you help me?

Thanks,
Kaiming

Can you send the output of:

which flirt
flirt -help

The errors you are describing indicate that FSL likely did not install correctly and does not necessarily seem to be an error with fslr.

Dear John,

I type in the terminal and it seems FSL works fine, as below:

~$ which flirt
/usr/share/fsl/5.0/bin/flirt

~$ flirt -help
FLIRT version 6.0

Usage: flirt [options] -in -ref -out
flirt [options] -in -ref -omat
flirt [options] -in -ref -applyxfm -init
-out

By the way, does fslr package includes fslroi function?

Thanks a lot,
Kaiming

On 28 March 2016 at 01:55, John Muschelli notifications@github.com wrote:

Can you send the output of:

which flirt
flirt -help

The errors you are describing indicate that FSL likely did not install
correctly and does not necessarily seem to be an error with fslr.


You are receiving this because you authored the thread.
Reply to this email directly or view it on GitHub
#2 (comment)

Can you try to run:

flirt -in $FSLDIR/data/standard/avg152T1_brain.nii.gz -ref $FSLDIR/data/standard/MNI152_T1_1mm_brain.nii.gz -out $TMPDIR/test.nii.gz -v

I want to see if that code will run. If it does, then there is a problem with fslr and not FSL.

Yes it works, but has errors in the last command lines only, see below:

~$ flirt -in $FSLDIR/data/standard/avg152T1_brain.nii.gz -ref
$FSLDIR/data/standard/MNI152_T1_1mm_brain.nii.gz -out $TMPDIR/test.nii.gz -v
WARNING: Both reference and input images have an sform matrix set
The output image will use the sform from the reference image
The output image will use the transformed sform from the input image
Init Matrix =
1.000000 0.000000 0.000000 0.000000
0.000000 1.000000 0.000000 0.000000
0.000000 0.000000 1.000000 0.000000
0.000000 0.000000 0.000000 1.000000

8mm scale

setscale 8
setoption smoothing 8
clear S
clear P
search

4mm scale

setscale 4
setoption smoothing 4
clear U
clear UA
clear UB
clear US
clear UP
...

Error: failed to open file /test.nii.gz
Image Exception : #22 :: ERROR: Could not open image /test
terminate called after throwing an instance of 'RBD_COMMON::BaseException'
Aborted (core dumped)

Best,
Kaiming

On 28 March 2016 at 02:05, John Muschelli notifications@github.com wrote:

Can you try to run:

flirt -in $FSLDIR/data/standard/avg152T1_brain.nii.gz -ref $FSLDIR/data/standard/MNI152_T1_1mm_brain.nii.gz -out $TMPDIR/test.nii.gz -v

I want to see if that code will run. If it does, then there is a problem
with fslr and not FSL.


You are receiving this because you authored the thread.
Reply to this email directly or view it on GitHub
#2 (comment)

Can you try to run (took out TMPDIR)

flirt -in $FSLDIR/data/standard/avg152T1_brain.nii.gz -ref $FSLDIR/data/standard/MNI152_T1_1mm_brain.nii.gz -out test.nii.gz -v

It finished correctly this time, the last command lines are:

Final result:
0.998626 0.000825 -0.002184 0.210873
-0.000827 0.998195 -0.000820 0.323249
0.002184 0.000953 0.998091 -0.138734
0.000000 0.000000 0.000000 1.000000

Kaiming

On 28 March 2016 at 02:11, John Muschelli notifications@github.com wrote:

Can you try to run (took out TMPDIR)

flirt -in $FSLDIR/data/standard/avg152T1_brain.nii.gz -ref $FSLDIR/data/standard/MNI152_T1_1mm_brain.nii.gz -out test.nii.gz -v


You are receiving this because you authored the thread.
Reply to this email directly or view it on GitHub
#2 (comment)

Now in R (from the command line, not R.app or RStudio ), can you run:

library(fslr)
fsldir = '/usr/share/fsl/5.0'
infile = file.path(fsldir, "data/standard/avg152T1_brain.nii.gz")
reffile = file.path(fsldir, "data/standard/MNI152_T1_1mm_brain.nii.gz")
out = flirt(infile = infile, reffile=reffile)

library(fslr)
Loading required package: stringr
Loading required package: oro.nifti
oro.nifti 0.5.2
fsldir = '/usr/share/fsl/5.0'
infile = file.path(fsldir, "data/standard/avg152T1_brain.nii.gz")
reffile = file.path(fsldir, "/data/standard/MNI152_T1_1mm_brain.nii.gz")
out = flirt(infile = infile, reffile=reffile)
Error in get.fsl() : Can't find FSL
In addition: Warning message:
In get.fsloutput() : Can't find FSLOUTPUTTYPE, setting to NIFTI_GZ

On 28 March 2016 at 02:24, John Muschelli notifications@github.com wrote:

Now in R (from the command line, not R.app or RStudio ), can you run:

library(fslr)fsldir = '/usr/share/fsl/5.0'infile = file.path(fsldir, "data/standard/avg152T1_brain.nii.gz")reffile = file.path(fsldir, "/data/standard/MNI152_T1_1mm_brain.nii.gz")out = flirt(infile = infile, reffile=reffile)


You are receiving this because you authored the thread.
Reply to this email directly or view it on GitHub
#2 (comment)

Again, was this run in Terminal not in an R application? If yes, is the FSLDIR variable set:

echo $FSLDIR

Yes, the above commands were run in terminal directly, not in RStudio.

I run echo $FSLDIR in terminal directly as below:

~$ echo $FSLDIR /usr/share/fsl/5.0

On 28 March 2016 at 02:28, John Muschelli notifications@github.com wrote:

Again, was this run in Terminal not in an R application? If yes, is the
FSLDIR variable set:

echo $FSLDIR


You are receiving this because you authored the thread.
Reply to this email directly or view it on GitHub
#2 (comment)

Can you send me a screen shot of it in the terminal? The reason I ask is that those don't make sense as the get.fsl() command finds the FSL using the Sys.getenv("FSLDIR") command. Therefore, if it's run in the terminal, system environmental variables should be carried through.

In the terminal (bash), can you run:

echo $FSLDIR
R
library(fslr)
get.fsl()

Besides, I tried in the Terminal of R:

Sys.getenv("FSLDIR")
[1] ""

Sys.getenv("FSL_DIR")
[1] ""

Neither works, not sure why.

Kaiming

On 28 March 2016 at 02:39, Kaiming Yin yinkaiming1987@gmail.com wrote:

On 28 March 2016 at 02:35, John Muschelli notifications@github.com
wrote:

Can you send me a screen shot of it in the terminal? The reason I ask is
that those don't make sense as the get.fsl() command finds the FSL using
the Sys.getenv("FSLDIR") command. Therefore, if it's run in the
terminal, system environmental variables should be carried through.

In the terminal (bash), can you run:

echo $FSLDIR
R
library(fslr)
get.fsl()


You are receiving this because you authored the thread.
Reply to this email directly or view it on GitHub
#2 (comment)

That's a bit strange. Especially if

echo $FSLDIR

returns

/usr/share/fsl/5.0

Can you try:

library(fslr)
fsldir = '/usr/share/fsl/5.0'
options(fsl.path = fsldir)
infile = file.path(fsldir, "data/standard/avg152T1_brain.nii.gz")
reffile = file.path(fsldir, "data/standard/MNI152_T1_1mm_brain.nii.gz")
out = flirt(infile = infile, reffile=reffile)

library(fslr)
Loading required package: stringr
Loading required package: oro.nifti
oro.nifti 0.5.2
fsldir = '/usr/share/fsl/5.0'
options(fsl.path = fsldir)
infile = file.path(fsldir, "data/standard/avg152T1_brain.nii.gz")
reffile = file.path(fsldir, "data/standard/MNI152_T1_1mm_brain.nii.gz")
out = flirt(infile = infile, reffile=reffile)
FSLDIR='/usr/share/fsl/5.0'; export FSLDIR; sh
"${FSLDIR}/etc/fslconf/fsl.sh"; FSLOUTPUTTYPE=NIFTI_GZ; export
FSLOUTPUTTYPE; $FSLDIR/bin/flirt -in
"/usr/share/data/fsl-mni152-templates/avg152T1_brain.nii.gz" -ref
"/usr/share/data/fsl-mni152-templates/MNI152_T1_1mm_brain.nii.gz" -out
"/tmp/Rtmp5tM8DN/file30673ff2694c" -dof 6 -omat
"/tmp/Rtmp5tM8DN/file30673e2dc5d4.mat"
/usr/share/fsl/5.0/bin/flirt: error while loading shared libraries:
libnewimage.so: cannot open shared object file: No such file or directory
Error in readNIfTI(outfile, reorient = reorient, ...) :
File(s) not found!
In addition: Warning message:
In get.fsloutput() : Can't find FSLOUTPUTTYPE, setting to NIFTI_GZ

Additionally, in the fslr package An R Markdown Vignette with knitr
https://cran.r-project.org/web/packages/fslr/vignettes/fslr.html file it
says using option(...) rather than options(...), but I don't have option()
function in R, does this matters?

On 28 March 2016 at 02:55, John Muschelli notifications@github.com wrote:

That's a bit strange. Especially if

echo $FSLDIR

returns

/usr/share/fsl/5.0

Can you try:

library(fslr)fsldir = '/usr/share/fsl/5.0'
options(fsl.path = fsldir)infile = file.path(fsldir, "data/standard/avg152T1_brain.nii.gz")reffile = file.path(fsldir, "data/standard/MNI152_T1_1mm_brain.nii.gz")out = flirt(infile = infile, reffile=reffile)


You are receiving this because you authored the thread.
Reply to this email directly or view it on GitHub
#2 (comment)

Why is the path coming up with /usr/share/data/fsl-mni152-templates/ for the files, when you input them as

infile = file.path(fsldir, "data/standard/avg152T1_brain.nii.gz")

?

It seems like this link may shed some light:
https://www.jiscmail.ac.uk/cgi-bin/webadmin?A2=fsl;52235414.1304
but I'm not sure what the issue is. It seems like a network, non-standard install of FSL may be an issue.

Can you go to the Terminal and run:

ls $FSLDIR

~$ ls $FSLDIR
bin data doc etc tcl

i installed FSL according to the tutorial, shouldn't be a problem I think.

On 28 March 2016 at 03:05, John Muschelli notifications@github.com wrote:

Why is the path coming up with /usr/share/data/fsl-mni152-templates/ for
the files, when you input them as

infile = file.path(fsldir, "data/standard/avg152T1_brain.nii.gz")

?

It seems like this link may shed some light:
https://www.jiscmail.ac.uk/cgi-bin/webadmin?A2=fsl;52235414.1304
but I'm not sure what the issue is. It seems like a network, non-standard
install of FSL may be an issue.

Can you go to the Terminal and run:

ls $FSLDIR


You are receiving this because you authored the thread.
Reply to this email directly or view it on GitHub
#2 (comment)

Can you comment as to why the files are linking to "/usr/share/data/fsl-mni152-templates/avg152T1_brain.nii.gz"? Are there symlinks in the install? These should be in $FSLDIR/data/standard/, not /usr/share/data/fsl-mni152-templates/

Can you run:

ls $FSLDIR/etc
ls ${FSLDIR}/etc/fslconf/

~$ ls $FSLDIR/etc
default_flobs.flobs flirtsch fslconf fslversion js luts matlab

~$ ls ${FSLDIR}/etc/fslconf/
feat.tcl fsl.csh fsl-devel.sh fsl.sh

avg152T1_brain.nii.gz file exits in both
the /usr/share/data/fsl-mni152-templates/ and $FSLDIR/data/standard/, not
symlinks.

On 28 March 2016 at 03:12, John Muschelli notifications@github.com wrote:

Can you comment as to why the files are linking to
"/usr/share/data/fsl-mni152-templates/avg152T1_brain.nii.gz"? Are there
symlinks in the install? These should be in $FSLDIR/data/standard/, not
/usr/share/data/fsl-mni152-templates/

Can you run:

ls $FSLDIR/etc
ls ${FSLDIR}/etc/fslconf/


You are receiving this because you authored the thread.
Reply to this email directly or view it on GitHub
#2 (comment)

Have you looked at other scenarios where this error occurs?

Can you also give me a rundown of the system used (Linux distro/OSX/neurodebian)? Have you ever installed FSL previously? Did you install with a Freesurfer distro?

And lastly, in the Terminal, can you run (trying to simulate exact R code to what Terminal runs):

flirt -in "/usr/share/data/fsl-mni152-templates/avg152T1_brain.nii.gz" -ref "/usr/share/data/fsl-mni152-templates/MNI152_T1_1mm_brain.nii.gz" -out "/tmp/Rtmp5tM8DN/file30673ff2694c" -dof 6 -omat "/tmp/Rtmp5tM8DN/file30673e2dc5d4.mat"

I run in the terminal:

~$ flirt -in "/usr/share/data/fsl-mni152-templates/avg152T1_brain.nii.gz"
-ref "/usr/share/data/fsl-mni152-templates/MNI152_T1_1mm_brain.nii.gz" -out
"/tmp/Rtmp5tM8DN/file30673ff2694c" -dof 6 -omat
"/tmp/Rtmp5tM8DN/file30673e2dc5d4.mat"
Could not open file /tmp/Rtmp5tM8DN/file30673e2dc5d4.mat for writing
Error: failed to open file /tmp/Rtmp5tM8DN/file30673ff2694c.nii.gz
Image Exception : #22 :: ERROR: Could not open image
/tmp/Rtmp5tM8DN/file30673ff2694c
terminate called after throwing an instance of 'RBD_COMMON::BaseException'
Aborted (core dumped)

I'm using Ubuntu 15.10, 64-bit, I didn't install FSL before, but installed
FSL5.0 long ago, i'm also using Freesurfer 6.0beta now.

On 28 March 2016 at 03:22, John Muschelli notifications@github.com wrote:

Have you looked at other scenarios where this error occurs
https://www.google.com/search?q=error+while+loading+shared+libraries%3A+libnewimage.so%3A+cannot+open+shared+object+file%3A+No+such+file+or+directory&oq=error+while+loading+shared+libraries%3A+libnewimage.so%3A+cannot+open+shared+object+file%3A+No+such+file+or+directory&aqs=chrome..69i57.182j0j7&sourceid=chrome&ie=UTF-8?

Can you also give me a rundown of the system used (Linux
distro/OSX/neurodebian)? Have you ever installed FSL previously? Did you
install with a Freesurfer distro?

And lastly, in the Terminal, can you run (trying to simulate exact R code
to what Terminal runs):

flirt -in "/usr/share/data/fsl-mni152-templates/avg152T1_brain.nii.gz" -ref "/usr/share/data/fsl-mni152-templates/MNI152_T1_1mm_brain.nii.gz" -out "/tmp/Rtmp5tM8DN/file30673ff2694c" -dof 6 -omat "/tmp/Rtmp5tM8DN/file30673e2dc5d4.mat"


You are receiving this because you authored the thread.
Reply to this email directly or view it on GitHub
#2 (comment)

How did you install FSL5.0 - from downloading from Oxford sources and compiling or neurodebian?
OK - please rerun after changing the dirs of the output to an appropriate temporary directory for testing?

The above flirt command line finished successfully this time after changing
the output dir.

It's long ago when I installed FSL, I can't remember but I followed the FSL
webpage instructions.

On 28 March 2016 at 03:32, John Muschelli notifications@github.com wrote:

How did you install FSL5.0 - from downloading from Oxford sources and
compiling or neurodebian?
OK - please rerun after changing the dirs of the output to an appropriate
temporary directory for testing?


You are receiving this because you authored the thread.
Reply to this email directly or view it on GitHub
#2 (comment)

Can you try install the dev version of fslr:

library(devtools)
install_github("muschellij2/fslr")

and rerun the commands?

I didn't have devtools package so I just installed now, and then installed
the dev fslr.

Still, it seems not working well, as below:

library(fslr)
Loading required package: stringr
Loading required package: oro.nifti
oro.nifti 0.5.2

fslbet.help()
Error in get.fsl() : Can't find FSL
In addition: Warning message:
In get.fsloutput() : Can't find FSLOUTPUTTYPE, setting to NIFTI_GZ

get.fsl()
Error in get.fsl() : Can't find FSL

On 28 March 2016 at 03:46, John Muschelli notifications@github.com wrote:

Can you try install the dev version of fslr:

library(devtools)
install_github("muschellij2/fslr")

and rerun the commands?


You are receiving this because you authored the thread.
Reply to this email directly or view it on GitHub
#2 (comment)

Again, as per the docs, if you load fslr using an interactive, non-shell session, such as in RStudio or R.app, then you just set fsl.path using options(fsl.path) as you did previously.

Please run (in R):

library(fslr)
fsldir = '/usr/share/fsl/5.0'
options(fsl.path = fsldir)
get.fsl()
fslbet.help()

and if these work, please try:

infile = file.path(fsldir, "data/standard/avg152T1_brain.nii.gz")
reffile = file.path(fsldir, "data/standard/MNI152_T1_1mm_brain.nii.gz")
out = flirt(infile = infile, reffile=reffile)

I run in RStudio, still not working:

require(fslr)Loading required package: fslrLoading required package: stringrLoading required package: oro.niftioro.nifti 0.5.2> options(fsl.path='/usr/share/fsl/5.0')> options(fsl.outputtype = 'NIFTI')> have.fsl()[1] TRUE> fsldir = '/usr/share/fsl/5.0'> options(fsl.path = fsldir)> get.fsl()[1] "FSLDIR='/usr/share/fsl/5.0'; PATH=${FSLDIR}/bin:${PATH};export PATH FSLDIR; sh "${FSLDIR}/etc/fslconf/fsl.sh"; FSLOUTPUTTYPE=NIFTI; export FSLOUTPUTTYPE; ${FSLDIR}/bin/"> fslbet.help()/usr/share/fsl/5.0/bin/bet2: error while loading shared libraries: libmeshclass.so: cannot open shared object file: No such file or directoryError in system(cmd, intern = TRUE) : error in running command

On 28 March 2016 at 03:54, John Muschelli notifications@github.com wrote:

Again, as per the docs, if you load fslr using an interactive, non-shell
session, such as in RStudio or R.app, then you just set fsl.path using
options(fsl.path) as you did previously.

Please run (in R):

library(fslr)fsldir = '/usr/share/fsl/5.0'
options(fsl.path = fsldir)
get.fsl()
fslbet.help()

and if these work, please try:

infile = file.path(fsldir, "data/standard/avg152T1_brain.nii.gz")reffile = file.path(fsldir, "data/standard/MNI152_T1_1mm_brain.nii.gz")out = flirt(infile = infile, reffile=reffile)


You are receiving this because you authored the thread.
Reply to this email directly or view it on GitHub
#2 (comment)

I don't really know why this is occurring. The command is simply wrapping bet2 and running the system command on top of it, along with the shell code you see there. I have not run into this before, but others seem to have run into it:
https://mail.nmr.mgh.harvard.edu/pipermail//freesurfer/2013-April/029331.html

Can you try this command:

system("bet2 -h")

and then

system("fsl5.0-bet2 -h")

It may be the type of installation that requires the "fsl5.0-" in front. I can maybe add this as an addon option if this works.

Some good news seems, I run the above two commands in terminal of R:

library(fslr)
Loading required package: stringr
Loading required package: oro.nifti
oro.nifti 0.5.2

system("bet2 -h")
sh: 1: bet2: not found

system("fsl5.0-bet2 -h")

Part of FSL (build 508)
BET (Brain Extraction Tool) v2.1 - FMRIB Analysis Group, Oxford

Usage:
bet2 <input_fileroot> <output_fileroot> [options]

Optional arguments (You may optionally specify one or more of):
...

It seems fsl5.0-bet2 works, but I'm not sure. What do you think?

On 28 March 2016 at 04:05, John Muschelli notifications@github.com wrote:

I don't really know why this is occurring. The command is simply wrapping
bet2 and running the system command on top of it, along with the shell
code you see there. I have not run into this before, but others seem to
have run into it:

https://mail.nmr.mgh.harvard.edu/pipermail//freesurfer/2013-April/029331.html

Can you try this command:

system("bet2 -h")

and then

system("fsl5.0-bet2 -h")

It may be the type of installation that requires the "fsl5.0-" in front. I
can maybe add this as an addon option if this works.


You are receiving this because you authored the thread.
Reply to this email directly or view it on GitHub
#2 (comment)

OK. It seems that's because it's a neurodebian installation and not from FSL directly.

Please Restart R and try:

devtools::install_github("muschellij2/fslr")
library(fslr)
options(fsl.path='/usr/share/fsl/5.0')
options(add_fsl50 = TRUE)
fslbet.help()

I run in terminal of R, It seems not working again:

devtools::install_github("muschellij2/fslr")
Downloading GitHub repo muschellij2/fslr@master
from URL https://api.github.com/repos/muschellij2/fslr/zipball/master
Installing fslr
'/usr/lib/R/bin/R' --no-site-file --no-environ --no-save --no-restore CMD
INSTALL '/tmp/Rtmpz9E00H/devtools413837a6a104/muschellij2-fslr-97c76db'
--library='/usr/local/lib/R/site-library' --install-tests

  • installing source package ‘fslr’ ...
    ** R
    ** preparing package for lazy loading
    ** help
    *** installing help indices
    ** building package indices
    ** installing vignettes
    ** testing if installed package can be loaded
  • DONE (fslr)

    library(fslr)
    Loading required package: stringr
    Loading required package: oro.nifti
    oro.nifti 0.5.2
    options(fsl.path='/usr/share/fsl/5.0')
    options(add_fsl50 = TRUE)
    fslbet.help()
    sh: 1: /usr/share/fsl/5.0/bin/fsl5.0-bet2: not found
    Error in system(cmd, intern = TRUE) : error in running command
    In addition: Warning message:
    In get.fsloutput() : Can't find FSLOUTPUTTYPE, setting to NIFTI_GZ

On 28 March 2016 at 04:14, John Muschelli notifications@github.com wrote:

OK. It seems that's because it's a neurodebian installation and not from
FSL directly.

Please Restart R and try:

devtools::install_github("muschellij2/fslr")
library(fslr)
options(fsl.path='/usr/share/fsl/5.0')
options(add_fsl50 = TRUE)
fslbet.help()


You are receiving this because you authored the thread.
Reply to this email directly or view it on GitHub
#2 (comment)

OK. Can you do run in R:

Sys.which("fsl5.0-bet2")

or

system("which fsl5.0-bet2")

Sys.which("fsl5.0-bet2")
fsl5.0-bet2
"/usr/bin/fsl5.0-bet2"

system("which fsl5.0-bet2")
/usr/bin/fsl5.0-bet2

On 28 March 2016 at 04:23, John Muschelli notifications@github.com wrote:

OK. Can you do run in R:

Sys.which("fsl5.0-bet2")

or

system("which fsl5.0-bet2")


You are receiving this because you authored the thread.
Reply to this email directly or view it on GitHub
#2 (comment)

Can you try:

library(fslr)
options(fsl.path='/usr/bin')
options(add_fsl50 = TRUE)
fslbet.help()

library(fslr)
options(fsl.path='/usr/bin')
options(add_fsl50 = TRUE)
fslbet.help()
sh: 0: Can't open /usr/bin/etc/fslconf/fsl.sh
sh: 1: /usr/bin/bin/fsl5.0-bet2: not found
Error in system(cmd, intern = TRUE) : error in running command

options(fsl.path='/usr/')
fslbet.help()
sh: 0: Can't open /usr//etc/fslconf/fsl.sh

Part of FSL (build 508)
BET (Brain Extraction Tool) v2.1 - FMRIB Analysis Group, Oxford

Usage:
bet2 <input_fileroot> <output_fileroot> [options]

It seems options(fsl.path='/usr/') can make fslbet.help() work, but "sh: 0:
Can't open /usr//etc/fslconf/fsl.sh", maybe we need to set the path for sh:
0 and sh: 1 separately?

On 28 March 2016 at 04:25, John Muschelli notifications@github.com wrote:

Can you try:

library(fslr)
options(fsl.path='/usr/bin')
options(add_fsl50 = TRUE)
fslbet.help()


You are receiving this because you authored the thread.
Reply to this email directly or view it on GitHub
#2 (comment)

I have changed around the options slightly. The option is now fsl_pre instead. The code will also check if the sh file exists so there should not be a warning.

devtools::install_github("muschellij2/fslr")
library(fslr)
options(fsl.path='/usr/bin')
options(fsl_pre = "fsl5.0-")
fslbet.help()

devtools::install_github("muschellij2/fslr")
Downloading GitHub repo muschellij2/fslr@master
from URL https://api.github.com/repos/muschellij2/fslr/zipball/master
Installing fslr
'/usr/lib/R/bin/R' --no-site-file --no-environ --no-save --no-restore CMD
INSTALL '/tmp/RtmpdecQEN/devtools12774137808c/muschellij2-fslr-5ebe328'
--library='/usr/local/lib/R/site-library' --install-tests

  • installing source package ‘fslr’ ...
    ** R
    ** preparing package for lazy loading
    ** help
    *** installing help indices
    ** building package indices
    ** installing vignettes
    ** testing if installed package can be loaded
  • DONE (fslr)

library(fslr)
Loading required package: stringr
Loading required package: oro.nifti
oro.nifti 0.5.2

options(fsl.path='/usr/bin')
options(fsl_pre = "fsl5.0-")
fslbet.help()
sh: 1: /usr/bin/bin/fsl5.0-bet2: not found
Error in system(cmd, intern = TRUE) : error in running command
In addition: Warning message:
In get.fsloutput() : Can't find FSLOUTPUTTYPE, setting to NIFTI_GZ

options(fsl.path='/usr')
fslbet.help()

Part of FSL (build 508)
BET (Brain Extraction Tool) v2.1 - FMRIB Analysis Group, Oxford

Usage:
bet2 <input_fileroot> <output_fileroot> [options]

Optional arguments (You may optionally specify one or more of):
...

options(fsl.path='/usr/')
fslbet.help()

Part of FSL (build 508)
BET (Brain Extraction Tool) v2.1 - FMRIB Analysis Group, Oxford

Usage:
bet2 <input_fileroot> <output_fileroot> [options]

Optional arguments (You may optionally specify one or more of):
...

It seems options(fsl.path='/usr/bin') has problems, while
options(fsl.path='/usr') and options(fsl.path='/usr/') both work, but maybe
options(fsl.path='/usr') works better as last time there is a warning in
sh: 0 when using options(fsl.path='/usr/'), not sure because no warning
information this time.

On 28 March 2016 at 15:09, John Muschelli notifications@github.com wrote:

I have changed around the options slightly. The option is now fsl_pre
instead. The code will also check if the sh file exists so there should not
be a warning.

devtools::install_github("muschellij2/fslr")
library(fslr)
options(fsl.path='/usr/bin')
options(fsl_pre = "fsl5.0-")
fslbet.help()


You are receiving this because you authored the thread.
Reply to this email directly or view it on GitHub
#2 (comment)

~$ cd /usr/share/fsl/5.0/etc/fslconf/
fslconf$ ls -l
total 8
lrwxrwxrwx 1 root root 21 Aug 18 2015 feat.tcl -> /etc/fsl/5.0/feat.tcl
-rw-r--r-- 1 root root 2279 Aug 18 2015 fsl.csh
-rw-r--r-- 1 root root 2295 Aug 18 2015 fsl-devel.sh
lrwxrwxrwx 1 root root 19 Aug 18 2015 fsl.sh -> /etc/fsl/5.0/fsl.sh

I find the fsl.sh in /etc/fsl/5.0/fsl.sh or a symlink
in /usr/share/fsl/5.0/etc/fslconf/, could this help?

On 28 March 2016 at 16:49, Kaiming Yin yinkaiming1987@gmail.com wrote:

devtools::install_github("muschellij2/fslr")
Downloading GitHub repo muschellij2/fslr@master
from URL https://api.github.com/repos/muschellij2/fslr/zipball/master
Installing fslr
'/usr/lib/R/bin/R' --no-site-file --no-environ --no-save --no-restore CMD

INSTALL '/tmp/RtmpdecQEN/devtools12774137808c/muschellij2-fslr-5ebe328'

--library='/usr/local/lib/R/site-library' --install-tests

  • installing source package ‘fslr’ ...
    ** R
    ** preparing package for lazy loading
    ** help
    *** installing help indices
    ** building package indices
    ** installing vignettes
    ** testing if installed package can be loaded
  • DONE (fslr)

library(fslr)
Loading required package: stringr
Loading required package: oro.nifti
oro.nifti 0.5.2

options(fsl.path='/usr/bin')
options(fsl_pre = "fsl5.0-")
fslbet.help()
sh: 1: /usr/bin/bin/fsl5.0-bet2: not found
Error in system(cmd, intern = TRUE) : error in running command
In addition: Warning message:
In get.fsloutput() : Can't find FSLOUTPUTTYPE, setting to NIFTI_GZ

options(fsl.path='/usr')
fslbet.help()

Part of FSL (build 508)
BET (Brain Extraction Tool) v2.1 - FMRIB Analysis Group, Oxford

Usage:
bet2 <input_fileroot> <output_fileroot> [options]

Optional arguments (You may optionally specify one or more of):
...

options(fsl.path='/usr/')
fslbet.help()

Part of FSL (build 508)
BET (Brain Extraction Tool) v2.1 - FMRIB Analysis Group, Oxford

Usage:
bet2 <input_fileroot> <output_fileroot> [options]

Optional arguments (You may optionally specify one or more of):
...

It seems options(fsl.path='/usr/bin') has problems, while
options(fsl.path='/usr') and options(fsl.path='/usr/') both work, but maybe
options(fsl.path='/usr') works better as last time there is a warning in
sh: 0 when using options(fsl.path='/usr/'), not sure because no warning
information this time.

On 28 March 2016 at 15:09, John Muschelli notifications@github.com
wrote:

I have changed around the options slightly. The option is now fsl_pre
instead. The code will also check if the sh file exists so there should not
be a warning.

devtools::install_github("muschellij2/fslr")
library(fslr)
options(fsl.path='/usr/bin')
options(fsl_pre = "fsl5.0-")
fslbet.help()


You are receiving this because you authored the thread.
Reply to this email directly or view it on GitHub
#2 (comment)

So the get.fsl() command puts the bin/ on the end of the path, so you should use

options(fsl.path='/usr/')

That file could help, but it seems as though Neurodeb or however you installed put things in different folders than compared to the standard install of FSL. It also seems as though you may have 2 installations (one in /usr/bin - unless that's a symlink, and one in /usr/share/fsl/5.0).

I think for now,

 options(fsl.path='/usr')
 options(fsl_pre = "fsl5.0-")

would be the way to go forward. Let me know if (after restarting R), this works:

library(fslr)
options(fsl.path='/usr')
options(fsl_pre = "fsl5.0-")
infile = "/usr/share/data/fsl-mni152-templates/avg152T1_brain.nii.gz")
reffile = /usr/share/data/fsl-mni152-templates/MNI152_T1_1mm_brain.nii.gz")
out = flirt(infile = infile, reffile=reffile)

I run in terminal of R:

library(fslr)
Loading required package: stringr
Loading required package: oro.nifti
oro.nifti 0.5.2
options(fsl.path='/usr')
options(fsl_pre = "fsl5.0-")
infile = "/usr/share/data/fsl-mni152-templates/avg152T1_brain.nii.gz")
Error: unexpected ')' in "infile =
"/usr/share/data/fsl-mni152-templates/avg152T1_brain.nii.gz")"
reffile =
/usr/share/data/fsl-mni152-templates/MNI152_T1_1mm_brain.nii.gz")
Error: unexpected '/' in "reffile = /"
out = flirt(infile = infile, reffile=reffile)
Error in checkimg(infile, ...) : object 'infile' not found
In addition: Warning message:
In get.fsloutput() : Can't find FSLOUTPUTTYPE, setting to NIFTI_GZ

Then I change infile and reffile:

infile = "/usr/share/data/fsl-mni152-templates/avg152T1_brain.nii.gz"
reffile =
"/usr/share/data/fsl-mni152-templates/MNI152_T1_1mm_brain.nii.gz"
out = flirt(infile = infile, reffile=reffile)
FSLDIR='/usr'; PATH=${FSLDIR}/bin:${PATH};export PATH FSLDIR;
FSLOUTPUTTYPE=NIFTI_GZ; export FSLOUTPUTTYPE; ${FSLDIR}/bin/fsl5.0-flirt
-in "/usr/share/data/fsl-mni152-templates/avg152T1_brain.nii.gz" -ref
"/usr/share/data/fsl-mni152-templates/MNI152_T1_1mm_brain.nii.gz" -out
"/tmp/RtmpGEs4QX/fileba34af997e" -dof 6 -omat
"/tmp/RtmpGEs4QX/fileba36a1e7878.mat"

I think it works this time, at least no warnings now.

On 28 March 2016 at 17:44, John Muschelli notifications@github.com wrote:

So the get.fsl() command puts the bin/ on the end of the path, so you
should use

options(fsl.path='/usr/')

That file could help, but it seems as though Neurodeb or however you
installed put things in different folders than compared to the standard
install of FSL. It also seems as though you may have 2 installations (one
in /usr/bin - unless that's a symlink, and one in /usr/share/fsl/5.0).

I think for now,

options(fsl.path='/usr')
options(fsl_pre = "fsl5.0-")

would be the way to go forward. Let me know if (after restarting R), this
works:

library(fslr)
options(fsl.path='/usr')
options(fsl_pre = "fsl5.0-")infile = "/usr/share/data/fsl-mni152-templates/avg152T1_brain.nii.gz")reffile = /usr/share/data/fsl-mni152-templates/MNI152_T1_1mm_brain.nii.gz")out = flirt(infile = infile, reffile=reffile)


You are receiving this because you authored the thread.
Reply to this email directly or view it on GitHub
#2 (comment)

out should now be a nifti file. I think this issue is solved and I'm closing.