Login  Register

Re: Help with getting macros to work on Vista

Posted by Ales Kladnik on Jun 04, 2009; 12:39pm
URL: http://imagej.273.s1.nabble.com/Help-with-getting-macros-to-work-on-Vista-tp3692274p3692277.html

I think you should use backslashes in path. But strange, the first macro
uses forward slashes, and you say it works. hmmm...

What is the file format of the images you are analysing?

-Ales Kladnik


Lawrence B Kramer said...

> However, when I tried to get the macros that do batch processing to...
> I tried to install ImageJ and the macros on my kid's PC (an older...
> I am glad I can get the macros to work on a XP PC, but my main PC...
> Larry Kramer
>
> Example of a macro (ManualSegment.txt) that works fine on both PC's:
> // This macro was written by Chris Rongo to segment out puncta and
> // patches in an image.
> // Modified by Larry Kramer 05/28/2009 - Changed
> // directory line to make compatible with my PC file structure.
> //
> name = getTitle
> run("Make Binary");
> // Next line commented out since only used if on Mac in lab.
> //dir = "/Users/local/Desktop/ImageJ Output Files/Segments/";
> dir = "C:/Users/Larry/ImageJ/ImageJ Output Files/Segments/";
> saveAs("Tiff", dir+name);
> close();
>
> The macro (Batch_Lengths.txt) that initially worked okay on Vista, but now gives errors, works fine on XP:
> // This macro batch measures a folder of images.
> // Use the Analyze>Set Measurements command
> // to specify the measurement parameters. Check
> // "Display Label" in the Set Measurements dialog
> // and the file names will be added to the first
> // column of the "Results" table.
> //
> // This macro was written by Chris Rongo
> //
> // Modified by Larry Kramer 05/28/2009 - Changed directory lines to
> // make compatible with my PC file structure.  On 05/30 updated this
> // and now works better, but getting different error.
> //
> // Next line commented out since only used if on Mac in lab.
> //  dir = "/Users/local/Desktop/ImageJ Output Files/Lengths/";
> macro "Batch Measure" {
>     dir = "C:/Users/Larry/ImageJ/ImageJ Output Files/Lengths/";
>     list = getFileList(dir);
>     if (getVersion>="1.40e")
>         setOption("display labels", true);
>     setBatchMode(true);
>     for (i=0; i<list.length; i++) {
>         path = dir+list[i];
>         showProgress(i, list.length);
>         if (!endsWith(path,"/")) open(path);
>         if (nImages>=1) {
>             run("Set Scale...", "distance=15.385 known=1 pixel=1 unit=micron global");
>             run("Set Measurements...", "feret's display redirect=None decimal=3");
>             run("Analyze Particles...", "size=1.0-Infinity circularity=0.00-1.00 show=Outlines display include");
>             close();
>         }
>     }
> }