Login  Register

Re: getPath bug ??

Posted by Rasband, Wayne (NIH/NIMH) [E] on Apr 20, 2010; 2:50pm
URL: http://imagej.273.s1.nabble.com/getPath-bug-tp3688539p3688540.html

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