Login  Register

Re: Contrast Enhancement

Posted by Michael Schmid on Jul 27, 2010; 9:27am
URL: http://imagej.273.s1.nabble.com/Contrast-Enhancement-tp3687471p3687476.html

Hi Liz,

to me it looks like a race condition in ImageProcessor.createImage,  
which is used for saving a JPEG image.
To understand the problem, some more information is needed:

- Image type: 8, 16 or 32(float) bits?
- Java 1.5 or 1.6?
- Which operating system?


Michael
________________________________________________________________

On 23 Jul 2010, at 18:14, Elizabeth Frink wrote:

> Thanks Johannes (and everyone else) for your suggestions!
>
>
> The setBatchMode command solved the problem with incomplete and  
> partial contrast enhancements. I will see if I can find some sort  
> of incompatibility issue with LabVIEW and the ImageJ images I have  
> created, with regard to my second conflict.
>
>
> -Liz
>
>
> From: "Johannes Schindelin" <[hidden email]>
> To: "Elizabeth Frink" <[hidden email]>
> Cc: [hidden email]
> Sent: Friday, July 23, 2010 10:25:27 AM
> Subject: Re: Contrast Enhancement
>
> 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