macro problem -- auto brightness/contrast function

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

macro problem -- auto brightness/contrast function

Alex Nugent
Hi-

I am new to imageJ and am having problems with a macro I've written for
particle counting.  If I do the steps manually on an image then it works
fine.  If i do the same exact steps but record it for a macro and
subsequently run the macro on the same image I get a very different,
inaccurate result.  

I have systematically gone through my steps and have found that there is
something differnt when using the brightness/contrast auto function manually
vs.in a macro.  With the macro, I get a very noisy image with aberrant gray
pixels which negatively influences my particle analyzing/counting.  When
doing the brightness/contrast manually I get a very clean image with mostly
white on a black background with little gray specs thats more accurate.

Any help or advice would be greatly appreciated!

The steps I do manually:
1.  crop image
2.  duplicate image
3.  Process>filter>median>4.0 pixels
4.  Process>image calculator>subtract images
5.  convert to 8-bit
6.  Ctrl-shift-C for brightness/contrast, select Auto and Apply
7.  Image>adjust>threshold>Auto
8.  Analyze particles

The recorded macro:
makeRectangle(237, 0, 277, 480);
run("Crop");
run("Duplicate...", "title=[analyze 0414-1.bmp]");
run("Median...", "radius=4");
imageCalculator("Subtract create", "analyze 0414.bmp","analyze 0414-1.bmp");
//run("Image Calculator...", "image1=[analyze 0414.bmp] operation=Subtract
image2=[analyze 0414-1.bmp] create");
run("8-bit");
run("Brightness/Contrast...");
run("Enhance Contrast", "saturated=0.5");
run("Apply LUT");
run("Invert");
setAutoThreshold();
//run("Threshold...");
run("Analyze Particles...", "size=4-36pixels^2 circularity=0.00-1.00
show=Outlines display clear summarize");