eXTReMe Tracker
Sep 122016
 

There is good news for those who use neuroimaging tools such as AFNI, FSL and FreeSurfer on their Windows machines. The limitation is that they can only be run on Windows 10 with anniversary update. Does it use a Virtual Machine? No. It runs “natively” on Windows 10, so you can save, print, resize or hide any interface just like a Windows program.

Freeview running in Windows 10

Freesurfer on Windows 10

Before I get into how to install FreeSurfer, I must thank the author at K-Lab for the post on “How to run FSL on Windows 10“. That post describes how to install BASH on Windows 10 in the first few steps. Sadly it is not available for Windows 7/8. It uses Ubuntu 14.04 LTS which will be supported by Canonical until 2019. We hope by then Windows would incorporate the Ubuntu 16.04 LTS as the default distribution.

I’ll repeat a few things (steps 1-5) that Lin4Neuro wrote on how to get BASH and X-server on Windows 10.

  1. Install Linux BASH shell on Windows 10:
    There is detailed tutorial with screenshots on how to do this at the following site.
    How to Install and Use the Linux Bash Shell on Windows 10
  2. Install the updates:
    Before adding any tools, you should first download and install the updates for Ubuntu. Run the following commands at the terminal

    sudo apt-get update
    sudo apt-get upgrade
  3. Install the X server:
    Installing BASH will allow you to run applications on a command line but in order to run any GUIs for neuroimaging tools you require a X-server for windows. The most popular software for this is Xming. You can download and install it with default settings.
    Xming X server for Windows
  4. Running X server:
    Run Xming by searching it from start menu. When it is loaded you should see this when you go to show hidden icons button at the bottom right corner of your desktop.
    xming_server
  5. In order for X server to work with BASH run the following command at the terminal
    echo "export DISPLAY=localhost:0.0" >> ~/.bashrc

    This will add the environment variable for display to the .bashrc file.


  6. Downloading Freesurfer:
    You can obtain your copy of Freesurfer from their web page. I would recommend getting the nightly build as I was having some trouble running the stable version v5.30, especially some of the graphical windows. If you want to try the stable version download the 64-bit centos6 stable v5.3.0 freesurfer. I would encourage getting the v6.0 nightly build even though it is not the official release. You can go back and reinstall the stable version 6.0 once it is released.To download your choice of FreeSurfer type this command at the terminal:
    For stable release v5.3.0

    ftp://surfer.nmr.mgh.harvard.edu/pub/dist/freesurfer/5.3.0/freesurfer-Linux-centos6_x86_64-stable-pub-v5.3.0.tar.gz

    For nightly build

    wget ftp://surfer.nmr.mgh.harvard.edu/pub/dist/freesurfer/dev/freesurfer-Linux-centos6_x86_64-dev.tar.gz

    Hint: You can copy the link with your mouse and when you right-click at the terminal, it will be automatically pasted so you don’t have to type it in manually.
    This is a large file (~4.6GB) so it may take some time to download it based on your network speed.

  7.  Extract the zipped file to install it. It is customary to install it at /usr/local/ so let’s extract it to that directory.
    sudo tar -xzf freesurfer-Linux-centos6_x86_64-dev.tar.gz -C /usr/local/

    You will require your admin password (for Linux) to extract it to /usr/local. Again this step can take few minutes since it is extracting a file that’s several gigabytes in size. Once extracted, we’ll have to change permissions on that folder.

    sudo chmod -R 755 /usr/local/freesurfer

    This allows you to make changes to files in that folder.

  8. Obtain the FreeSurfer license:
    In order to run the FreeSurfer applications you need to register and obtain a license from their website.
    FreeSurfer Registration
    Once you have the license emailed to you, copy the contents between the lines that read “cut here” and create a license.txt file.

    sudo nano /usr/local/freesurfer/license.txt

    fs_lic
    Paste the contents with right-click
    Press ctrl+X to exit
    Press y to accept and save it as license.txt
    Hit Enter

  9. Add FreeSurfer path to .bashrc:
    echo "export FREESURFER_HOME=/usr/local/freesurfer" >> ~/.bashrc
    echo "source \$FREESURFER_HOME/SetUpFreeSurfer.sh" >> ~/.bashrc
  10. Dependencies: libjpeg.so.62
    Generally there is a libjpeg dependency that is required by FreeSurfer graphics. It doesn’t come with the basic Ubuntu installation but it can be installed using:

    sudo apt-get install libjpeg62
  11. Final check:
    Check that the Xming server is running and it says Xming Server:0.0 when you hover the mouse on the icon in the lower right hand corner.Type bash at the terminal. You should see the following:

    -------- freesurfer-Linux-centos6_x86_6.0 --------
    Setting up environment for FreeSurfer/FS-FAST (and FSL)
    FREESURFER_HOME   /usr/local/freesurfer
    FSFAST_HOME       /usr/local/freesurfer/fsfast
    FSF_OUTPUT_FORMAT nii.gz
    SUBJECTS_DIR      /usr/local/freesurfer/subjects
    MNI_DIR           /usr/local/freesurfer/mni
  12. Test your installation:
    Check if everything works by going through some of the examples listed on the FreeSurfer website.
    FreeSurfer examples
    If everything has been installed correctly you should be able to run command line functions and open GUIs just like on a Mac or Linux machine.
    tksurfer_win10If you have any questions about the installation, please post a comment. If you have questions about FreeSurfer please visit the FreeSurfer user community mail archives.
Sep 162014
 

Every once in a while as you are trying to make a .iso file from a DVD using Brasero, you might get an error saying that couldn’t retrieve the keys because of libdvdscc2.

An alternative to that is a command line tool called dvdbackup which first needs to be installed

sudo apt-get install dvdbackup

After installing that program, you can make backup of your entire dvd, unfortunately not an .iso. You can create an iso from the folder that gets generated once you backup the dvd using dvdbackup. To create a backup, open your terminal and run:

 dvdbackup -M -i /path/to/dvd/  -n Title_For_Backup -o /path/to/output/directory

To get help of dvdbackup you simply have to type in dvdbackup at the terminal.

Jul 202012
 

In the newer versions of Linux, an open source driver is usually installed by default to run the graphic cards. However this driver can sometimes be absolutely messy, and it is essential to remove the Nouveau driver and install the binary driver from Nvidia.

However, if after you reboot into the service mode from grub menu, and try to install the NVIDIA-Linux-x86_64-xxx.run driver in the init 3 level, the program will kick you out saying that the Nouveau driver is still in use.

The way to disable the Nouveau drivers from kernel is to boot in the service mode and run the following commands:

echo options nouveau modeset=0 | sudo tee -a /etc/modprobe.d/nouveau-kms.conf
 update-initramfs -u

Once its done reconfiguring the kernel, you will need to reboot, and again get to service mode.

After that, get into init 3 mode, and install the NVIDIA-Linux-x86-64.xxx.run script. The installation should be successful at this point.

Dec 062011
 

The newer releases of Ubuntu and Linux Mint have started getting stuck during LiveCD installation or after distribution/kernel upgrade.  Usually the point where it gets stagnant is when it reaches this line:

kernel_thread_helper+0x7/0x10

Nothing happens past that point. A solution or a workaround to this is to insert the nolapic acpi=off switch in the grub boot line. There are 3 ways to do this:

1: If you are starting a fresh install from a CD and the installation pauses at the kernel_thread_helper line, you need to restart your computer.

When you boot from your installation CD, choose F6 before you continue trying out the LiveCD. This give you boot option at the bottom of your screen.

At the very end of the line add nolapic acpi=off and hit enter to continue booting from LiveCD. In most cases this should work.

2. The same problem may arise when you do a distribution upgrade or even a kernel upgrade. In that case you need to change your grub.cfg file. Follow these steps:

sudo nano /boot/grub/grub.cfg

Enter your sudo password and it will bring you to your grub menu configuration.

Look for the section that read similar to this:

menuentry 'Ubuntu, with Linux 2.6.38-11-generic' --class ubuntu --class gnu-linux --class gnu --class os {
 recordfail
 set gfxpayload=$linux_gfx_mode
 insmod part_msdos
 insmod ext2
 set root='(hd0,msdos6)'
 search --no-floppy --fs-uuid --set=root 337e2841-fc82-61b3-84be-5a9c71ae43b8
  linux   /boot/vmlinuz-2.6.38-11-generic root=UUID=337e2841-fc82-61b3-84be-5a9c71ae43b8 ro quiet splash vt.handoff=7
 initrd  /boot/initrd.img-2.6.38-11-generic
 }

You want to change the line that I have identified above to read:

linux   /boot/vmlinuz-2.6.38-11-generic root=UUID=337e2841-fc82-61b3-84be-5a9c71ae43b8 ro quiet splash vt.handoff=7 nolapic acpi=off

After adding these switches to the boot menu option, press ctrl-X, then save and exit.

This is for a permanent change if you can boot using an older kernel.

3: If you cannot login to an older kernel or recovery mode because of the kernel_thread_helper error,  you have to press “e” (without the quotation marks)  to edit the boot options when you get the grub menu.

For the kernel you want to use, edit the end of the line that reads

linux   /boot/vmlinuz-2.6.38-11-generic root=UUID=337e2841-fc82-61b3-84be-5a9c71ae43b8 ro quiet splash vt.handoff=7

to

linux   /boot/vmlinuz-2.6.38-11-generic root=UUID=337e2841-fc82-61b3-84be-5a9c71ae43b8 ro quiet splash vt.handoff=7 nolapic acpi=off

Press Enter and you should be able to boot.

Sep 192011
 

The latest version of Ubuntu is heavily based upon Unity environment. Unfortunately Unity has no track record of playing nice with existing gnome programs. For network applications such as VNC, Unity crashes the program with whole bunch of errors. These crashes are observed occasionally in the Ubuntu 11.04 (Natty Narwhal) release, and most certainly in the latest beta 1 release of Ubuntu 11.10 (Oneiric Ocelot).

If you have gotten comfortable with Ubuntu and want to continue using Gnome as the main environment, you can do so by using Linux Mint 11 (Katya). It has the same repositories as Ubuntu and you can even use the ubuntu-restricted-extras and build-essential packages which lets you obtain some of the fonts, codecs and libraries that Ubuntu fetches for you.

Ubuntu is starting to put more emphasis on making their release into an eye-candy, at the cost of reduced functionality. Having used Ubuntu since Dapper Drake days, its sad to ditch it for another distro. IMO Ubuntu 10.04 was the cleanest distro they put out – things have been going downhill after that. Linux Mint on the other hand picked up at the point when Ubuntu started to go dysfunctional. It has everything that Ubuntu should have been. There isn’t much to write about Mint 11. Its very similar to Ubuntu 10.04, has a newer kernel 2.6.38.xx, clean graphics, and the same repositories as Ubuntu. The transition is very easy, and things look a lot more neater in Mint.

To recap: If you are currently using Ubuntu and are afraid to upgrade to the 11.10 release, your fear is quite justified. Make a backup of your /home folder and go for a clean install of Linux Mint instead. I moved to Mint about a month ago and have had a rather smooth sailing so far.

May 112011
 

For the first time I was able to get VNC to work with Ubuntu with Gnome session instead of a xterm on gray background. The steps involved were exactly the same as I was following earlier, with one exception: the setup of xstartup in the ~/.vnc folder.

For your xstartup file in ~/.vnc (the “.vnc” folder in

your home directory), you need the following:

#—————————–

#!/bin/sh

# Uncomment the following two lines for normal desktop:

# unset SESSION_MANAGER

# exec /etc/X11/xinit/xinitrc

[ -x /etc/vnc/xstartup ] && exec /etc/vnc/xstartup

[ -r $HOME/.Xresources ] && xrdb $HOME/.Xresources

xsetroot -solid grey

vncconfig -iconic &

xterm -geometry 80×24+10+10 -ls -title “$VNCDESKTOP Desktop” &

gnome-session &

# twm &

#————————

instead of uncommenting the lines as the script suggests, you change the window manager to gnome-session

make sure restart vnc4server

The line which got Gnome working was “gnome-session &”

========================================

Now for all the steps involved (works in Karmic Koala Alpha 2, Ubuntu 9.10, kernel 2.6.30-10)

1. Install ssh server, ssh client, VNC viewer, VNC server, and xinetd

sudo apt-get install openssh-server openssh-client vnc4server xinetd vncviewer

2. Setup the ssh password for your login

ssh-keygen

3. Test out the ssh server by typing in

ssh localhost or ssh your_login@your_ip_address

4. Then create a vnc password

sudo vncpasswd ~/.vncpasswd

5. Edit the xstartup file in ~/.vnc directory

For your xstartup file in ~/.vnc (the “.vnc” folder in

your home directory), you need the following:

—————————–

#!/bin/sh

# Uncomment the following two lines for normal desktop:

# unset SESSION_MANAGER

# exec /etc/X11/xinit/xinitrc

[ -x /etc/vnc/xstartup ] && exec /etc/vnc/xstartup

[ -r $HOME/.Xresources ] && xrdb $HOME/.Xresources

xsetroot -solid grey

vncconfig -iconic &

xterm -geometry 80×24+10+10 -ls -title “$VNCDESKTOP Desktop” &

gnome-session &

# twm &

————————

instead of uncommenting the lines as the script suggests, you change the window manager to gnome-session

6. Create a VNC desktop

vnc4server :1 -geometry 1024×768

7. Then to tunnel into your VNC desktop, first create a SSH tunnel by logging into SSH with the comand:

ssh -L 5901:your_ip_address:5901 your_username@your_ipaddress

8. Finally, load up your VNC desktop

vncviewer localhost:1

And now you are ready to use connect to your machine remotely and use administer the computer remotely.

P.S: If you are using a firewall (hardware or software, you need to get enable port forwarding and unblock ports 22 and 5900-5999 on the Ubuntu machine to allow SSH and VNC to be accessed.

May 112011
 

Running scripts in serial order on a multi-core machine will take quite a bit of time. If the tasks are repetitive, the command can be run under GNU Parallel.

You can install it on RPM or Debian based distribution from the GNU Parallel repository. Install the binary that fits your flavour of Linux. Please note that even though the latest release of GNU Parallel has a flavour of Linux associated with it, it runs on most of the older AND newer distributions. For instance I was able to install the April 21st 2011 release of amd_64 RPM on a RHEL5 machine, and it ran just fine for that 8 core machine.

After installation you can try it out on a sample directory by running:

ls -d */ | sed ‘s/\///g’ | parallel zip -r -q {}.zip {}

This will recursively zip all the directories within a given folder, in parallel. By default, it will use up the maximum number of cores, but you can check the man pages of parallel to check how to employ N number of processors to run the task in parallel.

ls *.jpg | parallel convert {} -resize 75% -quality 80% {}

If you have imagemagick installed, you could save a whole bunch of space by converting some of the high-res images to a slightly lower resolution. The above example will resize the images to 75% of their original size with 80% quality. The original images will be overwritten by the resize and downsampled ones. While this is running, you can fire up htop in another terminal window to watch all the processors working in parallel.

Mar 152011
 

If you are on a network that has MAC addresses hardwired, i.e. you can only access the network if a certain MAC address is plugged into a specific ethernet jack on the wall, you don’t have too many options.

One option I used recently is spoofing the MAC address of your device. Its done by editing the hardware address to match the MAC address of the device that’s allowed on that ethernet jack.

If you are using Linux, make a note of your current IP address in a text file.

sudo ifconfig -a | grep eth0 > ~/Desktop/netaddressbak.txt

Run the same command on the device that’s attached to the network to find its MAC address: Lets say its – 01:82:39:B2:41:30

Before you attach your new device to the ethernet cable, change its MAC address to the one listed above.

sudo ifconfig eth0 down
sudo ifconfig eth0 hw ether 01:82:39:B2:41:30
sudo ifconfig eth0 up
sudo ifconfig eth0 | grep HWaddr

This should now list the address as 01:82:39:B2:41:30.

You can now attach this device on the network to gain full connectivity (unless there are some programs that are supposed to ping every once in a while).

Apr 192010
 

For the first time I was able to get VNC to work with Ubuntu with Gnome session instead of a xterm on gray background. The steps involved were exactly the same as I was following earlier, with one exception:  the setup of xstartup in the ~/.vnc folder.

For your xstartup file in ~/.vnc (the “.vnc” folder in
your home directory), you need the following:
—————————–
#!/bin/sh

# Uncomment the following two lines for normal desktop:
# unset SESSION_MANAGER
# exec /etc/X11/xinit/xinitrc

[ -x /etc/vnc/xstartup ] && exec /etc/vnc/xstartup
[ -r $HOME/.Xresources ] && xrdb $HOME/.Xresources
xsetroot -solid grey
vncconfig -iconic &
xterm -geometry 80×24+10+10 -ls -title “$VNCDESKTOP Desktop” &
gnome-session &
# twm &
————————

instead of uncommenting the lines as the script suggests, you change the window manager to gnome-session

make sure restart vnc4server

The line which got Gnome working was “gnome-session &”

========================================

Now for all the steps involved (works in Karmic Koala Alpha 2, Ubuntu 9.10, kernel 2.6.30-10)

1. Install ssh server, ssh client, VNC viewer, VNC server, and xinetd

sudo apt-get install openssh-server openssh-client vnc4server xinetd  vncviewer

2. Setup the ssh password for your login

ssh-keygen

3. Test out the ssh server by typing in

ssh localhost  or ssh your_login@your_ip_address

4. Then create a vnc password

sudo vncpasswd ~/.vncpasswd

5. Edit the xstartup file in ~/.vnc directory

For your xstartup file in ~/.vnc (the “.vnc” folder in
your home directory), you need the following:
—————————–
#!/bin/sh

# Uncomment the following two lines for normal desktop:
# unset SESSION_MANAGER
# exec /etc/X11/xinit/xinitrc

[ -x /etc/vnc/xstartup ] && exec /etc/vnc/xstartup
[ -r $HOME/.Xresources ] && xrdb $HOME/.Xresources
xsetroot -solid grey
vncconfig -iconic &
xterm -geometry 80×24+10+10 -ls -title “$VNCDESKTOP Desktop” &
gnome-session &
# twm &
————————

instead of uncommenting the lines as the script suggests, you change the window manager to gnome-session

6. Create a VNC desktop

vnc4server :1 -geometry 1024×768

7. Then to tunnel into your VNC desktop, first create a SSH tunnel by logging into SSH with the comand:

ssh -L 5901:your_ip_address:5901 your_username@your_ipaddress

8. Finally, load up your VNC desktop

vncviewer localhost:1

And now you are ready to use connect to your machine remotely and use administer the computer remotely.

P.S: If you are using a firewall (hardware or software, you need to get enable port forwarding and unblock ports 22 and 5900-5999 on the Ubuntu machine to allow SSH and VNC to be accessed.

Jul 032009
 

For the first time I was able to get VNC to work with Ubuntu with Gnome session instead of a xterm on gray background. The steps involved were exactly the same as I was following earlier, with one exception:  the setup of xstartup in the ~/.vnc folder.

For your xstartup file in ~/.vnc (the “.vnc” folder in
your home directory), you need the following:
—————————–
#!/bin/sh

# Uncomment the following two lines for normal desktop:
# unset SESSION_MANAGER
# exec /etc/X11/xinit/xinitrc

[ -x /etc/vnc/xstartup ] && exec /etc/vnc/xstartup
[ -r $HOME/.Xresources ] && xrdb $HOME/.Xresources
xsetroot -solid grey
vncconfig -iconic &
xterm -geometry 80×24+10+10 -ls -title “$VNCDESKTOP Desktop” &
gnome-session &
# twm &
————————

instead of uncommenting the lines as the script suggests, you change the window manager to gnome-session

make sure restart vnc4server

The line which got Gnome working was “gnome-session &”

========================================

Now for all the steps involved (works in Karmic Koala Alpha 2, Ubuntu 9.10, kernel 2.6.30-10)

1. Install ssh server, ssh client, VNC viewer, VNC server, and xinetd

sudo apt-get install openssh-server openssh-client vnc4server xinetd  vncviewer

2. Setup the ssh password for your login

ssh-keygen

3. Test out the ssh server by typing in

ssh localhost  or ssh your_login@your_ip_address

4. Then create a vnc password

sudo vncpasswd ~/.vncpasswd

5. Edit the xstartup file in ~/.vnc directory

For your xstartup file in ~/.vnc (the “.vnc” folder in
your home directory), you need the following:
—————————–
#!/bin/sh

# Uncomment the following two lines for normal desktop:
# unset SESSION_MANAGER
# exec /etc/X11/xinit/xinitrc

[ -x /etc/vnc/xstartup ] && exec /etc/vnc/xstartup
[ -r $HOME/.Xresources ] && xrdb $HOME/.Xresources
xsetroot -solid grey
vncconfig -iconic &
xterm -geometry 80×24+10+10 -ls -title “$VNCDESKTOP Desktop” &
gnome-session &
# twm &
————————

instead of uncommenting the lines as teh script suggests, you change the window manager to gnome-session

6. Create a VNC desktop

vnc4server :1 -geometry 1024×768

7. Then to tunnel into your VNC desktop, first create a SSH tunnel by logging into SSH with the comand:

ssh -L 5901:your_ip_address:5901 your_username@your_ipaddress

8. Finally, load up your VNC desktop

vncviewer localhost:1

And now you are ready to use connect to your machine remotely and use t

Jun 242009
 

The upcoming release of Ubuntu 9.10 (Karmic Koala) is in its Alpha 2 stage at the moment. One outcome of having an alpha released installed on your machine is the massive amounts of daily updates – with a major kernel update every once in a while. Things were going pretty smooth with the Karmic Koala until it was on 2.6.30-9 kernel.

Just this morning, there were a bunch of updates listed in the update manager. Among the things that were in line for the upgrade was a brand new kernel, 2.6.30-10. The updating process itself went pretty well. Then when it was time to restart, I picked the newly updated kernel from the Grub expecting nothing unusual.

Booting options after updating to kernel 2.6.30.10

Booting options after updating to kernel 2.6.30-10

After selecting Kernel 2.6.30-10, all I got was a green screen and the computer refused to do anything past that point. The only alternative was to restart and boot with the 2.6.30-9 kernel which I am currently using to make this post.

Ubuntu Karmic Koala (Kernel 2.6.30.10): Green Screen Of Death

Ubuntu Karmic Koala (Kernel 2.6.30-10): Green Screen Of Death

It not something one sees that often with Linux distros. I saw it today!

P.S.: The newer kernel 2.6.30-10 has been fixed. It boots and functions normally now.

Feb 112009
 

There were unmet dependencies (libx264-59) for vlc and mplayer in the latest release of Jaunty Alpha. A bug report was filed by several users on launchpad.net

One of the users posted this workaround to get both mplayer and VLC working in Ubuntu (9.04) Alpha 4.

To solve the problem, just get libx264 here:
http://packages.ubuntu.com/us/intrepid/i386/libx264-59/download
Just installed it manually (sudo dpkg -i libx264-59_0.svn20080408-0.0ubuntu1_i386.deb)
I then installed mplayer and vlc using medibuntu repos.

Running:

sudo apt-get install mplayer vlc

Gets these packages working!

Feb 102009
 

The system beep is one of the most distracting and annoying occurrences when you are doing some constructive work. Be it working in a text editor, or a terminal, or a program window – wherever a sound notification is programmed into any module, it emits a fairly audible beep. To disable the beep, we have to disable the PC speaker by adding it to the blacklist.

sudo gedit /etc/modprobe.d/blacklist

Add the following line to the end of that file:

blacklist pcspkr

Save and exit. Then in terminal,

sudo modprobe -r pcspkr

This completely turns off the speaker. You won’t hear your system beep, even if there is something truly wrong. If you are doing something critical and need to rely on the beeps, comment out the line from the blacklist and run the modprobe command. Beeping will restart.

Jan 302009
 

Until today’s kernel update to 2.6.28.6, the Atheros wifi card was not functioning correctly. Since the update to new kernel, the wifi card can now be used with the ath5k module which can be found in linux-backports-modules.

In order to get the Atheros 5007EG card to work, you first need to disable the built-in hardware driver.

System >> Administration  >> Hardware Drivers > Deactivate “Support for Atheros 802.11 cards”

Selection of Hardware Drivers in Januty

Selection of Hardware Drivers in Januty

Disable the Support for Atheros 802.11 cards

Disable the Support for Atheros 802.11 cards

After the card has been deactivated, open the terminal and install the backports modules for Jaunty.

sudo apt-get update && sudo apt-get install linux-backports-modules-jaunty

Install Jaunty backports modules

Install Jaunty backports modules

This adds the ath5k module which supports the Atheros 5007EG card.

The computer needs to be Shutdown and powered back on. Somehow Restarting doesn’t work at times. The card has to be completely powered down for a few seconds and then started during power up.

You should be able to see the available wireless network list by clicking on the network manager icon. Thereon, you all know what to do 🙂