Help with picking a segmentation tool

Hi everyone,

I have some data that I would like to segment and quantify, but I’m not sure of the best tool for the job. I’ve been experimenting with the trainable weka, but I have some problems with it and before I go further I wanted to see if it’s even the right tool for me to be using!

My data are max projection movies of patterns on the cell surface. The patterns look like waves moving across (see attached still-frames). I want to segment the waves and extract measurements such as number of waves, average end-to-end length of a wave, wavelength (the distance between wave in xy), and possibly even things like period, frequency and velocity.

The way I’m currently doing things for measuring end-to-end length is:

  1. Filter the raw data using a median filter with value = 1.
  2. Make a max projection
  3. Make a difference (subtraction) movie of 5 frames (roughly 30-40 seconds). This eliminates the background and makes the waves easier to see
  4. Select a single frame from the movie (this is what I have attached)
  5. Open the frame in the trainable weka software and add traces for “wave” and “background” categories
  6. Save the classifier
  7. Apply the classifier to selected still-frames from other movies
  8. Take the segmentation (which is red and green), convert to 8-bit and then make it a binary
  9. For end-to-end length, I hand-measured each wave from where it began to where it ended using the segmented line tool. This was really tedious because some waves are extremely branched so I needed to make multiple ROIs and then sum the lengths in a spreadsheet.

The problems I have are:

  1. There is a lot of variation between conditions, and even within the same condition. Sometimes the waves are blobby and other times they are long and thin and connected. Should I be training the classifier on multiple images from different types of waves? How do I do that? If I load the classifier on a new image and run it and it is incorrect, do I trace the new image and “train” again and save as a new classifier? How do I know how many images to train on before I’m “over training” ? Can I then include the training set images in my quantification?

  2. Once I get my segmentation, I couldn’t figure out how to automatically measure the total length of each wave. I tried to skeletonize and it didn’t work out so well. I also tried to use the count particles which was a bit better, but only gives me area, which I’m not interested in. I ended up measuring by hand but this took a long time! The segmentation also isn’t perfect, and sometimes the waves are very fat and connected when they shouldn’t be, vs very thin other times.

  3. A still-frame doesn’t hold much information. I can only get metrics like period, frequency and velocity from feeding a kymograph or something. Would that require a second trainable weka classifier for only kymographs? I tried segmenting a movie and that caused Fiji to eat up all of my memory and crash.

Any input or help is appreciated! Thank you @etadobson for helping me connect with the correct people!

Summary of attached data:
There is a folder of original still-frames and a folder of the resulting binaries I’ve made from training on one image (120-006). There is one negative control with no patterning (124-013).

-Ani

data.zip (1.5 MB)

1 Like

I just had a look at two of your sample images:
____ C1-Diff4_104-007_Merged-47.tif
and
____ C1-Diff4_104-008_Merged-144-22.tif

For both of them it is easy to determine the mean period or the corresponding mean spatial frequency.

However, “velocity” isn’t really clear to me because it implies that something changes in time and that the signal is represented as a stack, i.e. as a time series of images. I fear you need to tell us more precisely what you mean by “velocity”. Is it a global shift or a local change and of what kind etc.

Regards

Herbie

and velocity

Hi Herbie,

The images I sent are a single frame from a time-lapse movie, so period would not be able to be determined from the single frame, but wavelength would be (peak to peak distance over space). I’m just not sure how to automate measuring of the wavelength.

In order to determine the period, the peak to peak distance over time would need to be calculated from the actual time-lapse movie. The waves do change over time and move across the surface of the cell much like water waves do. I can try to attach a movie in a .zip file. Let me know if it lets you view it. It’s an .AVI file, so not the actual data, but should give you an idea of what it looks like and where the kymograph is coming from.

movies.zip (19.0 MB)

If I reslice the data in Fiji by drawing a line across the FOV, I can generate the kymograph that I included in my first post. To measure velocity, we normally make a kymograph like this and measure the slopes of waves and calculate how many microns they traveled in how many seconds. Then when we’ve measure enough waves we take the average and standard deviation and that is just for one cell!

Similarly, you could get the period from the same kymograph by measuring the peak-to-peak distance over time (on the y-axis). There are other ways to get the period by plotting the intensity profile over time as a line scan (which may or may not be useful to talk about) I just don’t want to dilute the central question too much by going off on a tangent! When I mentioned the period and frequency, I mean for the traveling waveforms in the movie, not the spatial frequency of the image. Sorry if that was not clear!

The time-consuming part of these measurements is measuring many waves by hand just for one cell’s average, and then having to repeat that for every cell to get a statistically strong dataset. It would be cool if we could somehow automate this process, I’m just not sure how…

Let me know if you have any more questions, or if there is anything else I can attach that would make this easier to figure out!

-Ani

God day Ani!

In fact I thought that you are primarily interested in purely spatial properties because you had shown us stack slices only.

If wavelength means what is commonly called spatial period, then it is, as mentioned before, easy to determine form single slices: Evaluate the Fourier-power spectrum, perhaps by using the “Radial Profile”-plugin.

What you simply call period should better be called temporal period. It would be rather easy to determine, if the spatial structure of you signals does not change, i.e. if it is only temporally modulated. This holds only approximately true for the example movie “71-005_filtered-20fps” but much less for the example movie “control_filtered-20fps”.

If the spatial structure remains unaltered over time, the velocity is given by the spatial and temporal period, i.e. it isn’t an independent entity.

Both sample movies have little in common and I doubt they can be analyzed by applying the same approach.

I’m not sure if binarization is the way to go.

I have no idea why you are looking for a segmentation tool because presently I see no reason to segment anything in your images/sequences.

My impression is that you need to re-think the mathematical principles of spatio-temporal processes to be able to more profoundly formulate the problem and approaches for its solution.

Good luck

Herbie

Those images remind me of:

1 Like

Hi Herbie,

Thanks for your input. The stack slices were for two main reasons. As mentioned above, one was that I couldn’t use the full movie with the current tool I was trying, due to memory limitations. The other was that for wavelength (spatial period) and for measuring end-to-end lengths of waves (the total length of each wave in xy from beginning to end), the slice was sufficient. We’d love to be able to analyze full movies and pull out more parameters though (see #3 in my original post). I’d say at this time I’m most interested in measuring the end-to-end length, as that is a very striking difference between the two groups.

I apologize if my terminology is not specific enough. I’m coming from the cell-biology side of this problem and am not a physics person! So when I say “wavelength” or “period” I’m just referring to what I know as simple wave properties. I can try to be more specific for clarification purposes though. I had not thought to use a Fourier-power spectrum, but that is an interesting solution. Would that work for more irregular waves like the control?

The reason we were looking for a segmentation tool is to make it easier to define what is a wave and what is not, and potentially make it easier to do measurements on individual waves. In some cases (as in the more blobby/control looking frames) the boundaries between waves are not as easily discernible. I thought that by creating a tool to segment the waves, I would be defining them all the same way every time instead of possibly introducing bias by hand measuring and having to make that call myself. We also thought segmentation would make it easier to do things like measure the end-to-end lengths of the waves. I thought maybe one was was by drawing a line down the middle of the segmentation or something. I’m not saying the segmentation is the easiest method for doing this, it was just something we thought might be helpful and I wanted to get some input on what’s available!

Thanks for your comments,
-Ani

Yes, we believe the cell cortex is acting as a excitable medium and that the dynamics follow the same principles as the BZ reaction!

Very nice. You might want to talk to somebody working in non-linear dynamics. They might have a way of characterising these temporal patterns.

Ani,

I have no idea what you mean by:

end-to-end lengths of waves

I fear this is lab-speak but please be aware of the fact that we are not yet co-workers of your group. Also stating that you are not a physics person (I’m neither) doesn’t help. You need to get sufficiently acquainted with the disciplines you need and in your present case this is image analysis (which in fact is a master study). If you don’t agree, we shall have tremendous difficulties to help, things become lengthy and most of us simply won’t like help any further.

I had not thought to use a Fourier-power spectrum, but that is an interesting solution.

It’s not an interesting solution but the straightforward one.

Would that work for more irregular waves like the control?

I have no idea with which respect you consider a control being a control and what you expect from it.

I still don’t get the reason for segmentation and you didn’t tell us what you propose to segment.

Of course some of your data look like a Belousov–Zhabotinsky reaction and about 30 years ago I helped with characterizing them* but I think this is not really the issue here, because your second movie is far from being related to this typ of non-linear dynamics.

Please be concise and exact in your explanations. You tell us a lot but many questions still remain unanswered.

Regards

Herbie

* Markus M., Müller S.C., Plesser T. and Hess B. (1987) On the recognition of order and disorder. Biological Cybernetics 57: 187-195. doi:10.1007/BF00364150

Ani,

here are the results of Fourier-spectral evaluations of some of your sample images (see the legend in the plot canvas):

The graphs show circularly integrated and normalized profiles as a function of the radius of the smoothed Fourier power spectra. The mean spatial period can be computed from the local maxima of the curves. The values are:
black: 12.4 pixels (using the first of the two nearby local maxima)
blue_: 24.8 pixels
red__: 21.3 pixels
mgnt : no significant local maximum
(Please note that, in oder to increase the Fourier-spectral resolution, the images were embedded in a 2048x2048 canvas which leads to a Nyquist frequency of 1024.)

HTH

Herbie

1 Like