Memory Problems with Analyze Particles and Large Stacks

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

Memory Problems with Analyze Particles and Large Stacks

acla345
Hi all,

I am having a problem getting Analyze Particles to run on my stack of approximately 7000 images. I am running it in a linux terminal using:

java -Xmx15g -jar ... -ij path ... filename

Does anyone know if there is a way to  decrease the amount of memory used and/or run the commands on the image stack in parallel? Or would it be better to break my image stack up and run 1000 or so images at a time?

Also, my script is below:

//Run script by choosing the source/destination directories
dir1 = getDirectory("Choose Source Directory ");
dir2 = getDirectory("Choose Background Subtracted Image Directory ");
dir3 = getDirectory("Choose Destination Directory ");

//Stores a list of subfolders
list = getFileList(dir1);


dash="_BackgroundSubtracted";
csv=".txt";
tif=".tif";
dash2="_";
size="size";


threshold=180;
step=2;
iterations=15;

//Runs script in batch mode if not commented out
setBatchMode(true);

macro "Threshold" {
list2=getFileList(dir2);

for (i=4; i<list2.length; i++) {
if(endsWith(list2[i],"/")){   // if the name is a subfolder...

folder=getFileList(dir2+list2[i]);

for (count=0;count<=iterations;count++) { //change count to 16 later
//for (sizeVal=0;sizeVal<=iterations;sizeVal++) {

if(endsWith(folder[1],".tif")){   // if the name is a subfolder...
filename2 = dir2 + list2[i] +folder[1];
run("Image Sequence...", "open=[filename2] starting=1 increment=1 scale=100 file=.tif or=[] sort use");
//run("Image Sequence...", "open=[filename2] number=10 starting=1 increment=1 scale=100 file=.tif or=[] sort use");
dum2=getImageID();
}
 

//Thresholds the image and converts to binary, then takes measurements
selectImage(dum2);
run("8-bit"); //if you then want to convert image to binary
thresh=threshold+(step*count);
setThreshold(0, thresh);

run("Set Measurements...", "area centroid perimeter bounding fit shape stack display redirect=None decimal=3");

run("Analyze Particles...", "size=0-10000 pixel circularity=0.50-1.00 show=Nothing exclude clear include stack");

//Naming the output files
name=list2[i];
dotIndex = indexOf(name, "/");
title = substring(name, 0, dotIndex);


save3=dir3 + title + dash2 + thresh + csv;
//save3=dir3 + title + dash2 + thresh + dash2 + size + dash2 + sizeVal + csv;
saveAs("Measurements",save3);
selectImage(dum2);
close();
print(count);

}
}
}
}



Thanks in advance for all of your help :)

~Alicia