The AIR® pulmonary drug delivery technology being developed at Alkermes provides targeted delivery of small-molecule or macromolecule drug particles from an easy-to-use, capsule-based, hand-held inhaler. When the patient inhales through the mouthpiece, air is drawn into the aerosolization chamber, agitating a capsule and releasing dry-powder medicine for systemic or local delivery to the lungs. To optimize future inhaler designs, Alkermes developed a test method to understand the behavior of the capsule under a range of operating conditions—for example, a range of air flows representing patients of differing age and size.

The test method looks beyond simply measuring the amount of powder delivered through the mouthpiece by quantifying the capsule’s motion inside the inhaler. Since the capsule moves too quickly to be tracked by the eye or with a conventional camera, a high-speed video system was used to capture the capsule’s motion. We then used MATLAB® to analyze the images frame by frame and summarize the results.

In a joint effort with MathWorks Consulting Services, Alkermes developed a video capture and analysis procedure that uses MATLAB and Image Processing Toolbox™. The position of the capsule was evaluated in each video frame. Comparison of adjacent video frames allowed us to characterize the linear and rotational motion of the capsule. Quantities such as the velocity, acceleration, and momentum of the capsule were computed. Series of frames were analyzed using signal processing. This approach provided information on the physical factors influencing the inhaler‘s performance.

Setting up the Test

Figure 1. A standard inhaler (bottom) and a test inhaler (top).

To enable the development of an algorithm for automatically processing the captured video images, we marked the capsules with a pattern consisting of two separate lines: an equatorial line traveling around the capsule’s circumference, and a slanted line that produces a sawtooth pattern as the capsule is rotated (Figure 2). This design provided a continuous image for analysis.

Figure 2. The capsule markings.

Videos were captured in grayscale at a rate of 10,000 frames per second and resolution of 256 x 256 pixels using a Phantom® Monochrome high-speed video camera from Vision Research. To assess the motion (in 2-D) of the major axis of the capsule inside the inhaler, we determined the angle of the equatorial line for each video frame as the capsule was agitated within the chamber. The peaks and valleys of the resulting sinusoidal signal enabled us to determine an amplitude and frequency of the wobbling motion of the capsule. A count of the number of peaks of the continuous sawtooth pattern, captured while the capsule was rotating, provided information on the rotational angular motion of the capsule.

Processing a Single Image

In the experiments, the capsule and inhaler were placed in several different orientations, ranging from horizontal to vertical, upright and inverted. In the image analysis, the video frames were always rotated so that the capsule appeared in a vertical orientation, with the equatorial line positioned below the slanted line. Figure 3 shows a single frame from one of the captured high-speed video files. Regardless of the position of the inhaler in the video, the analysis was completed in the orientation shown.

Figure 3. A raw image of the marked capsule in the inhaler.

After reorienting the video data, each grayscale image was first thresholded using the graythresh function in Image Processing Toolbox to produce a binary, or Boolean, image (Figure 4).

Figure 4. Boolean image produced by auto-thresholding the video frame.

Along with the white lines of the capsule pattern, Figure 4 shows several smaller areas produced by noise and glare from the experimental lighting. These smaller areas were identified using the regionprops function and then eliminated, leaving just the equatorial and the sawtooth lines.

Once the objects of interest had been clearly identified in the image, we used MATLAB to automate the analysis.

We used a least squares fitting procedure to compute a straight line through the equatorial line on the capsule. We then located the end points and midpoint of that line. A perpendicular line was then computed from the midpoint of the equatorial line to the midpoint of the slanted line directly above. This relationship resulted in a measure of the distance between the equatorial and sawtooth lines along the major axis of the capsule.

As the capsule moved about the aerosolization chamber, we used the midpoint of the least squares fitted line to track capsule position. The angle of the least squares fitted line was used to track capsule wobbling, and the peaks values in the distance between the equatorial and slanted line were used to track capsule rotations. We recorded the coordinates of the equatorial line midpoint, the distance between the equatorial and sawtooth lines, and the angle of the equatorial line for each frame (Figure 5), and saved the data in an Excel® spreadsheet.

Figure 5. Analyzed video frame.

Analyzing the Data

Using MATLAB, we post-processed the stored data and produced summary results for each experimental run. A typical run lasted about 1.5 seconds, with approximately 15,000 video frames being captured and analyzed for each test.

The frame-to-frame displacement of the equatorial line’s midpoint was measured using the Pythagorean theorem and the coordinates of the midpoint. Dividing the displacement by time between frames gave the velocity of the capsule. The changes in velocity between frames provided the acceleration of the capsule. Power, momentum, and impulse were also calculated based on these values.

We used Signal Processing Toolbox™ to compute a power spectral density (PSD) from the equatorial line orientation data (Figure 6). This allowed for quick identification of the dominant frequencies of the capsule’s wobbling motion.

Figure 6. Power spectral density on a semi-log scale. Click on image to see enlarged view.

Once the image analysis and output data post-processing algorithms had been refined, we developed a GUI with MATLAB to streamline the execution of the processing (Figure 7). Before beginning each analysis, we used the GUI to record information about the test, such as who conducted the experiment and when, as well as the inhaler orientation, test flow rate, and inhaler type. We added a feature that makes the application present the first frame of the video when the video processing begins and enables the user to crop the image so as to remove the periphery and isolate the aerosolization chamber and the capsule. This cropping is subsequently applied to all the frames in the video.

Figure 7. The MATLAB based GUI for executing the analysis of the experimental video data. Click on image to see enlarged view.

Refining the Algorithm

The steps outlined in this article were distilled from an iterative experimental development process in which the image analysis algorithms—and even the markings used on the capsules—were designed, prototyped, tested, and improved repeatedly. The interactive MATLAB environment streamlined the data analysis algorithm development process by making it easy to try new approaches and techniques and immediately visualize the results. This allowed the algorithm to be built step by step and then refined as data was processed from more and more experiments.

Alkermes has already gained insight into how the capsule moves within the inhaler, and has correlated experimental variables, such as flow rate, to a variety of quantifiable features of the capsule motion.

The long-term objective is to identify aspects of the capsule motion that determine the amount, rate, and distribution of powder delivery. This information, along with other test results, will provide a foundation for optimizing future versions of the inhaler.

About the Author

Paul Fricker is a MathWorks Principal Consulting Engineer. Paul has more than 15 years’ experience in signal and image processing, modeling and simulation, and application development. He holds a B.Sc. in Chemistry from Dalhousie University, an M.Sc. in Physics from the University of Toronto, and a Ph.D. in Civil Engineering from Massachusetts Institute of Technology.