Wednesday, October 24, 2018

Designing and 3D Printing Custom Lens Holders

There are often times when subjects require corrective lenses in order to properly perform tasks while inside the MRI machine. We purchased a pair of MRI-safe goggles with interchangeable lenses some years back (see Note #1) and using them with our 12 channel head coil is easy because the inner diameter of the coil is large enough to comfortably fit the subject, a support pillow, and the goggles without any issue.

Figure 1 - MRI-safe goggles with prescription lenses

Using them with the 32 channel head coil however, is considerably more difficult to do. It is already hard enough to fit a subject comfortably inside the coil with support padding, so attempting to include the goggles as well is simply not an option. To solve this problem we designed and machined lens holders (Figures 2 and 3) that fit inside the eye sockets of the 32 channel coil. They're easy to set up and the fit is snug so that they don't move. Sometimes we use a velcro strap to keep them together but it's not required.

Figure 2 - 32 ch coil lens holder with velcro strap

Figure 3 - lens holders inserted into coil eye sockets

Problem solved, right? Ah but what if these holders break? What if other researchers have this same issue but don't have a mechanical engineer on staff who can design and machine pieces like these? The best solution to both of these scenarios (and many more!) is to create 3D CAD models and make them available for anyone to download. So let's get started!

Recreating Parts in Tinkercad and Blender

Tinkercad is a free, easy-to-use 3D CAD design tool that works in your browser and uses Boolean addition and subtraction of simple shapes to allow the creation of more elaborate models. I have to be honest, I am more comfortable with Blender, which is also free, but Tinkercad is far easier to pick up and ideal for (relatively) simple designs like these holders. I had zero experience with Tinkercad beforehand but doing their tutorials for about an hour familiarized me enough with their UI to complete the project. Using calipers to get as accurate as possible, I measured the various dimensions of one of the holders and after a few hours I came up with the following design:

Figure 4 - Lens holder in Tinkercad

Not too shabby, right? I know it's hard to get a sense for 3D models in pictures but hopefully you can make out some details. If not, no need to worry. I'll provide a link later on so you can download the model yourself and take a closer look. The next step is to export the model to Blender and bevel some edges to make for a smoother fit inside the eye socket. Beveling is not an option in Tinkercad (See Note #2) so importing the STL file to Blender is the easiest way to finish it up.

Figure 5 - Beveling in Blender

After beveling, the final step in this section is to duplicate the part and mirror it about the X axis to create the second holder.

Figure 6 - Duplicating and mirroring in Blender

The hardest part of this project is done, though we can always make changes should the need arise (See Note #3). Now it's time to manufacture the pieces.

3D printing the Holders

It's possible to take drawings to a machinist and have them create the parts out of nylon or some other plastic but if you've got a 3D printer handy than the best/easiest solution is to print them out yourself in just a few hours. I even printed a few versions using different material to see which one suited our needs best.

Figure 7 - Holders printed using PLA 
Figure 8 - Holders printed using PETG

Figure 9 - Holders printed using NylonX

Although it may look like all I did was print the same thing in three different colors, there's more than meets the eye! Figures 7, 8 and 9 are images of completed lens holders printed using PLA, PETG and NylonX, respectively (See Note #4). Printing the pieces in NylonX was the best solution because of its durability and flexibility, allowing for the holders to be crammed into the eye sockets and thicker lenses to be placed inside them without fear of breakage. Below are images of a thin lens and a thick lens held securely inside the holders (See Note #5).

Figure 10 - Top view of lens in NylonX holders

Figure 11 - Side view of lens with different thicknesses

There you have it! Hopefully these designs are a help to other research groups looking to use corrective lenses alongside their 32 channel coil. Here's the link to the original Tinkercad design for those that are interested, but be aware that the design would still need to be beveled, duplicated and mirrored before it's ready. This Dropbox link contains the Blender file with the two finished pieces as well as stl files for each individual piece. I would suggest bookmarking the link since I plan on adding the designs for our mirror holders soon. So be on the lookout for those blog posts in the future as well!


#1 The merchant we purchased the interchangeable MRI-safe goggles from has since gone out of business, but a quick Google search returns other vendors with similar products.

#2 Technically you CAN create a beveling effect using some tricks but it is far more trouble than it's worth.

#3 It's easy enough to go back and alter the dimensions of the piece if need be -- that's what I did! The design was revised several times before I found the best fit. You may have to do this as well depending on the shape of the lenses you are using, just make sure you edit the areas that hold the lens and not the ones that secure the holder to the eye socket.

#4 The only 3D printer setting worth changing from whatever default you have is upping the infill to 100%. As with any print that gets handled quite often, you'll want them to be dense and sturdy so it can take a bit of abuse.

#5 If you're still having trouble with fitting thicker lenses then increase the height of the small square in the middle of the Tinkercad piece by a few millimeters until you find a value that works

Monday, July 16, 2018

Eye Tracking with Arrington

This blog post will cover the basic principles behind eye tracking, the customization done to our Avotec eye tracking system, and it’s use in conjunction with Arrington’s Viewpoint software to obtain simultaneous eye tracking data during an fMRI experiment.

Why collect eye tracking data?
The use of simultaneous eye tracking is common in vision fMRI experiments where frequent eye movements are expected, but it can also be a useful way to monitor alertness in your subject. Resting-state fMRI scans in particular, where it is generally assumed that the subject is awake with their eyes open, can benefit greatly from monitoring subject eye movement in real-time. Catching your subject asleep two minutes into a ten-minute EPI can be disheartening, but it’s better than finding out after the fact that you wasted 10 minutes and their data is unusable. (See Note 1)

How does eye tracking work?
In a typical system, near infrared (IR) light is used to produce corneal reflections that can be monitored and recorded by a camera, producing a time series of the pupil diameter for the target eye (See Note 2). For some applications, such as compliance with instructions during a resting-state scan, sufficient information may be obtained from a simple bore-mounted optical camera directed at the subject’s face. In either case, however, it is necessary to ensure that the monitoring system does not interfere with visual stimuli or other peripheral equipment essential for fMRI, a requirement that can be challenging in the cramped space in and around a typical MR head coil. The Avotec unit is not affected by these limitations because of its design, though we still modified the unit in order to optimize performance. Our EyeLink unit (which may be the subject of a future post) however did have to be heavily modified before it could even be used in our facility.

The Avotec RE-5601 Eye Monitoring System
Avotec’s system uses special mirrors that allow IR light to pass through the front of the carriage whilst simultaneously allowing the subject to view images on a rear-facing projector system. Their RE-5601 model has since been discontinued and replaced with the RE-5700 unit, so the modifications we’ve done may not be required/ideal/possible with that unit.

Figure 1 - Original Avotec mirror system (left) and the mirror system after our modifications (right)

The most obvious modification made was completely scrapping the carriage and re-making it in black nylon; which is a bit sturdier and the opacity eliminates ambient light interference. The green felt on the sides minimize unwanted reflections and the lens of the camera was replaced with an after market one from Avotec. Design changes were made to the separate camera stage so as to allow for a greater degree of freedom to adjust the camera and IR source independently of each other. The basic idea of Avotec’s design remains intact but the changes made led to a significant improvement in image quality and a reduction in setup time.

Figure 2 - Modified Avotec mirror and camera on 12 Ch. Siemens coil 
Figure 2 features the mirror system and camera attached to our 12 Ch. coil. The camera and IR source cables are wrapped in a protective plastic sheath to help minimize strain on the sensitive fiber optic cables. Although not common, it is also possible to use this mirror for non-eye tracking experiments by leaving the camera unit off.  Figure 3 shows our custom mirror for the 32 Ch coil. It’s the same basic idea, with a base to secure the camera and IR sources, but several other factors had to be considered when designing it to fit within the bore of the magnet.

Figure 3 - Modified Avotec mirror for 32 Ch. Siemens coil
The eye tracker interface unit sits on the side of the bore during experiments, see Figure 4. Nylon casings were fixed onto the connectors and an extended platform (where the camera is sitting in the photo) were added after several incidences of the unit being damaged and cables coming loose. This might seem like overkill, but sometimes it’s necessary for a piece of equipment that contains fiber optics and gets used as often as this.

Figure 4 - Eye tracking camera interface with support structure and modifications
Setting up the Avotec camera and recording
Even before we made any of our modifications, the Avotec system was quick to set up. The mirror slides easily into position on the coil and it is just a matter of finding the subject’s eye, focusing on it and adjusting the IR illumination to eliminate as much shadow as possible. The issue of shadows on the subject’s face can be a problematic source of frustration, however. Shadows cause the camera to lose sight of the subject’s eye, figure below, so adjusting to eliminate as much as possible from the get go is strongly recommended even though it can take some time and fine-tuning. Our modifications allow some adjustment to the camera and IR source, so I recommend allocating at least 10 minutes to eye tracking setup and optimization.  The position and lighting shown in the figure below is an accurate representation of the image quality required for obtaining proper eye tracking data.

Figure 5 - Example of excessive (left) and acceptable (right) shadow  
A video demonstration of both acceptable and unacceptable shadow can be seen by clicking on the corresponding links (see Note 3).

The Avotec unit came with Arrington’s Viewpoint software. Once the subject’s eye placement and illumination is within acceptable parameters (see Note 4), recording data is a simple matter of clicking a button at the start and at the end of a scan.  A calibration sequence should be performed often (see Note 5) and it’s recommended that each scan be recorded separately to keep the file sizes manageable. Figure 6 is a screenshot of the program and the sort of information that is displayed and collected. 

Figure 6 - Viewpoint software screenshot
Don’t forget Voltage Pro!
The final piece of the puzzle is easily one of the most important. Arrington also sells a separate add-on, though it should really come standard with the system, package called Voltage Pro that is absolutely essential for fMRI and eye tracking data.

Figure 7 - Voltage Pro Add-on
Once installed, Voltage Pro inserts a marker into the eye tracking data set every time it receives a TTL signal from the MRI equipment. This allows researchers to sync up eye tracking data to the start of data acquisition with relative ease, so long as the add-on is opened before recording starts.  Once data is collected it is saved as a .txt file, see below, that can easily be imported to other programs for analysis.

And that’s it! Hopefully this encourages more users to consider acquiring such useful data. While significant modifications were done to the unit, it is still quite recognizable as the same system. The same cannot be said, however, for the Eyelink unit that we purchased some years back. But that is a post for another day!

Note 1: An even worse scenario would be unknowingly using the sleepy subject data set in your study!

Note 2: Some eye trackers are capable of capturing data from both eyes. Our Avotec system does not have this option.

Note 3: These videos were intentionally taken before any calibration was done, since the primary focus was to showcase the issue of shadow, and I was unfortunately not able to zoom in on the image of the eye before posting. Because of this all information present on the screen other than the video image should be disregarded.

Note 4: From previous experience, research groups have their own parameters for what is and is not considered acceptable when acquiring eye tracking data.

Note 5: my recommendation is to run it before every scan, but time does not always allow for that.