Help with getting macros to work on Vista
Posted by Lawrence B Kramer on Jun 03, 2009; 8:31pm
URL: http://imagej.273.s1.nabble.com/Help-with-getting-macros-to-work-on-Vista-tp3692274.html
Hi,
I am new to this list as well as to ImageJ in general, so if I am sending this email to the wrong place or if there is a different resource I should use, please just let me know.
I am a graduate student working in a cell biology lab where we collect alot of images via cameras attached to our microscopes. My boss wrote some image processing macros which he put in the plugins/macros folder of ImageJ. These macros seem to work well on the Mac they are installed on and he asked me to bring them home and get them working on my PC. I know little about ImageJ or coding macros for it, but figured I would give it a try.
I installed ImageJ on my PC (a new Dell Quad core processor running 64-bit Vista Home Premium) and with minor changes (changed the directory the macros were reading from / writing to) was able to get the macros that read/process/write individual images to work just fine.
However, when I tried to get the macros that do batch processing to work I received the following error message: "File is not in a supported format, a reader plugin is not available, or it was not found." followed by the correct filename from the directory the macro was reading from.
I tried to install ImageJ and the macros on my kid's PC (an older Dell PC running XP Home edition), and after making the needed directory name changes to the macros they *all* worked well. I wondered if the reason for the error was having used the 32-bit install file on the older PC, so I uninstalled ImageJ and Java from my Vista PC and then installed using the 32-bit install file. Following this one of the batch macros did work correctly the first time or two, but later it went back to having the same error, which seems very very strange.
I am glad I can get the macros to work on a XP PC, but my main PC runs Vista as likely do the PC's of some of my co-workers in the lab who will need to use these macros . I will include the text of the macros in question at the bottom of this email.
If anyone can tell me if this is a Vista specific issue and if so give me some ideas on how to look into fixing it I would really appreciate it!!!
Thanks,
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();
}
}
}