getPath bug ??

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

getPath bug ??

chris elliott
In the example code (ShowPath.txt macro) it says:

function getPath() {
       if (nImages==0) return "Error: no images open";
       selectImage(getImageID);
       run("Select None");  // bug workaround
       info = getInfo();

Is this bug now fixed? If so, is there a minimal version of ImageJ I
should require - or some code to circumvent the deslection?

chris
Reply | Threaded
Open this post in threaded view
|

Re: getPath bug ??

Rasband, Wayne (NIH/NIMH) [E]
On Apr 20, 2010, at 7:10 AM, chris elliott wrote:

> In the example code (ShowPath.txt macro) it says:
>
> function getPath() {
>       if (nImages==0) return "Error: no images open";
>       selectImage(getImageID);
>       run("Select None");  // bug workaround
>       info = getInfo();
>
> Is this bug now fixed? If so, is there a minimal version of ImageJ I
> should require - or some code to circumvent the deslection?

You can get the path an image was loaded from using the getInfo("image.directory") and getInfo("image.filename") macro functions, which were added in 1.43h. Here is an example:

    dir = getInfo("image.directory");
    name = getInfo("image.filename");
    path = dir + name;
    print(path);

-wayne