Posted by
Albert Cardona-2 on
Apr 14, 2011; 11:58am
URL: http://imagej.273.s1.nabble.com/batch-processing-for-a-selection-of-images-tp3684989p3684997.html
2011/4/14 Volker Baecker <
[hidden email]>:
> Hello,
> to me this is a very important point as well. I wrote a plugin called
> Macro_IO_Settings (
http://www.mri.cnrs.fr/index.php?m=82) that allows to
> setup a list of input files (even if they are in different folders). See
> page 18 of
http://dev.mri.cnrs.fr/attachments/8/remote-imagej-slides.pdf> to get an idea of how it looks like.
> The list is then available from within a plugin. It would be nice if the
> process/batch/macro could use this or something similar for its input-files.
> Volker
You could do it with python: walk a directory and its subdirectories,
inspect each file name and decide if you run the macro, command or
plugin on it. In Fiji, open the "File - New - Script", select
"Language - Python", and type something like:
import os
folder = "/path/to/folder"
for root, dirs, files in os.walk(folder):
for filename in files:
if -1 = filename.find("path-of-the-name-we-want"):
imp = IJ.openImage(root + "/" + filename)
IJ.run(imp, "Gaussian Blur...", "sigma=2")
IJ.save(imp, "/new/path/to/" + filename)
Each file of the folder and all its subfolders will be walked.
At each iteration, the root and the files are given, and also any
present subdirectories of root (the "dirs").
Albert
--
http://albert.rierol.net