This process does involve a bit of manual input as I couldn’t find a way to really automate all of it.
The below procedure is to segment your worm and divide it into two parts.
The code below is to only select your worm and add it to the ROI Manager. If you are not familiar with ROI and ROI manager there are some basics here.
Go to plugins->New-> Macro and copy paste the below. Click Language-IJ1 Macro
Then, click Run
run("Gaussian Blur...", "sigma=2");
waitForUser("Adjust Threshold", "Adjust threshold till the whole worm is selected.");
run("Convert to Mask");
run("Fill Holes"); //fill any holes in the image
run("Options...", "iterations=2 count=1 black pad do=Open"); //get rid of smmaller pixels especially around the edges
//this may vary based on your images, if you have a bigger worm next to the one you want to analyse you may want to adjust the starting size
run("Analyze Particles...", "size=100-Infinity circularity=0.30-1.00 show=Outlines exclude add");
- Only your worm is in the ROI and not the white line on the right.
- Go to your original image, click show all in the ROI Manager and select the ROI
Next, get the Brush selection/Selection Brush tool. You can right click the oval tool and select it. https://imagej.nih.gov/ij/docs/tools.html
Double click the Selection brush tool and set a pixel value of 5.
Hold “Alt” key and draw a line across the region so you can divide the worm into two parts (based on the white line you drew).
- Go to ROI Manager window ->Click More ->Split
This will give you two ROIs. (three including the first).
Now, untick ‘Show All’ in the ROI Manager
Click the ROI you are interested in. (if the tail was the other bit, then select the second ROI)
- To find the number of green spots, you can go to Process->Find Maxima (you can adjust the Noise Tolerance to appropriate number for finding the green spots)
*The number of maxima are your green spots within the region. Selecting the ROI makes sure you are only analysing the green spots within that region.
My problem is that I cannot get those specific areas without blackening the whole animal via photo shop.
- If you wanted to select the cell and clear everything else outside of it.
- Click the ROI to select the whole cell
- Goto Edit->Selection->Make Inverse
- Go to the color picker and make sure its black
- This will make everything outside the ROI (cell) black in colour.
With the area, are you after the area of green spots within the tail or within the whole worm?
Let me know how you go with all of this…