Login  Register

Re: Contrast Enhancement

Posted by dscho on Jul 23, 2010; 3:25pm
URL: http://imagej.273.s1.nabble.com/Contrast-Enhancement-tp3687471p3687474.html

Hi,

On Fri, 23 Jul 2010, Elizabeth Frink wrote:

> Below is my macro (I have shortened the first two lines by replacing a
> portion of the directory with "..." for illustration purposes only)
>
>
> sourcedir = "C:\\Users\\Liz\\Documents\\...\\Brightfield\\1st Tear\\";
> outdir = "C:\\Users\\Liz\\Documents\\...\\EnhCont\\1st Tear\\";
> img = "sam6close_tear_00001-brightfield.tif";
> numimg = 240;
> start = 1;
>
>
> for (i=0; i<numimg; i++) {
>
> imnum = start + i;
> strimnum = toString(imnum);
> inimg = substring(img,0,(lengthOf(img)-(16+lengthOf(strimnum)))) +strimnum + "-brightfield.tif";
> infile = sourcedir + inimg;
> open(infile);
> run("Enhance Contrast", "saturated=0.4");
> imgname = substring(inimg,0,(lengthOf(inimg)-16)) + "-contrast.jpg";
> outfile = outdir + imgname;
> saveAs("Jpeg", outfile);
> close();
> }

Thanks.

I could imagine that there is a timing problem, which you can work around
by calling setBatchMode(true); at the start of the macro (and you can turn
it off at the end with setBatchMode(false);).

Ciao,
Johannes