Monday, March 12, 2018

Physiological Monitoring and Recording, part II

In this second physio-centric post I'll be discussing the sensors and equipment used to record pulse and respiration data from our subjects, as well as offer advice regarding their placement. Setting up the pulse oximeter and respirator belt takes only a couple minutes, meaning very little extra effort is needed in order to capture this valuable data. There's literally no excuse not to do it!

Pulse oximeter

Although the Biopac system we use does have a pulse oximeter unit available for purchase, we use an MRI-compatible Nonin 8600FO (see Note 1) and feed the analog signal to a UIM100C add-on module. The UIM100C has multiple analog input channels, so we use a separate one for the TTL signal input from the MRI equipment as well.

Figure 1 - Nonin 8600 FO pulse ox unit
Placement of the fiber optic sensor can be tricky, especially if your subject has a weak pulse, but generally speaking the sensor should be placed on the subject's index finger and secured firmly with medical tape. If you wrap it too tight then the sensor can have trouble getting consistent readings.

Figure 2 - Pulse oximeter sensor on finger
If using a button box or one of our other response devices then you'll want the subject to use the hand that doesn't have the pulse ox attached to it. The more they move the more likely the sensor could slip and give faulty readings. The image below shows a sample of the data we've recorded using this setup.

Figure 3 - Pulse data and TTL pulses recorded in Acknowledge 

Respirator belt

For acquiring respiration data we use the DA100C module along with a transducer that then attaches to a pneumogram sensor. The module attaches directly to our MP150 and UIM100C units thanks to the piecewise nature of the Biopac system.

Figure 4 - Biopac pneumogram sensor
Figure 5 - Respiratory sensor and elastic belt
The sensor is a self-inflating pressure sensing pad that connects to the transducer on the DA100C unit via plastic tubing and measures changes in the abdominal circumference of the subject during respiration. The unit should be placed on the subject's body at the location of maximum respiratory expansion. Speaking from experience, I typically find that to be around the subject's lower ribs and slightly off to the side (see Figure 5). The elastic belt keeps the sensor in place but care must be taken so as not to make the subject too uncomfortable (See Note 2). Below are two examples of data collected with this setup. The first image is normal respiration while the second shows a subject holding their breath and then inhaling. The pressure sensor is sensitive enough to pick up even the slightest fluctuations in respiration, which is why its placement and the tightness of the elastic strap are critical for successfully acquiring data.

Figure 6 - Respiratory data and TTL pulses in Acqknowledge
Figure 7 - Breath hold and recovery data with TTL pulses in Acqknowledge
Hopefully these last two posts have convinced you to incorporate acquiring physio data into your scanning protocol. It's easy to set up and well worth the effort. Even if you're not sure you'll end up using the data, it's better to have it stored away in a hard drive somewhere than not have it at all.

Note 1: Our Nonin unit has been discontinued for several years. It is a legacy device that's at least a decade old. We've purchased several newer pulse oximeters, even another one from Nonin, and none of them worked as effectively as the 8600FO. We currently have another pulse oximeter on order and I plan on updating this post once we fully test it.

Note 2:The adjustable elastic band did not come with the Biopac system but with the Siemens 3T Trio instead.

Wednesday, February 28, 2018

Physiological Monitoring and Recording, part I

Do you collect physiology data from subjects during an MRI scan? If so -- great job! If not -- you totally should! I strongly recommend collecting physiological data during your MRI study and these next two blog posts should shed some light not only on how important it is, but how easily it can be done with the proper setup and equipment.

The importance of collecting physio data

The main reason to collect physiological data while scanning is noise. Or rather to be able to identify potential noise and remove it in order to boost the signal-to-noise (SNR) ratio of your scan. Noise can be generated by both the subject's cardiac and respiratory cycles. (See Note 1

Blood vessels expand and contract as blood is pumped through them and into the brain. The resulting artifact, referred to as the pulsatility artifact, can be unpredictable and the effect varies depending on the region of the brain you are looking at. 

Respiration is in some ways trickier since a subject's breathing pattern isn't usually as predictable as their heart rate. As they breath in, their head (and by extension their brain) will move to varying degrees. If you're doing breath hold studies then it's even more likely to result in movement artifacts and noise. While we highly recommend the use of Caseforge head restraints to lessen the effect of subject head motion, collecting and accounting for respiratory data is still crucial. This is because movement of the chest modulates the magnetic field across the head even if it is perfectly restrained, and this B0 modulation appears like motion in the EPI data. Check out this PractiCAL post for more information. 

Physiological recording using Biopac and Acqknowledge

There are several different options for collecting physic data in an MRI environment. I'll be discussing the use of the Biopac MP150 system and Acknowledge 4.1, the software that came bundled with it, because it's what we have in our facility and we're quite happy with the performance.

Figure 1 - Biopac hardware with various modules added on

The Biopac unit consist of the central MP150 unit and, as you can see, we've purchase several add-ons over the years in order to record more than just respiration and pulse. We're currently able to record oxygen and carbon dioxide levels, galvanic skin response, respiration and pulse data. We've also set it up so the Biopac receives TTL pulses from the scanner equipment. This allows researchers to sync up the recorded physio data with the MRI data; making isolating and removing noise and artifacts easier.

Figure 2 - Example physio data collected using Biopac and Acqknowledge

Above you'll see an example of what data collection looks like with Biopac and the Acqknowledge software. The signal traces (from top to bottom) are: pulse, respiration (chest motion) and TTL (see Note 2). We use a sampling rate of 125 Hz for all recording channels, though the software does let you set the rates for channels individually. The fastest physiological signal of interest is the heart rate (pulse oximetry) which occurs at around 1 Hz for most people. 125 Hz digital sampling may be overkill, but it’s nice to have some fine detail in case someone needs the resolution for an advanced processing method at some point in the future. We try to “specify for tomorrow" and future-proof our facility whenever possible. In my next blog post I'll be going into the equipment used to acquire this data in more detail. 

Note 1: Respiration and cardiac data are not the only sources of noise and movement that you can encounter when doing an MRI, but I chose to focus on those two specifically because they are the bare minimum of what our facility recommends researchers acquire and account for.

Note 2: Our TTL pulses coming from the scanner are originally 10 μs long but we lengthened them to 60 ms via a custom box, so a sampling rate of 125 Hz easily captures them. Folks using shorter TTL pulses might need faster sampling. I plan on doing a post detailing our custom box in the near future so stay tuned for that.

Thursday, October 5, 2017

Printing in 3D, part one: Choosing, Building and Troubleshooting your own 3D Printer

In this first of a two-part series I’ll be diving into the topic of 3D printing. I'll start with a broad overview, move on to discuss available options for getting your own printer, and finally I'll pass along some troubleshooting tips I've learned along the way. In the second, arguably more interesting, post I’ll detail the process we use to create our own head cases that can drastically reduce subject head motion inside the MRI machine. 

A quick disclaimer before diving in, this post is NOT intended to be a comprehensive look at 3D printing and printers. This is a massive field with what can seem like unlimited design option and choices, many of which are still foreign to me as well! So whenever possible I will provide links with information for those interested in learning more and possibly want to build their own.

What's the deal with 3D printing?

Figure 1 - 3D printed prosthetic limb
There’s no doubt you’ve seen or heard about 3D printing before in some form or another. The technology has been around for some time now and is being utilized in new and exciting ways almost on a daily basis. Elaborate costumes, prosthetic limbs and tiny parts that are impossible to purchase are just the tip of the iceberg when it comes to the potential uses for this exciting technology.

Figure 2 - Unpainted 3D printed mask
Figure 3 - Fully painted 3D printed mask

Figure 4 - 3D printed gears. Almost impossible to buy but super easy to print!

Now that I’ve piqued your interest about possible uses, you’re probably wondering where someone even begins with setting up their own print station. Thankfully the open source 3D print community is thriving online. With the power of Google you don’t have to look too long in order to find general information on the topic. One could easily fall down a rabbit hole and the sheer amount of options available could turn you off to the idea all together.  But do not despair! I will fully admit that I knew next to nothing about 3D printing when the decision was made to build our own here. It was a learning process; it was frustrating, definitely caused some hair loss and at times I felt way over my head. But eventually one day the stars were aligned, kinks were ironed out, numbers were dialed in, and the world of 3D printing seemed a little less intimidating. I don’t have all the answers, and it would take me longer than I’d care to admit to detail the process of building a fully functional printer from start to finish, but I’m able to use our setup and troubleshoot the issues we come across. And because the online community is so active it is easy enough to search the internet for answers whenever I need them. Always remember that Google is your friend!

Printer styles and choosing what's right for you

I could write an entire post about the various styles of printer; describing the components needed and the software toolchain they follow, but that’s not within the scope of this blog. More importantly, people with far more knowledge than I on the topic have already done that! Follow the previous link and you’ll find information on various styles of printers and learn how to go from an STL file to a fully printed 3D model in no time. Well maybe not in "no time", but they will definitely get you there faster than I alone could!

Figure 5 - Kossel style 3D Printer

After various internal discussions my team decided on building our own Kossel, which is a delta style printer. Our reasons for going with this one were:
  • A printer bed with a 300 mm radius for printing larger components
  • A delta-style printer allows us to build tall pieces that aren't possible with other styles
  • Fully open-sourced which allows us to custom pick the software we want to use
  • A stationary printer bed which is more stable, especially when printing taller pieces
  • A vertical build design, so takes up less space than other models
  • Capable of printing at faster rates than other models due to it's stability
  • Supports open source add-ons such as a headed bed for better model adhesion and automatic bed leveling before every print starts

 If all those features sound great to you then a Kossel or other delta style printer might be the way to go. You’re going to have to do some research and figure out which style is right for your facility. A few questions to consider before making your decision include:
  •  Do you need a large printing platform?
  • What sort of items will you be printing?
  • What are the size limitations where you plan on setting it up?
  • Does the speed at which it prints matter to you?
  • Do you need an enclosed system?
  • Can you machine the parts when necessary? Or have access to a machine shop?
  • Does open-source sound appealing?
  • What’s your comfort level when it comes to programming languages, EEPROM, etc.? Are you willing to learn?
  • How much troubleshooting are you willing to do? And how complicated are you able to handle?

There are plenty of other questions to consider when deciding on a printer. Price, complexity, form, function, etc. can all be overwhelming! But focus on what you currently need AND try to plan for the future as much as possible. The great thing about building your own 3D printer is the potential to modify and add-on to it later on. Once you’ve become an expert, of course ;-)

Building a printer takes work

At the risk of trivializing the most time-consuming portion of the process, I won’t be spending much time describing the actual building and calibrating of our printer. There’s a great step-by-step video series that you could watch, and I’m sure others have done similar guides for other styles of printers as well, if you want to look those up. Assembling, programming different features, and calibrating can take an extraordinary amount of time and work. There are highly detailed wikis for individual printer design that outline all the steps. Long story short, be prepared to put in some work if you decide to go this route. There are also plenty of helpful people in the 3D printing online community that would be glad to answer questions and provide advice along the way, so you won’t be embarking on this adventure completely alone.

Lets fast forward through many many months of building, calibrating, and troubleshooting more issues than I care to remember, and take a look at our finished 3D printer. Below you'll find several pictures to give you an idea of what your setup might end up looking like. It's not the prettiest, but it's reliable, accurate and I've grown comfortable enough to fix the issues that arises.

Figure 8 - Our Kossel style delta printer finishing up a head case print

Figure 9 - 3D printer electronics, including RAMPS board and Raspberry Pi

As you can see, there's quite a lot going on with our printer! It would be easy enough to cover up all the wires and make the whole system easier on the eyes, but that limits access to the electronics. I need to be able to get in an out quite often when things break or need upgrading. 

Figure 10 - Printer bed, carriage w/extruder and an attached webcam for monitoring prints remotely

It's not as easy to tell from the photo, but our print bed has a glass plate on top and bed heating electronics underneath. The glass bed provides a more consistently flat, level surface than the regular aluminum plate alone and heating the bed helps dramatically with bed adhesion. Both of these features were added on after the printer was built.

Figure 11 - 3D printer station with control PC, custom built delta printer, and purchased Makerbot Replicator 2

Thankfully we have enough room in our electronics shop to keep both our printer, materials and control PC in the same area without taking up too much space. Although I haven't mentioned it yet, I am sure you have noticed the Makerbot Replicator 2 printer on the right. We did indeed purchase a prefabricated printer some years back to use as a backup of sorts for our own, but let's just say we are less than satisfied with it's performance. I'll discuss that a bit more in detail later on.

I completely understand going this route is an undertaking most researchers don’t have the time or resources to complete. But you get far more freedom to customize the device your own way and it can't be understated how much knowledge you'll gain by getting your hands dirty. It will do wonders for your confidence and building skills, not to mention troubleshooting is far easier and quicker when you know the machine inside and out. 

Don't wanna build your own printer? Thankfully you don't have to!

Now I know what some of you are thinking, especially those of you who absolutely have no background/interest/time etc. in building a printer; wouldn’t it be so much easier if I could just buy one and start using it right outta the box? Well of course! You can certainly but pre-fabricatedclosed-system printers that are made with the non-enthusiast end consumer in mind. Meaning they are designed to be intuitive, easy to use, and convenient no matter what your prior experience with 3D printers may be. They usually come with proprietary software and parts, so they offer very little room for customization, but for some people this is the perfect solution.

Figure 6 - MakerGear M2 printer
These printers tend to be quite a bit pricier than other available options, but the convenience can be worth the cost for some. You won't spend hours and hours getting your printer up and running, but you might spend the same amount of time dealing with customer support and printer errors. The very nature of closed-system devices means home troubleshooting is limited to power cycling, restarting a print, or being convinced you have to buy new components. Mileage may vary though, so maybe your experience will be better than the one others have had, i.e. us! (Note 1)

If you’re like most people and caught somewhere in the middle between buying a pre-fabricated printer and completely building your own, well then have I got the solution for you. There are plenty of printer kits available for purchase online. This will likely be the go-to route for the majority of people. Nowadays kit manufacturers do a pretty decent job of explaining how to setup your printer after purchasing it. Simply find the one you want and they'll ship you the parts to build it. 

Figure 7 - Printrbot Simple Pro kit

They’re cheaper than the pre-fabricated printers and some models can even be comparable to building your own. In fact for all intents and purposes you ARE indeed building your own printer when you purchase one of these kits, just without the hassle of putting together a parts list and ordering from multiple vendors. Most kits I have seen don’t have proprietary software either, so you’re going to be using a bunch of free software to complete the toolchain and get the printer going; just like you would have to do if you built your own from scratch. It’s a relatively simple process once you’ve set it all up. Plus there are plenty of great open-source options to choose from, allowing for even more customization. I strongly recommend going this route if possible as it has the most benefit with the least amount of headaches. If I ever decide to build another printer I will definitely be buying a kit.

Helpful Tips & Tricks

The most useful advice I can offer is how we overcame many of the problems that popped up while building our printer. Information and solutions for all of the technical issues you'll likely come across can be found in handy guides online, but I am going to run through some specific issues we encountered frequently and helpful tips we learned along the way.

  • This calibration technique for fine-tuning the extruder is extremely intuitive and easy to do
  • For fine-tuning the entire system, including tower position, rod length, etc., this is a great calibration test piece. Fair warning, you’ll probably be printing this thing more times than you can count!
  • Delta printers can be tricky to calibrate, but there are procedures out there that will walk you through it. Yet another fair warning, it can take a bit of time!
  • When you first start calibrating and doing test prints, keep the temperature of your extruder on the lower end of the working range and slowly raise it as you continue. Temperature is a big factor when printing, but it's also one that can be easily changed, so focus on other factors first. The range is from 180° C to 220° C for PLA
  • Applying blue painters tape to an unheated bed does wonders for initial print adhesion. Yes, it has to be blue. I don’t have the answer for why, but the online community has established that other colors just don’t work as effectively\
  • This might sound even crazier than the previous tip, but if you are using a heated bed (I highly recommend it!) applying a thin coat of hairspray will help the print adhere better 
  • Check connections and tighten screws, belts, tracks, etc. about once a month. During the calibration process specifically you’ll be printing so often and changing so many settings that things might shift out of place
  • PLA is our filament of choice with whites, greys and blacks being the colors we usually stick with. While we do occasionally use other colors, the consensus online seems to be that colored filament tends to jam more often than blacks and whites do. You can always paint them any desired color afterwards anyways
Figure 12 - Various spools of PLA
  • Store your filaments in airtight containers. Leaving them exposed to the open air can expose them to microscopic contaminants, which jam the extruder and lead to ugly prints
  • Keep your active spool of filament on a roller so it feeds directly into the extruder – thus drastically reducing the possibly of it tangling up as it rolls out. We keep ours mounted above the printer. The last thing you want after printing for 15 hours is for a filament jam to ruin it all during the final minutes!

Figure 12 - Spool of PLA on roller being fed down into the extruder

  • For the last step in the software toolchain we went with the free software Octoprint. Check out their website for a full rundown of features, but one of the coolest is the option to hook up a webcam and monitor your print in real time from anywhere. You can also adjust the settings from their online interface on a whim. I highly recommend going with this web-based route for printer control
  • Consider adding a heated bed and glass plate if the printer you decided on doesn't already have them. Print adhesion and a level print surface are both major factors in determining the quality of the overall print and these two add-ons do wonders for addressing those issues
  • Thankfully our university has a PLA recycling program. They take unwanted PLA prints, grind them up, and melt it back down into spools for use in student print labs. If you don't have a recycling system like this in your facility, consider setting it up. All those failed prints have to go somewhere, and they might as well be put to good use

Figure 13 - Recycle bad prints whenever possible

What's next?

Now that you're all experts on 3D printers and have your own set up, it's time to have some fun! In my next post I'll be diving into a unique project. I'll be going over the procedure used to turn a person's hi-resolution anatomical MRI scans into a custom 3D printed head case that fits inside our 12 channel head coil and drastically reduces subject movement inside the magnet. Stay tuned! (Note 2)

Figure 14 - Hi-res MPRAGE slice

Figure 15 - Custom 3D printed head case made from the above MPRAGE

Note 1: Unfortunately, I can attest from personal experience that purchasing a pre-fabricated printer is not without problems. We purchased a Makerbot Replicator 2 in our shop and have experienced problems almost from the get go. Granted we bought it several years ago and it's possible that the company has improved it's products, but it's customer service could still use some work. The extruder jams with filament most times it prints at this point and the only option available is to restart the print with different settings and hope for the best. There is no way of opening up the printer and tinkering without voiding the warranty, but even if we weren't concerned with the warranty it's still impossible to replace parts on our own because Makerbot doesn't sell them. The only solution we've ever gotten from customer service, when they bother to respond to our inquires, is to purchase a newer model of the extruder. I don't know about you, but having to purchase a new $150 part every couple months doesn't make a whole lot of sense considering the thousands of dollars this printer cost. They've also gone through two different proprietary softwares since our initial purchase and BOTH were lousy with crashes and bugs. To put it simply, I never use our Makerbot printer and exclusively use our custom built one. Take this experience with a grain of salt when purchasing your printer, but be aware that our experience is by no means an isolated incident.

Note 2: The