Real-Time Data Collection Inside a MRI Scanner – February 10, 1999

One project that Jon did while working at Carnegie Mellon University was to create a "button box" that collected data from a subject inside an MRI scanner as well as data from the scanner itself.  The project was "real-time" in the sense that we needed the hardware and software to be accurate within 20 or 30 milliseconds (which depending on what field you are in, you might laugh at that number being "real-time").  We also partially defined "real-time" to mean "do it as fast as you can, log when you miss", rather than the hard real time definition of someone dies if you miss the deadline.  Some data from the scanner could be reconstructed post-experiment if occasional pulses were lost, but the system that ours was replacing was missing data too often (and also caused crashes if you unplugged it from the computer (parallel port) without shutting down the printer driver first).

The new system used a standard serial port, with prioritized packets, so the scanner data would be sent first, since it was most time critical, where the subject data (button pushes) could be delayed a bit without problem, since humans have a much slower response time than the scanner data, which generally came at 50ms intervals.

Since ferrous metal objects are not allowed inside the scanner room, we used a set of optical buttons for the subject, and then had a converter to standard TTL levels outside the scanner room.

The challenges for this project were to have the software (running on Windows NT) not take up too much processor time from the rest of the experiment software (displaying images, videos, sound files, etc.) and a secondary goal was to build a fairly indestructible box, at least from an electrical standpoint, as the previous boxes were routinely smoked out by plugging in the wrong AC adapter.  The new system ended up being able to be powered (ie. not only did it not "smoke", it would actually run perfectly fine) by AC or DC input at any voltage from 4V to 30V, with at least 300mA of current.  I have yet to hear of someone plugging in an adapter that broke the boxes.  A third goal was to create a circuit board and software that could handle two hardware configurations, one with three buttons, and one with four buttons.  The hardware was designed to have either three or four buttons attached to it, but the software ended up needing a compile-time flag to switch between modes.

The project was a huge success, and last time we checked, the customer was still using the boxes (10 years later).