Limitations / workarounds of getting image directory?

How can I get the file directory of the currently shown image in virtual hyperstack?

I’m trying to use macro commands to grab the directory of the currently displayed image:
getInfo(“image.directory”)
getDir(“image”)
getDirectory(“image”)

I can’t get it work for:
hyperstacks
virtual hyperstacks
virtual stacks composed of multiple directories

I can get these commands to work for:
stacks
virtual stacks made from one directory

Any suggestions/something I’m missing/workarounds? Thanks!

How did you open the image?

Maybe this works: File.directory - The directory path of the last file opened using a file open dialog, a file save dialog, drag and drop, open(path) or runMacro(path).

2 Likes

Interesting, that works! Thank you!

For the record, I was trying a number of different ways to open the stack:
run(“Stack From List…”, “open=”+path+" use");
drag and drop a directory;
etc. etc.

<><><><>

Can I followup, why does this work? Are virtual stacks constantly running open() commands?
And also, why are the other commands not working?

Hm one would need to look in the implementation of the functions.
I guess the virtual image does not register as an active or current image.
Thus the directory information retrieved via getDir etc… is empty.

Whereas it has to be opened by Fiji in a way.
A virtual image would only have the plane that is shown in memory.
It would run a method then to retrieve newly requested data.

1 Like