Instructions For Installing AFNI are now here
If you have having software or hardware problems, submit a help ticket describing the problem.
Do not be afraid to request help from MSIT. They are paid to help you!
The link for help tickets is
For installing software, you will need to get administrator privileges. Use Directory Utility to set the superuser password (see http://support.apple.com/kb/HT1528 for details). Then reboot, try to login as user "root". This same password can then be used in X11 sudo.
Setting up a New Mac Computer
After MSIT has plugged in your spiffy new computer and completed the basic installations (Office, Outlook, etc), there are a few more steps to make sure everything is ready to go to analyze some awesome data. First you will need to make sure you have admin privileges on your computer so that you have the necessary permissions to install new software.
Setting up Mendeley
To help us share PDFs we use Mendeley + a shared Dropbox folder.
- Assuming you have a dropbox account, ask a lab member to share the folder "LabReferences" with you
- Go to http://www.mendeley.com, setup an account, and download/install the software
Once you have downloaded and installed Mendeley, we need to add a "watch folder" to Mendeley
- Open Mendeley
- File -> Watch Folder
- Navigate the file tree to Dropbox and check the LabReferences box
- Select OK
If you want to have your own copy of the PDFs (for annotations, etc), we need to setup Mendeley to organize your library into another directory
- Mendeley Dekstop -> Preferences
- Choose the File Organizer Tab
- Check the box for Organize my files and select an appropriate directory
- You may also check the boxes for "Sort files into subfolders" and "Rename document files" to have Mendeley create a more structured file hierarchy
When you have a PDF that you would like to share, simply copy it to the LabReferences/ folder in your Dropbox. Because all Mendeleys are watching that folder, it will be imported to everyone's library automatically.
NB: If people have setup their Mendeley to organize files into a separate directory, once you copy a file into LabReferences, you may not be able to "take it back."
For additional software you might like (Adobe Illustrator, EndNote, Parallels, etc), check the Installing Software section. If we don't have a valid license number anymore we may need to purchase a new one.
It is also a good idea to set up TimeMachine on your computer to backup everything to the Data 1 server. If you have Parallels already installed, go to TimeMachine > Options and exclude that folder from the backup.
Installing Psychtoolbox and GStreamer
Installing Psychtoolbox with Matlab
These instructions can be used to install Psychtoolbox 3.0 with Matlab (64-bit versions). You will need to have administrator privileges, as well as access to ms-nbafmri.
DownloadPsychtoolbox.m from the SoftwareISOs folder to the desktop.
- Ensure that you have write access for the pathdef.m file.
- Open a finder window and click on Applications
- Right-click on Matlab -->Get Info. At the very bottom, under Custom Access, make sure you have Read & Write access. If you do not, click the picture of the lock (bottom right corner), enter your password, and then change to the correct privilege. Click on the lock again to save your changes.
- Right-click on Matlab --> Show Package Contents. Right-click on toolbox --> Get Info. Make sure you have Read & Write Access.
- Open the toolbox folder. Right-click on local --> Get Info. Make sure you have Read & Write Access.
- Right-click on pathdef.m. Make sure you have Read & Write Access.
- Open Matlab, cd to the desktop, and execute the Download script.
- Accept all certificate requests and choose defaults during installation
- For running Psychtoolbox codes in the new version of Matlab (2013a and over), always use the full path to direct the code to the stimulus directory.
In order to run Psychtoolbox with 64-bit Matlab, you will need to install GStreamer. Not all versions of GStreamer are compatible! Make sure to use the one that's on the server (and make sure you don't update this file!)
- Double-click on
gstreamer-sdk-2013.6-universal.pkg in the SoftwareISOs folder.
- Proceed through the installation until you get to Installation Type (where it asks for your installation location). Click on Customize (at the bottom of the window) and click on any boxes that aren't checked. Finish the installation.
- To ensure that Psychtoolbox is installed correctly, you can test a demo by opening Matlab and typing
Installing Octave and Psychtoolbox
These instructions were tested under Mac OSX 10.7.4 with Octave 3.2.6 and Psychtoolbox (PTB) 3.0. They should be completed AFTER the initial UNIX installation steps, including installing XCode tools, including command line tools; this installs "svn" which is needed.
The instructions require access to ms-nbafmri, so make sure you are connected to the network via ethernet, UTHSC wifi, or have an open VPN connection
ms-nbafmri/data/SoftwareISOs (i.e., double-click the dmg file)
- Optional: In the Extras/ directory of the Octave dmg there is Gnuplot†, which is necessary if you want to make quick plots with Octave
ms-nbafmri/data/SoftwareISOs to the desktop
- Open Octave (default install is /Applications/Octave), cd to the desktop, and execute the Download script
octave-3.2.3:1> cd Desktop/
- Accept all certificate requests and choose defaults during installation
- Ensure PTB is installed correctly by testing a demo:
If you get an error at this step, it may be because PTB doesn't like your dual monitor configuration. Exit Octave, Change Display Mode to "Mirrored", then Open Octave and run the demo again
† If you try to plot from Octave (
plot( 1:10) ) and get an error about DYLD_LIBRARY_PATH, then we need to make one more edit for plotting to work:
sudo open -e /Applications/Gnuplot.app/Contents/Resources/bin/gnuplot
Find the line:
and replace it with
Save the file then relaunch Octave and try to plot again
If you want to use Psychtoolbox with Matlab (and who wouldn't?) a 32-bit version is needed; R2010a was the last 32-bit release. R2010 a located in the SoftwareISOs folder on the server. Follow the instructions in the UT_License.rtf file.
for Intel 32-bit OSX will do the trick) as well.
see Ismael for Instructions
How to get
Download from NeuroBehavioral Systems website (http://www.neurobs.com/)
Trial license is free and good for 30 days. Student version is $100 good for 1 year. You will need to place the order first and then fax/email them both sides of your student ID along with the order and invoice number, as well as the name and contact of your academic advisor. You will need to make an account first to be able to order. After you have successfully purchased the license, you must sign in under the lab ID to retrieve the access code.
Using two monitors
- In the Windows display settings (right click on Desktop --> Properties --> Settings), choose the second monitor and select "Extend my Windows desktop onto this monitor"
- Restart Presentation, then go to Settings --> Video and add another display (bottom of page) and choose the appropriate driver for each (top of the page)
- Make sure the second monitor (the one that will show the stimulus) is selected as the primary display device.
In addition to the software Help, and looking at previous codes written in the lab, questions may be asked from NeuroBehavioral systems by posting them on their forum. Usually they are very responsive and helpful. Other users may also post a response to your question.
From Settings-->Audio Choose Custom Mixer-->Primary Buffer
Otherwise there will be a ~20ms delay between the time of auditory stimulus presentation and the time that the voltage actually gets to the audio jack! This would be specially crucial for TMS experiments.
If you get an error when trying to play audio stimuli (something like "Device Is In Use") there is probably a strange interaction with Parallels.
This can be fixed in Parallels 7 by Virtual Machine/Configure/Sharing select all sharing options (Share Profile and SmartMount)
Response Button affecting Parallel Port
Make sure you set the response_port_output header parameter to false, otherwise whenever for example response button 3 in pressed, binary code of 3 (00000011) will be sent to the parallel port!
In SDL section, before begin type:
response_port_output = false;
Configuring Presentation to use USB for output
Attaching USB to the computer
The computer first needs the NI-DAQmx software installed - download NI USB-6501 (http://zone.ni.com/devzone/cda/tut/p/id/6913). Before you install anything, make sure you have .NET Framework 2.0 installed (available at: http://www.microsoft.com/downloads/details.aspx?FamilyID=0856EACB-4362-4B0D-8EDD-AAB15C5E04F5&displaylang=en). Under the installer features menu, the bare minimum is:
->.NET Framework 3.5 Lanugages
->.NET Framework 2.0 Lanugages
->.NET Framework 1.1 Lanugages
->ANSI C Support
You will have to restart after you install the software.
After the restart, connecting the device via USB, Windows will detect a "New Data Acquisition Device", and present you with a window offering several options. Select "Configure and Test This Device Using NI Measurement & Automation Explorer" and run a Self-Test when the window opens. If this passes, the USB device can now be used to control TMS through Presentation.
Configuring Presentation to use USB
Now we need to make a few adjustments to the settings. Under the 'Settings' tab, select the 'Port' option and find the 'Output Ports' box. In this box we need to have a total of 2 ports.
Add the first port, and make sure the following options are set:
Data source: port0
Register span: 1
Inversion mask: 0
Default pulse width: 5 ms
For the second port, the following options need to be set:
Data source: port1
Register span: 1
Inversion mask: 255
Default pulse width: 5 ms
Using Presentation via USB
The USB controller uses a new library Image:Beauchamp USB TMS library.pcl to control the TMS machine. A sample presentation you can use to test to the USB control of the TMS is available: Image:Beauchamp OhmanTMSScenario.sce. In this scenario, the up/down arrows are used to control the intensity of the TMS, while the space bar is used to toggle arming/disarming the device, and the return key is used to fire the device. The sample presentation can also be used to help write code in the future - perhaps the most important point is that it is no longer necessary to define an output port inside the pcl, including the Beauchamp_USB_TMS_library.pcl is sufficient.
Using and recording sound responses
Sound response buttons can be defined in Presentation using Settings-->Response-->Devices-->sound device (threshold or offset)
Once you chose "sound device" click on "properties" button to the left of "Devices" window and adjust the parameters. You need to choose the correct microphone from the pull down menu, set the threshold, ...
To record a sound response, check the "save responses" button and set the recording duration. Each response will be saved in a separate wave file. You can also check the button to save all responses in one wave file (in addition to the individual wave files).
Another way to record sounds is using:
duration = 1000;
base_filename = "some_file_name";
within a trial.
Parallels and Presentation
Presentation runs only under Windows, but can be run on a Mac using BootCamp OR virtualization software such as VMWare or Parallels.
Here are some benchmarks for a 2010 MacBook Pro with a 2.66 GHz Intel Core i7 and 4 GB RAM:
To assess performance under Windows 7, go to Control Panel/Performance Information and Tools.
Scores are on a scale from 1.0 to 7.9
calculations per second memory access Windows graphics 3D graphics for games hard drive
Windows 7 (boot camp)
windows 7 (parallels) (1 CPU, 1GB RAM)
windows 7 (parallels) (2 CPU, 2GB RAM)
To summarize, biggest hit is calculations per second and graphics.
Running Windows on a Mac
Get Ismael to help you
Connecting to the Lab Mac Server
The name of the Mac Mini server is ms-nbafmri (purchased 2012).
To connect, type Apple-K, then the server IP address.
The username is beauchamplab; ask MSB for the password. There are three share points:
- Backups Used for Time Machine Backups
- beauchamplab not used
- Data Where all lab data and stuff is stored.
Connect to all three (select all and click "OK"). Open a finder window and double click on "data", or open a Terminal window and type
Because hard disks fail, it is important to back up your files regularly. The best way to do this is to keep all important work on DropBox. Then there is one copy in the cloud and one your local machine.
It is also good to back up files on your Mac automatically, using Time Machine. Connect the Lab Mac Server (previous step) and make sure the Backups folder is mounted. Open System Preferences/Time Machine/Select Disk/Select "Backups"
Ask MSB to type in the admin password. It will not work with the beauchamplab password. You can exclude some directories from being backed up to save time and space. It is good to exclude the DropBox folder because this is already backed up by Dropbox.
If you have Parallels installed on your computer, you can tell Parallels (under the Preferences menu) not to back up the Parallels VM. This will save time because there is no real reason to back up Windows (can be easily reinstalled).
Configuring a New Mac Server
The lab's data is stored on three Promise Pegasus RAID systems attached to the Mac mini.
- January 2013: 12 TB (10 TB available with RAID5)
- June 2013: 18 TB (15 TB available with RAID5)
- May 2014: 32 TB
When installing a new RAID:
- Inform all users the machine will be down for a while
- Install all updates to the OSX
- Disconnect all RAIDs, then connect them one at a time and perform firmware updates
- Connect the new RAID
TimeMachine is used to back up on Pegasus RAID to the other. (This does not protect against failures of the Mac Mini but a new Mini is available quickly).
Individual Macs may also be backed up to the RAID. Go to OSX Server and turn on the Time Machine service, adding a share point. This share point can only be accessed with the admin password, assuming it is created with the admin password.
OsiriX is a DICOM viewer that may be helpful if you need to upload DICOMs, especially from a CT scan taken after electrode surgery with epilepsy patients. It can be downloaded from here:
This program is used for the structural equation modeling. If you plan on doing functional connectivity as part of your data analysis, this is a good program to have. You can download it here:
To utilize 1dSEM, click the R icon on the console, then locate the 1dSEM.R script in the AFNI folder and load it.
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/.
Printing Double Sided
On a new computer you may notice that the option to print two-sided is greyed out. To fix this, go to System Preferences, Print & Scan, select the printer, then press the Options & Supplies button. Under the Driver tab, click Duplex Printing Unit.
Dell 5100cn Color Laser Printer
Here is a copy of the manual
To use the printer, download the current drivers for your computer from the Dell website
Shortcut: drivers are on the server in
On Windows XP, you must first add a port, then configure the printer.
On Mac OSX, first run the Installer. Then open System Preferences/Print & Fax
Click the "+" button to add a printer, click on "IP" and enter the IP address (above.)
- Protocol must be Line Printer Daemon -- LPD
There are sometimes several drivers to choose from.
The PS (postscript) driver under Windows cannot collate.
The PCL driver does. So if you need to collate, use the PCL driver.
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.
HP Photosmart Color Inkjet Printer
Insert the installation CD into your computer and follow the instructions.
The Mac installation software is in /Volumes/data9/Software_isos/HPPrinter/HP Installer
The status of the printer can be checked at
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
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.
mount_afp -i afp://akingon@ipaddress/data9 data9
and now you can cd into data9
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:
IDLE (Python's GUI editor) is slow!
Displaying outputs on IDLE makes the loop very slow. Here is a test:
t0 = time.clock()
counter = 0
while time.clock() <= t0 + 1:
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].
Misc Unix Notes
Loops in tcsh are a handy way to automate data processing. Here is an un-commented example. The syntax varies from shell to shell.
set sdall = ( X Y Z P O R T Y)
set idx = 1
foreach ec (FL FM FN FQ FS FU FW FY FZ)
set sd = $sdall[$idx]
Here is a while loop for tcsh
set idx = 1
while ($idx < 10)