Simple macro

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

Simple macro

Knecht, David
Hi- I am trying to write a macro to do a simple task, but have not done this in a while.  I want to take a large stack of images, split it into several smaller stacks and save the new stack files to a new folder.  Presumably, I use the Batch command and set the input to the folder with the large stack and the output to another folder.  Then run:
run("Stack Splitter", "number=10");

Now how do I get the individual new stacks saved to the output folder in the macro?


Dr. David Knecht
Professor, Department of Molecular and Cell Biology
University of Connecticut
91 N. Eagleville Rd.
U-3125
Storrs, CT 06269-3125




--
ImageJ mailing list: http://imagej.nih.gov/ij/list.html
Reply | Threaded
Open this post in threaded view
|

Re: Simple macro

Bruce Citron
David- Here's a short macro that converts confocal images- not exactly what you're doing, but it might help.  I love the Choose Directory command, letting one pick the source directory.  Enter a second one, if you want to pick a second destination directory.

//Generated to convert 2 channel Olympus Confocal .oir files to .tifs
//Separately, set Bio-formats to open windowless
//Allow user to select the directory that contains nothing but the .oir images to analyze
dir=getDirectory("Choose Directory");
//Loop through each file in the selected directory one at a time
list=getFileList(dir);
for (i=0; i<list.length; i++) {
//Open the first or next image file
open(dir+list[i]);
Label=list[i];
run("Merge Channels...", "c1=["+list[i]+" - C=1] c2=["+list[i]+" - C=0]");
saveAs("Tiff",dir+list[i]+".tif");
close();
}

Good luck,
Bruce
--
Bruce A. Citron, Ph.D.
Director, Laboratory of Molecular Biology, R&D, VA NJ Health Care System
Professor, Pharmacology, Physiology, & Neuroscience, Rutgers- New Jersey Medical School





From: ImageJ Interest Group <[hidden email]> on behalf of "Knecht, David" <[hidden email]>
Reply-To: "[hidden email]" <[hidden email]>
Date: Thursday, April 30, 2020 at 17:21
To: "[hidden email]" <[hidden email]>
Subject: Simple macro

Hi- I am trying to write a macro to do a simple task, but have not done this in a while.  I want to take a large stack of images, split it into several smaller stacks and save the new stack files to a new folder.  Presumably, I use the Batch command and set the input to the folder with the large stack and the output to another folder.  Then run:
run("Stack Splitter", "number=10");

Now how do I get the individual new stacks saved to the output folder in the macro?


Dr. David Knecht
Professor, Department of Molecular and Cell Biology
University of Connecticut
91 N. Eagleville Rd.
U-3125
Storrs, CT 06269-3125




--
ImageJ mailing list: https://nam02.safelinks.protection.outlook.com/?url=http%3A%2F%2Fimagej.nih.gov%2Fij%2Flist.html&amp;data=02%7C01%7Cbruce.citron%40rutgers.edu%7C72274a30e91442c2734508d7ed4c6718%7Cb92d2b234d35447093ff69aca6632ffe%7C1%7C1%7C637238784725479085&amp;sdata=bot270hQQITSkQRE7gLHN%2BMVVZF%2BvDxeTe1g1ySgrPA%3D&amp;reserved=0


--
ImageJ mailing list: http://imagej.nih.gov/ij/list.html