Posted by
Elizabeth Frink on
Jul 23, 2010; 1:51pm
URL: http://imagej.273.s1.nabble.com/Contrast-Enhancement-tp3687471p3687473.html
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!
-Liz
From: "Johannes Schindelin" <
[hidden email]>
To: "Elizabeth Frink" <
[hidden email]>
Cc:
[hidden email]
Sent: Friday, July 23, 2010 5:16:04 AM
Subject: Re: Contrast Enhancement
Hi,
On Thu, 22 Jul 2010, Elizabeth Frink wrote:
> I am having some conflicts with the "Enhance Contrast" command in ImageJ
> and would like to know if anyone has insight into the two problems I am
> experiencing. I have written a simple macro to run thru a series of tiff
> images and enhance the contrast using normalization and then save each
> image as a jpeg. My two problems are as follows:
>
> 1) The macro saves each image successfully as a jpeg but when I go back
> and open them, only a few of them actually had the contrast enhanced,
> and some only had the contrast enhanced in a portion of the image
> down to a vertical line thru the image.
>
> 2) If I open one of the images in LabVIEW (one that was successfully
> enhanced in ImageJ), the image appears nearly inverted in greyscale,
> but not completely because if I invert the image greyscale, it still
> does not look correct.
> Has anyone seen anything like this or have any ideas how to resolve
> either of these problems?
Can you show your macro?
Ciao,
Johannes