Cell Counting: Selective; Only count cells positive for all stainings - python

If I take multiple images in different fluorescent channels (after staining the cells with some antibody/maker), how can I automatically quantitate the fraction of cells positive for each marker? Has anyone done something like this in Python?
I can already use Fiji (ImageJ) to count the cells containing only one staining type, but I can't make it run a selective count on merged images which contain two staining types. Since Fiji interacts well with python, I was thinking of writing a script that looks at each respective image containing only one staining type and then obtain the x-y coordinates of the respective image and check for matches between. I am not sure if that's a good idea though and I was wondering, if anyone has done something similar or has a more efficient way of getting the task done?
Thanks for your help!

You could use cont = cv2.findcontours to find the almost round shaped cells and count them
with len(cont).

Related

Separate Image Into Specific Lines and Match to Images Python

I have a bunch of images, all of which look fairly similar to the one below:
In these images, the lines are distinct (at least to human eyes) but they intersect often. I am not very familiar with python image processing but I have heard opencv can be useful for these kinds of things. I would like to separate the lines somehow.
Furthermore, I would like to compare these images to the NFL route tree (this I would be able to separate into 9 different routes by hand to have 9 different images to compare to, so just imagine that):
The question really boils down to this: how do I separate out the distinct lines in the image (ex. 8 different lines for the example image from Mark Andrews), and then compare these lines to find which of my 9 route images is the nearest match?
If opencv is not the correct package for this, just let me know, and let me know if there is a package or packages that will allow me to do this. Thanks!

Identify groups of numbers in an array (group pixels of an image)

this question is related to another question i asked before here. now i have an array of contains 0s,1s,-1s. consider it as an image where background is 0s. i has groups of 1s and -1s.
This it that array opened in excel. those highlighted groups are 1s( in some cases can be -1s). there can be 4 groups in one array maximum. i want to separate those groups in to left, right, top, bottom with its value and the original index.
referring to the previous question, i am trying to find the points on the humps and hollows in the puzzle pieces. if i can group them separately then i know how to find the index of the point i want.
i tried to separate like this. but this doesn't apply for all the pieces. some times it can cut through hollows.
thanks in advance for any help!!!
Since your data is 2d array. Have you tried using an approach like region growing to segment the data?
https://en.wikipedia.org/wiki/Region_growing
Basically, you need to start with a seed point and grow the region by considering neighbouring points and whether or not they fit the criteria for your region.

How to display real-time customised text in customised format?

I have (financial) data that I get in real time using an API and I'd like to display it in a customised manner (a bit like the result of a javascript code). For example, if I want to display 10x10 prices and update them as I receive the data and customise them to be green if it is higher than the previous price, red if lower or so, how should I do, what should I use?
I assume there exist a way to do so using python, but I can't formulate my demand briefly so I only get results that confuse me more using search engines...
Could someone help me by explaining where I can get started with that?
I'll give you an overview because what you want is a generalized approach and most UI packages (if not all) should be able to handle this. First, you need to pick a package to write your UI with. There are a number of these available for Python: see here. I'm not sure what your other requirements are so you'll have to choose the one you want yourself. Once you've picked it out, you'll basically go through and create a grid structure composed of individual cells. Each cell will contain a currency value. You'll then add an event for each cell that captures an "on-change" event for the value in the cell. If the new value is greater than the old one, you color it green. If it's less, color it red. You may also want to add a timer for each cell so that the color fades after a period of time.

how to count point which based on projection of a set of coordinates

I have some data about a set of coordinates, like {(x=1, y=2), (x=3, y=4), ...}. I projected these coordinates on the picture. Then I would like to count these point in different position. My idea is below
First, separate the picture from several pixel parts based on 10 pixels.
Second, count the point inside the pixel box.
I am new in these area, and I use python a lot. I think this may be computer graphic problem.
I am not asking for a code solution. I just want to know which libraries or approaches that are related.
Anyone could give me a hint would be highly appreciated. Thanks.
Sure, your approach seems fine. You simply want to count the number of pixels in different image regions that you placed, correct?
I answered a question recently (with Python) that was giving an indication if there was a black pixel inside an image region. It could be easily modified to count pixels instead of simply finding one. Check it out here and modify your question or post a new one if you have code problems working it out.

OpenCV how to Group Rectangles

I would like some help explaining how to use the opencv group rectangles function in python SHOWN HERE.
I am running 2 haar cascades to detect objects in the image, but now I would like to merge the rectangles together. I am guessing thats what the groupRectangles is used for.
cv2.groupRectangles(rectList, groupThreshold, eps, weights, levelWeights)
I am assuming that rectList is the vector returned by cv2.cascade.detectMultiScale()?
Also I am not sure what the weights, and levelWeights are or what tehy are used for and would appreciate it if anyone could explain that, or show me where I can find out about it as i cant
find it in the documentation.
Thanks for any help :-)
Maybe something changed in the meantime, but following the link you provided the definition is:
cv2.groupRectangles(rectList, groupThreshold[, eps]) → rectList, weights
So yes, rectList is a list of rectangles, in your case you would use the one returned by cv2.cascade.detectMultiScale(). While the optional eps controls, how similar (in terms of position and size) two rectangles need to be to be merged, the groupThreshold indicates how many rectangles at least need to be merged into one in order the keep the merged one.
You will be returned the new list of rectangles and a weight for every rectangle, I assume the weight reflects how many rectangles where merged and how similar they were.

Categories