Beauchamp:Software Installation: Difference between revisions

From OpenWetWare
Jump to navigationJump to search
Line 103: Line 103:


Optseq2 is a program in the FreeSurfer package for generating random stimulus sequences. In the homepage, you can download the program, view a .ppt w/ more information, and some practice exercises: http://surfer.nmr.mgh.harvard.edu/optseq/
Optseq2 is a program in the FreeSurfer package for generating random stimulus sequences. In the homepage, you can download the program, view a .ppt w/ more information, and some practice exercises: http://surfer.nmr.mgh.harvard.edu/optseq/
Open a terminal window to run the program w/ Unix commands. Set the following parameters:
set tr = 2 (or however many seconds for each trial)
set numev = 30 (or however many trials of each stimulus you will show each run. For example, if 150 trials/run, and 4 stimuli, you could have 30 stimuli/run. numev = 30)
set numtar = 20 (however many trials of a target stimulus you want to show per trial. The target is an extra stimulus that the subject will respond to just to make sure they're paying attention. Here, there's 150-120 = 30 trials left over, so we can make 20 of those target trials. The remaining 10 trials will automatically be made into control trials.)
set out = Example (whatever you want your filename to be)
Then, you'll run the program (change the 1st line if optseq2 isn't in Applications/freesurfer/bin):
/Applications/freesurfer/bin/optseq2  \
--tsearch 0.001 \
--psdwin 0 16 2 \
--nkeep 8 --o {$out} \
--ntp 150 --tr {$tr} \
--polyfit 2 --focb 1 \
--ev stimulus1 {$tr} $numev  \
--ev stimulus2 {$tr} $numev  \
--ev stimulus3 {$tr} $numev  \
--ev stimulus4 {$tr} $numev  \
--ev stimulus5 {$tr} $numev  \
--ev target {$tr} $numtar 
tsearch is the number of hours you want the program to run. nkeep is the number of total runs. ntp sets the number of trials/run.
Since there are 8 runs in this example, there will be 8 output files which look like Example-001.par . Each file will have 5 columns. Left-most column has the exact time (in seconds) that the stimulus is shown, 2nd column
In this example, 6 output files will be created


== Caret ==
== Caret ==

Revision as of 13:39, 4 August 2008

Brain picture
Beauchamp Lab Notebook






Updating AFNI

AFNI is frequently updated, so it is important to make sure you have the most recent version. Here is an easy way to update (for Intel Macs):

 set pkg = macosx_10.4_Intel
 wget http://afni.nimh.nih.gov/pub/dist/tgz/{$pkg}.tgz
 tar xvfz {$pkg}.tgz

Optionally, it can be good to test the new version BEFORE overwriting the old version. Here is how we can test SUMA:

 cd macosx_10.4_Intel
 ./suma

If it works, we copy it over the old version (type "which afni" if you are not sure which directory afni is in)

 mv macosx_10.4_Intel/* /Applications/AFNI/
 rm -r macosx_10.4_Intel  macosx_10.4_Intel.tgz

Configuring a New Mac

Ismael will install a basic set of software, including Microsoft Office, if asked.

Software that you MUST install (in this order): XTools, fink, AFNI, FreeSurfer

Software that may be handy to have: Parallels; Adobe Creative Suite; Firefox; Skype

To install software, it may be necessary to have a root password. To create one, type sudo passwd root

If you like a shell different than bash, the terminal program can be configured to use any shell.

XTools

X11 is the display system for Macs and most Unix machines. XTools is a programming environment for the Mac that includes useful compilers and other tools. To install XTools, find the Install Disc that came with your Mac, go into the System Installation Packages folder, and install the pkg file named XTools.


Optional Installs--> Xcode Tools--> XcodeTools.mpkg

AND

Optional Installs--> Xcode Tools--> Packages--> X11SDK.mpkg

http://trac.macosforge.org/projects/xquartz

1. XcodeTools and X11SDK from the Leopard DVD. 2. Maybe the latest X11 package from trac.macosforge.org 3. glib2-dev glib netpbm openmotif from fink (stable source will do). 4. mesa mesa-libglw mesa-libglw-shlibs mesa-shlibs from fink (unstable source).

Fink

Fink is a program package manager for Macs. Download the program from the Fink webpage:

http://fink.sourceforge.net/.

The program in the dmg file will be straightforward. You can copy finkcommander to the applications folder for a GUI interface. You should update your libraries every few weeks by running the following: fink selfupdate; fink update-all

To add it to your patch, add source /sw/bin/init.csh To your .cshrc file.


Installing Required Libraries for AFNI

Type the following line to have Fink grab the newest versions:

fink install glib2-dev glib netpbm openmotif3
fink wget

AFNI

AFNI is a suite of programs developed at the NIH for the analysis of functional neuroimaging. The best place to go for installation directions is AFNI’s instruction website:

http://afni.nimh.nih.gov/pub/dist/HOWTO//howto/ht00_inst/html/index.shtml

Unlike the NIH, we install AFNI to the /Applications/abin folder, rather than the local folder of each user. If you want the most up to date version, click the link for compiling AFNI under Mac OS X. You should also check the download webpage each month for updates:

http://afni.nimh.nih.gov/pub/dist/tgz/

To include AFNI in the path, paste the following line into a terminal window:

echo 'set path = ( $path  /Applications/AFNI )' >> ~/.cshrc

FreeSurfer

FreeSurfer is another set of programs developed at NIH for the analysis of functional neuroimaging. We mainly use it for cortical surface reconstruction. Their download page is part of an extensive wiki that describes its many functions.

https://surfer.nmr.mgh.harvard.edu/fswiki/Download

Updates to the software are normally posted on the listserv. To set the correct paths for Freesurfer paste the following lines into a terminal window:

echo ‘setenv FREESURFER_HOME /Applications/freesurfer‘ >> ~/.cshrc
echo ‘source $FREESURFER_HOME/SetUpFreeSurfer.csh' >> ~/.cshrc

optseq2

Optseq2 is a program in the FreeSurfer package for generating random stimulus sequences. In the homepage, you can download the program, view a .ppt w/ more information, and some practice exercises: http://surfer.nmr.mgh.harvard.edu/optseq/

Open a terminal window to run the program w/ Unix commands. Set the following parameters: set tr = 2 (or however many seconds for each trial) set numev = 30 (or however many trials of each stimulus you will show each run. For example, if 150 trials/run, and 4 stimuli, you could have 30 stimuli/run. numev = 30) set numtar = 20 (however many trials of a target stimulus you want to show per trial. The target is an extra stimulus that the subject will respond to just to make sure they're paying attention. Here, there's 150-120 = 30 trials left over, so we can make 20 of those target trials. The remaining 10 trials will automatically be made into control trials.) set out = Example (whatever you want your filename to be)

Then, you'll run the program (change the 1st line if optseq2 isn't in Applications/freesurfer/bin): /Applications/freesurfer/bin/optseq2 \ --tsearch 0.001 \ --psdwin 0 16 2 \ --nkeep 8 --o {$out} \ --ntp 150 --tr {$tr} \ --polyfit 2 --focb 1 \ --ev stimulus1 {$tr} $numev \ --ev stimulus2 {$tr} $numev \ --ev stimulus3 {$tr} $numev \ --ev stimulus4 {$tr} $numev \ --ev stimulus5 {$tr} $numev \ --ev target {$tr} $numtar

tsearch is the number of hours you want the program to run. nkeep is the number of total runs. ntp sets the number of trials/run.

Since there are 8 runs in this example, there will be 8 output files which look like Example-001.par . Each file will have 5 columns. Left-most column has the exact time (in seconds) that the stimulus is shown, 2nd column In this example, 6 output files will be created

Caret

Go to Caret's Download Webpage, register for an account, and download the newest release. Copy the caret folder to the Applications folder on your machine and add the following line to your .cshrc file:

  set path = ($path /Applications/caret/bin/)

Creating Symbolic Links

It is useful to have symbolic links from the command line so you do not need to type the full path to a file. The program ln creates such symbolic links. Here are a couple of examples:

ln –s /Volumes/data9/surfaces/ /surfaces
ln –s /Volumes/data1/UT /UT

The paths are now linked to /surfaces/ and /UT/.


Installing the Dell Printer Drivers

The application Dell 5100cn Installer is on data9. The printer IP is 129.106.236.253 To see the current status of the printer go to http://129.106.236.253

Here is a copy of the manual http://openwetware.org/images/8/83/Dell_5100cn.pdf


Mounting RAID Volumes from Windows

You must have a Mac with a valid user account. On the Mac, go to System Preferences, Sharing, and enable Windows Sharing. The menu should say

 Windows users can access your computer at \\XXX.XXX.XXX.XXX\YYY

For Mac OSX 10.5, go to System Preference, Sharing. Enable File Sharing. Click the "+" button and add your user to the list of Users; change permissions to be Read & Write. Click on Options and Enable "SMB" which is what Windows uses. Click the user name (you will be prompted for your password).

You may also need to able your user account. Look for the message

 Enabled accounts: Ashley Kingon

If your account is not enabled, click on the "Accounts" button and enable it.

Additional steps for Windows VISTA:

Go to the the Start menu and choose 'Computer'

Go to Computer: Local Disk (C:): Windows: regedit

After clicking on the registry editor application:

 Go to HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Lsa
 Click on LmCompatibilityLevel
 Set value to 1
 Restart computer

In Windows, go to Internet Explorer and type in the URL above.

Mounting a Volume after sshing to a different machine

For example. I ssh onto tellmore machine. Now I want to access data9 from his machine.

in my home directory (~) (on tellmore) I make a directory called mount, inside of mount I make a directory called data9 (or which ever volume I am mounting), then I mount data9.

cd ~
mkdir mount
cd mount
mkdir data9
mount_afp -i afp://akingon@129.106.236.180/data9 data9
enter password 

and now you can cd into data9

Installing Matlab

To install Matlab for use in the Beauchamp lab:

1. Download and install matlab here. Get login name and pw from Mike
Note: you will be prompted to install Java run-time environment 5. This will ease the installation.
2. Place license.dat in the MATLAB folder when prompted.
3. Find out that Matlab is already on the computer and cancel installation.


Lab Printer

The lab laser printer is a Dell 5100cn with IP address 139.52.6.205 You can check the printer status by going to http://139.52.6.205 In Windows, you must add a Port with this address, then install the correct printer driver and tell it to print to the port. On the Mac, go to System Preferences, Print & Fax, Click the +, Click IP, enter the IP into the address field.


Magstim Rapid TMS

This is our TMS (Transcranial Magnetic Stimulation) machine from Magstim company, UK. The front panel controls are:

1.Standby
2.Run (arm, bring out of standby)
3.Stimulus intensity control
4.Trigger

Alternatively to trigger the device, a TTL pulse can be sent to the "Trigger In" port in the back of the device with a BNC connector.

The machine can also be controlled externally via the 36pin Centronics connector in the back panel. A Parallel printer cable can be used/made with a DB25 male connector on one end to connect to PC Parallel Port and a Centronics 36pin male connector on the other end to connect to Magstim Rapid.

NOTE: ECP/EPP needs to be selected for the Parallel Port in BIOS.

A 5V input should be connected to Pin 1 of the Centronics connector to gain external control (either from an external source or by downstepping the available 12V at pin 15 of the Centronics connector.

A 7 bit binary code through pins 2-8 can set the stimulus intensity (only values between 10% and 100% should be used, for example 0110010 for 50%)

Pin 9 is used for triggering by applying a 0.

Magstim instruction manual advises NOT to use the BNC trigger input when using this trigger instead.

Pins 14 and 31 of the Centronics connector can be used to arm and standby the device respectively. Magstim instruction manual advises NOT to use these features because of possible safety issues. However we noticed that when the TMS coil is in the magnet, many a time the inducted signal by the scanner puts the TMS device on standby. Therefore it needs to be armed again to deliver TMS pulses during the gap between scans. So it seems using pin 14 to arm the device is inevitable.

A number of digital and analog output signals are also available at the port including coil temperature and capacitor voltage. See Magstim instruction manual.


Python

Path:

import sys
sys.path # this will show the current path settings
sys.path.append('C:\new_path') # this will add the new path, however only until the 
                               # current python session is open

To more permanently add a path, use the Windows environment variable PYTHONPATH

Control Panel --> System --> Advanced tab --> Environment Variables (Bottom of page)--> System variables --> look for PYTHONPATH, if it does not exist, use NEW to create it. Use semi-colon to add multiple paths:

C:\path1;C:\path2

IDLE (Python's GUI editor) is slow!

Displaying outputs on IDLE makes the loop very slow. Here is a test:

import time
t0 = time.clock()
counter = 0
while time.clock() <= t0 + 1:
    print "junk"
    counter += 1

Running this code on my 2GHz laptop, results in < 400 Hz loop rate using IDLE. Whereas rate is as high as 15 KHz if the code is run from the command line (by double clicking on the python file).

This is very important when detecting a fast event. For example reading parallel port to detect the TTL pulse from MRI scanner [the philips 3T scanner's pulse is currently only 75 microseconds long].