Posted by
Cameron Nowell-2 on
Aug 12, 2013; 9:39am
URL: http://imagej.273.s1.nabble.com/Memory-Problems-in-Fiji-using-macro-setBatchMode-true-tp5004321p5004391.html
Hi James,
Not sure if it matters but whenever i use the garbage collection option i use
call("java.lang.System.gc");
i ahve also found that putting a small delay, say 500 - 1000ms (using wait(500);) after the call helps it make sure it works ok
Cheers
Cam
Cameron J. Nowell
Research Facilities Manager
Monash Institute of Pharmaceutical Sciences
Monash University
399 Royal Parade
(Mail address: 381 Royal Parade)
Parkville, VIC, 3052
Australia
Email:
[hidden email]
Mobile: +61 422882700
Office: +61 9903 9587
LinkedIn: Profile
Research Gate: Profile
________________________________________
From: ImageJ Interest Group [
[hidden email]] on behalf of James Burchfield [
[hidden email]]
Sent: Monday, August 12, 2013 5:17 PM
To:
[hidden email]
Subject: Re: Memory Problems in Fiji using macro setBatchMode(true)
I should also mention that the problem is also apparent when not using
batchmode.
*
*
*Dr James Burchfield*
The Garvan Institute of Medical Research
384 Victoria Street
Darlinghurst, NSW, 2010
Australia
Email:
[hidden email]
Phone:+61 2 92958229
Web: *www.garvan.org.au*
On Mon, Aug 12, 2013 at 5:07 PM, James Burchfield <
[hidden email]> wrote:
> Hi all,
>
> I believe I am having a similar issue to this. I am running a macro
> designed to open an image crop out 2 ROI's resize one of them and save the
> new images. The process works fine in both ImageJ and Fiji except that it
> rapidly builds up memory usage.
>
> I have tried incorporating the suggested
> run("Collect Garbage"); in Fiji
>
> All this has done is slow down the processing, but the memory issue is
> still there.
>
> I am running the latest nightly build of ImageJ.
>
> Any help would be greatly appreciated.
>
> The macro in question is below.
>
> Cheers,
> James
>
> macro "seperate channels[s]"{
>
> dir1 = getDirectory("Choose Source Directory ");
> dest = getDirectory("Choose Destination Directory ");
> list = getFileList(dir1);
> greendir = dest + "greenTEMP"+File.separator;
> reddir = dest + "redTEMP"+File.separator;
> //print(greendir);
> File.makeDirectory(greendir);
> File.makeDirectory(reddir);
> x=getString("set x offset", 3);
> y=getString("set y offset", 1);
> setBatchMode(true);
> for (i=1; i<list.length; i++) {
> print (dir1+list[i]);
> if (endsWith(list[i],".tif")){
> showProgress(i+1, list.length);
> open (dir1+list[i]); //open image i
> rename ("original" + i);
> run("Rotate 90 Degrees Right");
> //define Green Channel
> w=getWidth()-16;
> h=getHeight()/2-10;
> makeRectangle(x, y, w, h);
> run("Duplicate...", "title=Green");
> saveAs("Tiff", greendir+"green_"+i+".tif");
> close("Green");
>
>
> //define red channel
> selectWindow("original"+i);
> w_red=w/1.975*2;
> h_red=h/1.985*2;
> makeRectangle(3, 10+h_red, w_red, h_red);
> run("Duplicate...", "title=Red_Original");
> run("Scale...", "x=1.975 y=1.985 interpolation=Bicubic create
> title=Red_Engorged");
> close("Red_Original");
> run("Scale...", "x=0.5 y=0.5 interpolation=Bilinear average create
> title=Red");
> close("Red_Engorged");
> selectWindow("Red");
> run("Rotate... ", "angle=0.25 grid=2 interpolation=Bilinear
> stack");
> saveAs("Tiff", reddir +"red_"+i+".tif");
> close("Red");
> close("original" + i);
> run("Collect Garbage");
> }
> }
>
>
--
ImageJ mailing list:
http://imagej.nih.gov/ij/list.html--
ImageJ mailing list:
http://imagej.nih.gov/ij/list.html