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:

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

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

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

How did you open the image?

Maybe this works: - 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).


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

getDir(“image”) is actually not working for me neither:

if (isOpen(id)) {
	slide = getDir("image");
} else {

Memory		3220MB of 180000MB (1%)
nImages()		1
getTitle()		"NC_Cohort 1_61-pos_SLN_C00R0_hem.svs - Series 1 (RGB)"
id		-10
slide	*	""


It would be useful if it worked since can return the path of a macro file, for example…