Login  Register

Re: Help to create macro

Posted by OBEID Patricia 154904 on Dec 17, 2019; 1:44pm
URL: http://imagej.273.s1.nabble.com/Help-to-create-macro-tp5022778p5022786.html

Hi Glyn,
I'm actually interested in the intensity and size of each object contained in the nucleus.
So I'm trying to adapt Gabriel's solution but I admit that I'm getting lost ...
Thank you very much for your feedback.
Regards,
Patricia

-----Message d'origine-----
De : ImageJ Interest Group <[hidden email]> De la part de Glyn Nelson
Envoyé : vendredi 13 décembre 2019 12:52
À : [hidden email]
Objet : Re: Help to create macro

That may be overkill if I understand the original question.  Do you just need to count the objects inside the ROIs?  If that is the case, then you can cycle through each ROI in the ROI manager and find local maxima in each ROI on the channel of interest.  The manual code below will let you do it.  Obviously, you can automate the whole thing.  If you need/want other data for the spots, then obviously this won't work, and I would consider Gabriel's option, or you could try cycling through each ROI and duplicating that ROI as a new image to allow analysis of the spots in that- I have considered doing this before- you need to delete data outside the ROI after duplicating, since it duplicates a rectangle around the ROI.  I abandoned this since I was more interested in counts, and it was getting a bit complicated for my abilities!

------
//collect ROIS (e.g. nuclei) from one image,then swap to object of interest (e.g. foci) channel and count the spots.  
//Assumes you have both images open (the one for finding the ROIs, eg nuclear counterstain and the one for the spots inside it.  

var tolerance = 30;

originalImage = getTitle();
run("8-bit");
run("Overlay Options...", "stroke=red width=1 fill=none set"); run("Median...", "radius=6"); run("Subtract Background...", "rolling=125 sliding"); run("Threshold", "method=Default white"); roiManager("Reset"); run("Analyze Particles...", "pixel exclude clear add");

waitForUser("Select the image for spot counting"); run("8-bit");

run("Gaussian Blur...", "sigma=1");
run("Subtract Background...", "rolling=25");

for(i=0; i<roiManager("count"); i++) {
        roiManager("select", i);
        run("Find Maxima...", "noise="+tolerance+" output=[Count]");
        run("Find Maxima...", "noise="+tolerance+" output=[Point Selection]");
        run("Add Selection...");
}
------

Glyn

--
ImageJ mailing list: http://imagej.nih.gov/ij/list.html

--
ImageJ mailing list: http://imagej.nih.gov/ij/list.html