Wednesday, February 17, 2021

Recording End-Tidal CO2 and O2 using BIOPAC

In an article published last year, Ken Kwong's group announced a new method for performing cerebrovascular reactivity measurements using breath holds. This "breath-by-breath exchange ratio" method was shown to be as good as the gold standard endogenous CO2 stimulus method for CVR:


Over the past few months, my colleagues and I have been working on a way to replicate this method using BIOPAC hardware. Our facility has already been using the BIOPAC system to record physiological data from our subjects so incorporating these new features into our existing setup would be the smoothest option. If you're interested in building your own setup, either from scratch or you already have a BIOPAC unit on hand, this post will outline the equipment purchased and the design we came up with While it does require a bit of work to put together, it is simple to use and the physiological data it records should benefit all fMRI researchers

BIOPAC and Acqknowledge

BIOPAC has been our go-to system for recording physiological data for quite some time. The MP150 model we have has been discontinued and replaced with the MP160. In addition to the base system, two additional modules must be purchased, these are the O2100C and the CO2100C. The company states the modules can be used on both the MP150 and the MP160, so it should not matter which one you have. For reference we use version 5.0.2 of their proprietary software Acqknowledge on a non-networked PC running Windows 7.

Booster Pump

If only all we had to do was buy extra modules and some tubing, but alas a booster pump must be added to the gas sampling line when sampling from a scanner that is around 30ft away from the BIOPAC. The booster pump permits the O2 and CO2 modules to be run in parallel. The onboard pumps in the O2 and CO2 modules simply aren't powerful enough on their own. A parts list is provided below with some links. If there is no link then that means we used spare parts that were lying around our electronics shop, so hopefully if you are looking to construct this yourself then you also have similar access.
Consult the pump datasheet for information on the electrical connections required. If you decide to buy a different pump then make sure to follow those instructions instead. Some basic knowledge of electronics, electric circuits, and soldering is required for completing this portion, but the final result may look something like ours.

Figure 1 & 2 - Booster pump front and top view

We did not want our booster pump to be on 24/7, possibly decreasing its lifespan, so we included an LED light and a power switch to control it. While advised, this is optional if you wish to simplify the pump design some. Once the booster pump is ready we can move on to connecting everything via tubing.

Connections

With the parts purchased and the pump assembled, it's time to bring the entire setup together. First connect the MP150/MP160, the O2100C, and the CO2100C to each other and to your PC according to BIOPAC's guidelines and specifications. 

The following is a list of parts that we used to connect the modules to the pump and then to connect the pump to the nasal cannula:
Similar to when we assembled the pump, the 1/8" ID tubing we used here was on hand in our facility. If you are ordering some make sure to obtain enough length to go from the front of your BIOPAC, through a wave guide, and into the bore of the magnet. The specific tubing is not important, just make sure the inner diameter is 1/8" so it mates up with the lure fittings. You're going to end up cutting a few pieces so make sure to have a knife handy. The following diagram shows all components, including connectors and filters.

Figure 3 - Connections diagram showing modules, booster pump, tubing, and connectors

The following images break down the connections into smaller sections so you can see our finished product. We connected the filters directly to the front of the modules via the intake ports. The pieces of electrical tape are used for color coding in case something ever happens to get disconnected. You can also use the color coding to cross-reference the schematic in Figure 3 to the photos below. 

Figure 4, 5 & 6 - Modules, filters, tubing, connectors, pump, one way valves, etc!

Assuming your setup is similar to what is outlined above then the next step is to begin acquiring and recording data via Acqknowledge.

Recording in Acqknowledge

Before you begin recording you must turn on the BIOPAC unit, make sure the settings on the front of the modules are correct (For the O2100C you want the gain set to 20% and for the CO2100C set it to 10%), turn on their pumps (via front switch), turn on the booster pump, and attach a new nasal cannula to the end of the tubing.. The module pumps take a few minutes to warm up, so readings may be inconsistent at first (*see Note 1, on calibration)

Open the Acqknowledge template that you will be using. Assuming the BIOPAC system AND the modules have been setup and added properly (*see Note 4) you should see a screen similar to the ones shown below. Either you are recording multiple other physio channels like pulse and respiration (left), or you are only recording %CO2 and %O2 (right).

Figures 7 & 8 - Acqknowledge showing five channels and showing two channels

Assuming the nasal cannula is attached, your subject is inside the magnet, and you are ready to start the scan, all there is left to do is hit the "Start" button on the top left of the screen. After a short delay (*see Note 5) you should begin seeing %CO2 and %O2 peaks like the ones shown below.

Figure 9 - Acqknowledge showing pulse, resipration, %CO2, TTL pulse, and %O2

And there you have it! Recording end-tidal CO2 and O2 using BIOPAC! Now all that's left is to finish out your scanning session, save the Acqknowledge data file, remove the subject's nasal cannula from the tubing (*see Note 6), and turn off all pumps (*see Note 7) and that's it. 

While purchasing BIOPAC and the two modules is not cheap, the rest of the setup is fairly inexpensive to replicate. Hopefully the benefits of acquiring such data convince you to build this yourself. Not only is the data valuable, it is easy to acquire regularly once the initial setup is complete. 

Additional Notes

Note 1: BIOPAC suggests changing the filters every month. They also suggest the O2100C and CO2100C modules be calibrated before every session.  Reading through their documentation, this seems to be due to barometric pressure and water vapor pressure (humidity). The former will affect the absolute level of gas flow, while the latter will affect the absorption of CO2- and O2-specific wavelengths. The sensors use an optical filter so presumably there could be overlap between the absorption spectrum of water, CO2 and O2 in some way. Our staff chose to at first monitor the measurements during the first months of use to see just how much barometric pressure and humidity cause them to change or fluctuate. California weather patterns tend to shift slowly, so we may not see anything substantial unless we get a rapid change in weather. If using the peak O2 and CO2 numbers to define end-tidal values then the calibration is probably not critical.

Note 2: Our facility had some of BIOPAC's tubing so we incorporated it into the setup, but it is not required. Use your own 1/8" ID tubing if you have it.

Note 3: For our work we wanted to use nasal cannulas, not face masks, for comfort, compliance and simplicity. It's entirely possible to use a face mask in case there's concern of missing mouth breathing. Regardless of your choice, make sure it mates up properly to the tubing. For example we purchased some nasal cannula with a hard plastic connector that did not mate up properly so we had to place a brass connector and some extra pliable tubing, as you can see below. Don't be afraid to improvise!

Figure 10 & 11 - 1/8" tubing with brass connector, pliable tubing and nasal cannula

Note 4: Consult your Acqknowledge and BIOPAC user manuals or contact their customer service if you have trouble setting this up. When collecting %O2 and %CO2 recordings, the main issue to be aware of with the Acqknowledge software is verifying that the modules are setup and recognized as modules rather than simply channels. This may seem like a minor detail, but improper setup results in the values for these readings being reported in volts rather than actual percentage of O2 and CO2. It’s easy to see whether you are using the wrong setup by looking at the right side of the screen. In the example below, If you see “Volts” rather than “%O2” and “%CO2” then the setup is incorrect. Also keep in mind that we record all physiological data we collect at 125 Hz. 

Figure 12 - Example of proper (top) and improperly (bottom) configured module

Note 5: 
For a fixed pump speed, the total delay depends primarily on the length of tubing between the BIOPAC and the cannula. Testing at our facility showed this delay to be around 33 seconds. This will vary depending on your location and you should determine this value during initial setup. Also check it periodically, just in case the pump efficiency decays over time.

Note 6: - If you are keeping the cannula for further use on the same subject, consider washing or disinfecting then placing it in a plastic bag when dry.

Note 7 : Similar to our booster pump, it's probably best to not keep the O2100C and CO2100C pumps on at all times so as not to diminish their lifespan. If you keep your BIOPAC unit on at all times, consider putting the pumps on a separate power strip.

Wednesday, July 3, 2019

3D Printed Pneumatic Headphones for 32 Ch. Headcoil

A common complaint when using the 32 channel head coil is that there are few options available for delivering auditory stimuli to subjects. The inner diameter of the coil is considerably smaller compared to that of the 12 channel coil and limits the use of the standard Siemens pneumatic headphones that come with the 3T Tim Trio. Some current alternatives are to purchase an expensive electronic ear bud system or to crank up the volume for the speaker inside the magnet room and hope that the subject can hear at least some of what you're saying. For most researchers neither of these are adequate solutions, so I was tasked to come up with an alternative that fit the following criteria:
  • Integrates into existing pneumatic systems
  • Durable
  • Low cost
  • Slim profile
  • Comfortable
  • Easily reproducible
If you've read my last few posts then it's no surprise that I decided to use Tinkercad and our in-house 3D printer to come up with a suitable solution. A link will be provided at the bottom of the post for those wishing to print their own.

The Siemens Option

The default Siemens headphones work wonderfully...if you are using the 12 channel coil. But when using the 32 channel it's useless to all but the smallest of heads. The headband and thick headphone chambers simply do not fit inside the coil along with a subject's head and adequate padding. Thankfully pneumatic systems like this don't have many components, so I won't have to alter the design too drastically to come up with a solution that fits our criteria. 

Figure 1 - Siemens pneumatic headphones 
Figure 2 - Siemens tube connector

The 3D Solution

Keeping in mind the aforementioned criteria, I used the Siemens system as a starting point. Eliminating the headband and slimming down the profile of the headphone chamber instantly gave us the extra space required. Creating a ridge in the headphone chamber is the simplest design solution (see Note 1) as it provides a means to secure the cushion in place and slim down the design even further. I moved the tube connection to the bottom of the headphone for a more streamlined appearance and to make it easier to attach the "Y" connector. The original Y connector never posed a problem, but I tapered the holes just slightly for a tighter fit around the tubing and slimmed down the design to save on material cost.

Figure 3 - Slim 32 Ch headphone chamber design
Figure 4 - Y connector solid and transparent
For those a bit more interested in the design details, I used a pair of Bose headphone cushions as the template for the shape. They are similar in size and shape to the Siemens cushions, though any cushions would work fine. It's mostly a matter of personal preference so long as all the proper measurements are taken to ensure a snug fit. Same goes for the tubing, though for the sake of easy integration I'd recommend sticking with the 1/4" and 1/2" tubing that is standard for this system.

Final Print

Due to the simple nature of these components, the material and settings for printing them is largely up to personal preference. Though because they're likely to take a bit of a beating I printed them out of ABS with 2 mm layers, 95% infill and supports. 95% infill may seem like overkill, but since we're dealing with a pneumatic system you have to make sure there are no holes that could reduce the quality of the audio (See Note 2). Plus the pieces are so thin and small that you don't want to run the risk of them being too brittle for every day use.

Figure 5 - Components w/supports on build plate
After a few hours of printing I got the following results:

Figure 6 - Headphone chamber printed with ABS
Figure 7 - Y Connector printed with ABS
The tubing fits securely inside the connectors without the need of any extra adhesive, though you can use a bit of superglue to make sure it stays put (see Note 3). It takes some effort to insert the 1/4 inch tubing into the Y connector, but that makes for a better fit!

Since I used a personal pair of headphones as the template, replacement cushions were ordered that match the dimensions. They are of higher quality than the Siemens headphones and serve multiple purposes; providing comfort, support, and ear protection. The cushions come with a black mesh that I super-glued to the inside to cover up the headphone chamber. Since I measured the dimensions of the hard plastic ring that shapes the cushion earlier it should fit snug on the ridge. Once satisfied that the fit was correct I went ahead and used superglue again to secure it in place.

Figure 8 - Headphone with cushion and mesh
Figure 9 - Pair of headphones with cushions installed
When it came time to integrate these into the Siemens system we purchased the following connectors and inserted them into the tubing for our new headphones as well as the originals. Some modification of the Siemens headphone tubing is required (See Note 4), but now it only takes a quick push of the button to switch between multiple pneumatic options.  As you can see in Figure 11, the quick release connector allowed us to created a microphone using a funnel. The possibilities are endless!

Figure 10 -  Quick release connector
Figure 11 - Siemens headphones (A), slim 32 ch headphones (B) and funnel microphone (C) 

Final Fitting

With the headphones finished it is time to test them out! As you can see below, even with the headphones inside the coil there is still room for more padding on the side of the head if needed. But the standard headphones only fit inside when set to the smallest setting and adding extra padding is no longer an option (see Note 5).

Figure 12 - New headphones inside 32 ch coil
Figure 13 - Siemens headphones inside 32 ch coil
OK so they fit, but do they work? Of course they do! Pneumatic systems like this are simple and straightforward. So long as you secure all the connections and there are no holes in the tubing then you're good to go.

You can access the original TinkerCAD model and download it here. If you are using the same cushions and tubing that I mentioned earlier, then you should not have to alter the models much if at all (See Note 3). But if you decide to go a different route then you'll have to use TinkerCAD and do a bit more in-depth adjustments. Thankfully they have several basic tutorials that should be enough to get you going.


Note 1: I went through several iterations before going with this design. Some required cutting holes in padding, while others proved difficult for my 3D printer to complete. You can't make an omelet without breaking a few eggs, but for the sake of simplicity I chose not to include every step.

Note 2: PLA, ABS, PETG or just about any other material would be suitable. It's mostly a matter of personal preference, but durability should definitely play a factor in your decision. I would even suggest printing out a few pairs and keeping them handy in case something should happen

Note 3: All 3D printers are not created equally. You may need to use adhesive or alter the size of the tubing holes in the STL model if the parts don't fit snug after you print them.

Note 4: The modifications are simple: 1) Cut a length of tubing roughly a foot long from the end of the 1/4" thick tubing that connects to the foot of the bed. Leave it plugged into the foot of the bed. 2) Insert the larger quick connector piece (the one with the button on it!) into it. 3) Insert the smaller quick release connector into the long piece of tubing that connects to the headphones. 4) Repeat for every pneumatic system you want to integrate (in case you design your own headphones later on!)

Note 5: The polystyrene head is by no means meant to show that everyone will have as much room when they use the slim headphones. It is meant to showcase that there is more room than if attempting to use the standard Siemens headphones. 

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!

Notes

#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.