Help with getting macros to work on Vista

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

Help with getting macros to work on Vista

Lawrence B Kramer
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();
        }
    }
}
Reply | Threaded
Open this post in threaded view
|

Re: Help with getting macros to work on Vista

Ales Kladnik
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();
>         }
>     }
> }
Reply | Threaded
Open this post in threaded view
|

Re: Help with getting macros to work on Vista

dscho
In reply to this post by Lawrence B Kramer
Hi,

On Wed, 3 Jun 2009, Lawrence B Kramer wrote:

> 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.

And you can load the image from the _precise_ path specified in that error
message?

Ciao,
Dscho
Reply | Threaded
Open this post in threaded view
|

Re: Help with getting macros to work on Vista

Lawrence B Kramer
In reply to this post by Lawrence B Kramer
Hi Wayne (and others who offered advice),

Making the change to double back slashes (\\) in the directory path did
indeed solve the problem with the batch macros.  However, it seems rather
strange to me since single back slashes do *not* work. Also, in the single
image processing macros I had previously tried single back slashes and when
they did not work had switched to single forward slashes.

Just to keep things consistent I have now changed all of the macros I am
using for image processing on my PC to use double back slashes and they all
test out fine.

My thanks to Wayne, Mark and Johannes who all responded with very helpful
suggestions!

Larry

----- Original Message -----
From: "Rasband Wayne" <[hidden email]>
To: "Lawrence B Kramer" <[hidden email]>
Sent: Wednesday, June 03, 2009 11:22 PM
Subject: Re: Help with getting macros to work on Vista


> Larry,
>
> Does changing the directory path to
>
>   dir = "C:\\Users\\Larry\\ImageJ\\ImageJ Output Files\\Segments\\";
>
> help?
>
> -wayne
>
> On Jun 3, 2009, at 4:31 PM, Lawrence B Kramer wrote:
>
>> 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();
>>         }
>>     }
>> }
>
>