File Exchange Pick of the Week

Our best user submissions

Comprehensive, easy-to-use particle image velocimetry tool 1

Posted by Brett Shoelson,

Brett‘s Pick this week is PIVLab, by William Thielicke.

Contents

A Particle Velocimetry Suite of Tools!

Many years ago, as a postdoc at the National Institutes of Health, I was working on a problem with a colleague characterizing the (spiral) shape of the cochlea. Armed with my knowledge of the Image Processing Toolbox, I pretty quickly calculated edges in an image of the structure, and then called bwtraceboundary to direct a path along the edge.

My colleague’s eyes glazed over as she informed me that I had just recreated a significant part of her dissertation–one that took her a very long time to implement.

For my dissertation, I implemented from scratch a particle image velocimetry (PIV)-based approach to measuring retinal blood flow by tracking fluorescent particles in the ocular circulation. Coming up with the PIV algorithm constituted a significant portion of my effort. Today, I feel a bit like my colleague did, looking at William’s PIVLab! With a very nicely implemented, MATLAB-built app, William facilitated nearly everything I needed to do to track those particles. But his code is light-years nicer and faster than mine was. (This goes back 25 years!)

With PIVLab, I can simply load the images in my video sequence, set some parameters, and start tracking:

In truth, I haven’t (yet!) been able to recreate with PIVLab the results from my dissertation. But one thing is sure–this would have been a very useful starting point, and it would have saved me countless weeks of effort! (The flexibility and customizability of MATLAB code–including that on the File Exchange–is truly what makes it so useful.)

A video tutorial!

I love that William took the trouble of recording a twelve-minute video to get you started using his tool.

The tool is richly featured, and includes many different visualizations and processing functions for looking at particle flows:

One suggestion

I had to convert my video files to sequences of images to get them to work in PIVLab. It’s not very difficult to make your app support video files–using VideoReader, for instance! But creating an image sequence from a video is a minor task, too:

vid = VideoReader('C:\Sample Data\ONH_PIV_10.avi');
frame = readFrame(vid);
imgh = imshow(frame);
index = 1;
while hasFrame(vid)
   imwrite(frame,['C:\Sample Data\ONHFramewise\','Frame_',sprintf('%03i',index),'.tif']);
   index = index + 1;
   set(imgh,'cdata',frame)
   frame = readFrame(vid);
   drawnow
end

It’s worth noting that William is among the top 100 most-downloaded authors on the File Exchange–largely on the strength of PIVLab. It is current (the last update was January 2019); it has 80 user reviews hovering, on average, around 5/5 stars; and has been downloaded thousands of times. This file is long overdue for Pick-of-the-Week recognition! William, I appreciate the effort it took to create this fine tool. And I greatly appreciate your sharing it with the MATLAB community!

As always, I welcome your thoughts and comments.

Get the MATLAB code

Published with MATLAB® R2018b

25 views (last 30 days)  | |

Comments

To leave a comment, please click here to sign in to your MathWorks Account or create a new one.