Hi all,
I'm trying to do a couple operations on many files in a folder, but these operations must be done through plugins (eg BioFormats, or ND2Reader). The recorder spits this out: run("Bio-Formats Importer", "open=[C:\\file\\path\\file.tif] insertoptionshere"); How do I make this perform the same action on all files in a list? I understand how to do this when I'm not doing it through a plugin -- my question is specifically about doing this within the plugin syntax shown above. I'm working with the following script: requires("1.33s"); dir = getDirectory("Choose a Directory: "); setBatchMode(true); count = 0; countFiles(dir); n = 0; processFiles(dir); //print(count+" files processed"); function countFiles(dir) { list = getFileList(dir); for (i=0; i<list.length; i++) { if (endsWith(list[i], "/")) countFiles(""+dir+list[i]); else count++; } } function processFiles(dir) { list = getFileList(dir); for (i=0; i<list.length; i++) { if (endsWith(list[i], "/")) processFiles(""+dir+list[i]); else { showProgress(n++, count); path = dir+list[i]; processFile(path); } } } function processFile(path) { if (endsWith(path, ".tif")) { [COMMAND GOES HERE] close(); } } I've tried universalizing the line that the recorder spits out, but it gives me an error. I tried looking for this in the archives but may have been using the wrong search terms -- sorry if so. Many thanks in advance! |
On 8/5/15 10:34 PM, jswalker wrote:
> Hi all, > > I'm trying to do a couple operations on many files in a folder, but these > operations must be done through plugins (eg BioFormats, or ND2Reader). > > The recorder spits this out: > > run("Bio-Formats Importer", "open=[C:\\file\\path\\file.tif] > insertoptionshere"); > > How do I make this perform the same action on all files in a list? I > understand how to do this when I'm not doing it through a plugin -- my > question is specifically about doing this within the plugin syntax shown > above. argument string, Here is an example from something I wrote: run("Bio-Formats Importer", "open=["+inputPath+"] autoscale color_mode=Default view=Hyperstack stack_order=XYCZT series_"+d2s(j,0)); your argument list will look different, but the idea is the same. In my example, I have variable for the input path (a complete path to my file). Since I needed to loop over a set of fields in a multifield image, I also have "series_"+d2s(j,0) which constructs the correct argument to get a particular field (i is a loop variable) hope this helps --aryeh > I'm working with the following script: > > > > I've tried universalizing the line that the recorder spits out, but it gives > me an error. > > I tried looking for this in the archives but may have been using the wrong > search terms -- sorry if so. Many thanks in advance! > > > > -- > View this message in context: http://imagej.1557.x6.nabble.com/Batch-processes-through-plugins-tp5013914.html > Sent from the ImageJ mailing list archive at Nabble.com. > > -- > ImageJ mailing list: http://imagej.nih.gov/ij/list.html > -- Aryeh Weiss Faculty of Engineering Bar Ilan University Ramat Gan 52900 Israel Ph: 972-3-5317638 FAX: 972-3-7384051 -- ImageJ mailing list: http://imagej.nih.gov/ij/list.html |
Aryeh,
Yes, that's perfect, thank you. Thanks for the example, too -- I've got it now!
Cheers,
Jill
From: Aryeh Weiss [via ImageJ] <ml-node+[hidden email]>
Sent: Thursday, August 6, 2015 12:40 AM To: Walker, Jillian S Subject: Re: Batch processes through plugins On 8/5/15 10:34 PM, jswalker wrote:
> Hi all, > > I'm trying to do a couple operations on many files in a folder, but these > operations must be done through plugins (eg BioFormats, or ND2Reader). > > The recorder spits this out: > > run("Bio-Formats Importer", "open=[C:\\file\\path\\file.tif] > insertoptionshere"); > > How do I make this perform the same action on all files in a list? I > understand how to do this when I'm not doing it through a plugin -- my > question is specifically about doing this within the plugin syntax shown > above. argument string, Here is an example from something I wrote: run("Bio-Formats Importer", "open=["+inputPath+"] autoscale color_mode=Default view=Hyperstack stack_order=XYCZT series_"+d2s(j,0)); your argument list will look different, but the idea is the same. In my example, I have variable for the input path (a complete path to my file). Since I needed to loop over a set of fields in a multifield image, I also have "series_"+d2s(j,0) which constructs the correct argument to get a particular field (i is a loop variable) hope this helps --aryeh > I'm working with the following script: > > > > I've tried universalizing the line that the recorder spits out, but it gives > me an error. > > I tried looking for this in the archives but may have been using the wrong > search terms -- sorry if so. Many thanks in advance! > > > > -- > View this message in context: http://imagej.1557.x6.nabble.com/Batch-processes-through-plugins-tp5013914.html > Sent from the ImageJ mailing list archive at Nabble.com. > > -- > ImageJ mailing list: http://imagej.nih.gov/ij/list.html > -- Aryeh Weiss Faculty of Engineering Bar Ilan University Ramat Gan 52900 Israel Ph: 972-3-5317638 FAX: 972-3-7384051 -- ImageJ mailing list: http://imagej.nih.gov/ij/list.html If you reply to this email, your message will be added to the discussion below:
http://imagej.1557.x6.nabble.com/Batch-processes-through-plugins-tp5013914p5013917.html
|
Free forum by Nabble | Edit this page |