MRI Setup: Difference between revisions

From CCN Wiki
Jump to navigation Jump to search
Line 60: Line 60:
#Troubleshoot if necessary, because running the experiment will absolutely depend on the external USB keyboard being configured (see the next section)
#Troubleshoot if necessary, because running the experiment will absolutely depend on the external USB keyboard being configured (see the next section)


=== Keyboard Troubleshooting ===
== Keyboard Troubleshooting ==
Our fMRI experiments usually listen for events from the external keypad. However the laptop has a built-in keyboard as well, but the software only wants to listen to one of them at a time.
Our fMRI experiments usually listen for events from the external keypad. However the laptop has a built-in keyboard as well, but the software only wants to listen to one of them at a time.


Line 77: Line 77:
# Launch ptb3-matlab
# Launch ptb3-matlab


Now the keyboard should have been assigned a device number, and MATLAB should be able to detect it.  
Now the keyboard should have been assigned a device number, and MATLAB should be able to detect it. This sequence of actions is the basis for the steps described above in this document.


==== Other Potential Problems ====
==== Other Potential Problems ====

Revision as of 21:57, 26 July 2016

Checklist

Before leaving for the MRI Center, ensure you have the following:

  • Experimenter Laptop (check that you know its whereabouts prior to the scan date!)
  • Physical experimental stimuli (if any)
  • Contact information for all participants for that day
  • 100% certainty about what experiment you are running that day (it is possible that multiple fMRI experiments will be going on in the lab at any given time)

Travel to CTRC

Be sure to leave enough time to get yourself to the CTRC lobby, including time required to find a parking spot and walk to the building. Aim to be at the CTRC at least 45 minutes before the scheduled start of scan. A summary of local parking options can be found at http://www.bnmc.org/parking-bnmc. Not mentioned on this page are some more distant free options West of Main Street, if you don't mind a brisk 5-minute walk. You can probably find street parking on several of the streets off of North Street, including Linwood, Franklin, N Pearl and others.

Upon Arrival

Empty your pockets of anything metallic

Experimenter Laptop Setup

The laptop connects via USB to the Lumina console and via an HDMI video cable to the SensaVue controller box. The SensaVue box redirects video to the scanner bore display. The Lumina console masquerades as an external USB keypad and sends participant keypresses and scanner trigger events to the laptop.

Connect the HDMI cable to the laptop

This step can happen later, but you may as well do it now.

  1. Locate the Amazon-branded HDMI cable
  2. Plug it into the one-and-only HDMI port on the back of the laptop.
  3. Confirm with the scanner technician that the SensaVue controller box is turned on and is using the correct settings
    • If there is nothing showing on the fMRI scanner bore display when your laptop is running, then it is likely that either:
    1. The SensaVue box is not turned on, or is using an incorrect setting
    2. Your laptop is not using a mirrored display. Unless told otherwise, your laptop needs to be using a mirrored display. PsychToolbox does not work nicely with extended displays.

Boot up the laptop

  1. Boot Ubuntu 14.04
    • (This is the default)
  2. Log in as the experimenter on the laptop

Connect the Lumina console to the laptop

  1. Locate the white USB cable in the back of the Lumina console
  2. Plug the other end into a USB port in the laptop

Configure Lumina console settings

  1. Set the Lumina controller to send the expected signals
    • The Controller Mode should be set "As Keyboard"
    • Toggle the Using to E-Prime

Check that the keypad is sending signals to the laptop

Before you enter the Magnet area, ensure that you are metal free!

  1. Find the two 2-button response boxes are in the scanner room
    • They are likely to be found attached to the wheeled display mount stand
    • If they are not attached, ask the technician for help setting them up
    • Examine the button boxes closely. You will see they are labeled L (blue/yellow) and R (red/green)
  2. Launch the text editor to provide some sort of environment in which you can type with the external keypad
  3. Click the button box keys
    • If the Lumina controller is set correctly, you should see a series of 1's to 4's, depending on which buttons you push

Launch MATLAB with PsychToolBox

  1. Open a terminal
  2. Navigate to ~/Documents/MATLAB/Experiment_Name
  3. Launch MATLAB with the ptb3-matlab script:
ptb3-matlab

Obsolete Steps

When starting out, we had extra steps to check to make sure that the laptop was receiving the correct signals and that MATLAB was listening for them. For established MATLAB scripts, the steps below aren't really needed anymore. Still, they're recorded for posterity.

  1. Run the keyboard test script
>>keyboard_info
    • The script will give you a number of potential keyboards to test out. Select Cedrus Corporation Lumina Keyboard (see troubleshooting section below if there are more than one matching keyboards)
    • One of the experimenters should press each of the keypad buttons while the other monitors that the button presses are registering in MATLAB
    • Even more clever: if the SensaVue display is already routing video to the scanner bore display, you can push the keypad buttons and see the display for yourself (albeit in a mirror-image). This method only requires one person, and less shouting.
    • If the Lumina box is configured correctly to send E-Prime signals, the key-presses should be showing up as the numbers 1 to 4 (the scanner trigger will register as a ^6)
  1. Troubleshoot if necessary, because running the experiment will absolutely depend on the external USB keyboard being configured (see the next section)

Keyboard Troubleshooting

Our fMRI experiments usually listen for events from the external keypad. However the laptop has a built-in keyboard as well, but the software only wants to listen to one of them at a time.

If the external USB keyboard has not yet been connected, the scripts will default to listening to the laptop keyboard. We can simulate the scanner room events by pressing the laptop keyboard buttons:

  • A laptop keypress of '6' simulates a scanner trigger (the experiments often wait for this trigger signal to synchronize the experiment with the scanner)
  • Keypresses of 1, 2, 3 or 4 simulate the participant button box responses (see below), which you might need to do if the experiment script waits on participant responses

Keyboard Voodoo

I'm not 100% sure about what, if any, rules govern how PsychToolbox + MATLAB + Linux juggle their keyboards. The problem is that the scanner triggers and the participant button boxes appear as an external keypad, but the laptop has it's own internal keyboard that's critical for being able to type useful commands. PsychToolbox only wants to listen to one at a time, and there was some mystery about how you would force it to listen to the right keyboard at any particular point in time.

I've tried a couple experiments, changing the sequence of when the external keyboard should be plugged into the experimenter laptop. I haven't seen any documentation about this, which is why I call this section Voodoo, however the following procedure seems to work:

  1. Boot up the laptop up with the external keyboard disconnected
  2. Log in as the experimenter
  3. Plug in the external keyboard
  4. Launch ptb3-matlab

Now the keyboard should have been assigned a device number, and MATLAB should be able to detect it. This sequence of actions is the basis for the steps described above in this document.

Other Potential Problems

One thing I ran into (which may not be an issue with the input device used at the scanner), but my external keyboard had 2 entries when I ran the keyboard_info script. Moreover, when I tested both of those keyboard device IDs using the keyboard_info script, only ONE of them sent keystrokes. By chance, on one occasion, it was the device with the higher ID. However if there are multiple keyboards with the same name the experiment script might accidentally tune into the device that doesn't send any key strokes (this happened on one of my tests). When I unplugged/plugged in the keyboard and restarted MATLAB, new device IDs were assigned, and this time it worked okay. The moral of the story is to make sure that you have only one matching external keyboard, but if you don't (for some reason), to check that the entry with the smaller device ID gives you input when you run the keyboard_info script. If not, quit Matlab, unplug, plug in, and restart until the problem is resolved.

Display Setup

  1. An HDMI cable (Amazon.com branded) should be poking up through the desk. Connect it to the HDMI port on the laptop (there is only one port that this cable can possibly fit into)
  2. Participants will typically be looking at stimuli presented on a display positioned at the head of the scanner
  3. Ensure that the stimuli are projected in the correct orientation
      • Because they are looking through a mirror, the image will have to be flipped horizontally
      • Depending on the mirror attached to the head coil, the image may also need to be flipped vertically
      • The SensaView display control box has a series of 4 toggle buttons that control the display
      • The most likely orientation is marked with a piece of tape on the SensaVue control box. Double-check with the scanner technician to confirm
        • The 16-channel head coil requires the image to be LR flipped; the 32-channel coil requires the image to be LR and TB flipped

Audio Setup

We have not yet run an experiment with auditory stimuli, so this is not yet sorted. However a sketch of the procedure will entail playing a test script that presents some auditory items, and having one of the scan team listen over the MRI headphones while the other runs the script.

Troubleshooting

  • Whether or not the external keyboard is plugged in at the time that you launch MATLAB seems to dictate whether or not MATLAB will see it
    • If you are finding that the keyboard check script is not detecting the external USB keypad, relaunch MATLAB, ensuring that the USB keypad is plugged in when MATLAB is launched
  • If all else fails, reboot the laptop
  • Its helpful to have important experimental parameters specified in an external configuration file, rather than hard coded in a script. This approach is employed in the LDT experiment. Apparently, the getExperimentConfig.m function requires that this file is edited in a text editor like gedit, rather than using the MATLAB editor. Changes made using the MATLAB editor will cause a parsing error.