 # Is there anyway to find these patterns automatically in a bunch of cells?

I have a lot of images of the cell. In each image I have a single cell and wrote a code that can find the boundary of the cell with the environment.
Now I have a big trouble! I have to find these patterns in the cell. I need to write a macro pr use any tool that can help me to automatically explore these patterns in each image and report if each cell has either of these patterns or not. Here are the patterns:

The arrow at top is not important. But to give you intuition, those cells that have any of these patterns are willing to move in the direction of the arrow.
Ps: to give you some idea of what do the cells look like I found some examples online. I cannot share the real images but they look the same. However, they are single color (only green for example) and no nucleus is included.
These cells are moving:    Not moving:  I have an idea but I am not sure if it will work. I was just reading a publication separating bacteria on top of each other (having acute angles between consecutive points) from the bacteria that are single (having optus angles between consecutive points). I think you can use the same idea to have some common pattern for each shape and still I find it challeneging separating cases (1,2) and (5,6) but may be you can find a difference by checking the angles. 1 Like

Since the cells are segmented, I would compute a bunch of shape features (and possibly others that may contain relevant information) then train a classifier to recognize the different shapes of interest.

1 Like

I agree with the suggestions so far. If you don’t want to script everything yourself in ImageJ, I recommend trying one of the tools specialized on this kind of task:

Others might have more suggestions.

2 Likes

I dont need to separate the patterns. I mean for me pattern 1 and 5 are the same both mean cell wants to move.

If you already have the boundary of the cells then simply read the images in Python or Matlab/Octav and try to apply the method in the publication by creating a vector of angles.

I think if you created that vector then by having the difference between every two consecutive angles for every shape and then by normalizing you would have a unique vector for every pattern. Later by applying the same method to every shape you have and check if any matches any of the 6 patterns.

Also as @jkh1 mentioned I would imagine if it comes to pattern and classification then the first thing that comes to mind would be machine learning.

1 Like

What you mean by “compute a bunch of shape features”?

@Mourka Thanks for the suggestion. How can I have “unique vector” for every pattern? Because the patterns that I showed are general trend that I am searching. for example the size of each pattern or the size of angels might vary. So what is your suggestion of normalization or finding a unique vector?

@imagejan Thanks for the suggestion. Is classification the same as machine learning? And are these softwares working based on machine learning techniques like convolutional neural network?

I mean that for each cell, you can compute various numerical descriptors that capture information about shape. See for example, the ImageJ shape filter plugin. After this, each cell is associated with a vector of shape descriptors that can be used for supervised machine learning (aka classification). Before going into deep learning, I suggest you do some exploratory data analysis then try a support vector machine or random forest classifier. If you’re new to machine learning, seek help from someone knowledgeable near you.

If you know the pixels location on the image per object then this would be one matrix of two rows for each object representing x and y position of the pixels where this specific object exists. where n here represents how many pixels are involved in this specific object.

This is qouted from the paper to do the angles calculation, To calculate the concavity of each edge pixel the edge coordinates are first arranged into a two-column array (which is shown above) and the tangent line of a given edge pixel is approximated by fitting a straight line to the edge pixel and two pixels before and after the edge pixel.

Here is a link of how to calculate a tangent for a 2D point

Again quoted from the paper

The angle of the approximate normal line, perpendicular to the tangent line, is then calculated. Finally, the difference between the angles of the normal lines for pixeli and pixeli−1 is recorded, which we define as a parameter for concavity.

Out of this two calculations (tangent and normal line) and then the subtraction of the output of vector between consecutive angles would give you a unique angles for each shape and by normalization ( dividing to the maximum to have a vector between “0…1”) you would have a unique vector for each shape some times longer or shorter for the same shape but you can let’s say differentiate or play around with the final vector to have some comparable vectors.

1 Like