Posted by
Jean-Philippe Grossier on
URL: http://imagej.273.s1.nabble.com/newimage-help-tp5014083p5014084.html
Hi,
1) get the name of your image and then concatenate in newImage():
2) you may use the "wait(n)", but I am not so sure.
3) getInfo("image.directory") and saveAs("Results", "Results.xls"); should
do the job.
macro "full [1]" {
imgName=getTitle();
dir=getInfo("image.directory");
run("RGB Split");
close();
close();
run("Select All");
run("Copy");
newImage("Counts_"+imgName, "8-bit Black", 1300, 1030, 1);
run("Paste");
run("Subtract Background...", "rolling=5");
//run("Threshold...");
setThreshold(56,255);
setOption("BlackBackground", false);
run("Convert to Mask");
run("Watershed");
run("Analyze Particles...", "size=1-100 circularity=0.00-1.00 show=Nothing
display clear");
saveAs("Results", dir+"Results_"+imgName+".xls");
}
you can also check the built in macro page of imagej website (
http://rsb.info.nih.gov/ij/developer/macro/functions.html)
hope it helps,
Jean-Philippe
2015-08-20 14:52 GMT-04:00 JP Dustin <
[hidden email]>:
> Hello,
>
> I am very new to ImageJ and writing macros. I've been slowly piecing
> together a macro to quantify apoptosis and it looks something like this:
>
> macro "full [1]" {
> run("RGB Split");
> close();
> close();
> run("Select All");
> run("Copy");
> newImage("Counts", "8-bit Black", 1300, 1030, 1);
> run("Paste");
> run("Subtract Background...", "rolling=5");
>
>
> //run("Threshold...");
> setThreshold(56,255);
> setOption("BlackBackground", false);
> run("Convert to Mask");
>
> run("Watershed");
> run("Analyze Particles...", "size=1-100 circularity=0.00-1.00 show=Nothing
> display clear");
>
> }
>
> My questions for this macro are:
>
> 1) In the newImage line, I want the name to reflect the original image,
> e.g. I opened the image, image_1331.tif, and want the new image to reflect
> that automatically but also have it distinguished with "counts" or
> something.
>
> 2) If I wanted the macro to pause at the setThreshold step to allow me to
> set a different threshold (even a 1x step for a batch process), how would
> that go? I may not need to do this because I could use an image to
> determine a threshold for the entire set, then change the settings.
>
> 3) I am having the most difficulty getting the results to save
> automatically (as you can see by not even having any code here). I have
> tried several google searches and cannot get any of the suggestions to
> work. Ultimately, I would like it to save to the folder from which the
> images were opened, reflect the image name with a .xls or .csv extension,
> and be able to use it to batch process a large number of images.
>
> Any suggestions/help would be great!
>
> Thanks,
> JP
>
> --
> ImageJ mailing list:
http://imagej.nih.gov/ij/list.html>
--
ImageJ mailing list:
http://imagej.nih.gov/ij/list.html