Tracking the center of mass along a flow-path


I am working on a project for my dissertation and have encountered an image processing barrier. I would like to track the “center of mass” or “centroid” of some illuminated dye moving through a porous medium.

A short background:

I have 447 total frames (the image above is a single frame) taken at 2 frames/second. The dye flows downward (frame top to frame bottom) on the left-hand side of the frames and upward on the right-hand side of the frames. It does this because there is a solid divider located approximately in the center of all the frames and different water depths were maintained on each side of the divider. This divider was masked out of all frames as it was not of importance in tracking the dye movement. I’ve tracked the “front” of the dye successfully, but now, I am trying to track the dye plume’s “center of mass”/“centroid”.

Here is the problem:

In the image above, any sort of “center of mass” or “centroid” tracking features (at least in FIJI) locate the center of mass/centroid around the red dot. This is a problem because it does not lie along the central flow path of my dye (blue line). I would like to somehow locate the center of mass/centroid of my entire dye plume within each frame, where the center of mass/centroid is located along the central flow path (blue line).

Any tips/suggestions? I have a feeling this may require writing a fairly intricate macro. I have been using FIJI & Matlab to process all my images and data, but I am open to suggestions for other freeware.

Thanks in advance,

Hello @BHilliard,
from your segmented image the center of mass is indeed the red dot.
You could compute a skeletonized version of your image and then find the middle of the longest line.



Hello Brandon,

unfortunately I cannot help you with your problem, since I am new in Fiji, but would like to ask you actually how you managed to draw the blue line :sweat_smile: I have a mask image with an irregular object, like you do, and would like to draw a line in the middle of its width (I suppose this is what you have done here, right?)

Many thanks well in advance :slight_smile:

Hello Maria,

Unfortunately, the blue line in my image is not exactly the center-line of my object - I just opened the image in paint and drew the blue line by hand :sweat_smile:

I’m not sure what your object looks like, but you could try to find the edges of your object (loop through the entire image, pixel by pixel, to find the intensity change from 0 to 1, assuming your images are binary) and then find center-points of straight lines that connect one edge of your object to another.

I hope my suggestion helps in some way :slight_smile: