2

I need to run a Fiji(imageJ) script from terminal on a macOS. Using the code below.

/Applications/Fiji.app/Contents/MacOS/ImageJ-macosx --headless -macro ~/desktop/testing.ijm.ijm

And the Fiji script I need to run is

dir = getDirectory("Where I need help");
run("Image Sequence...", "open=dir");
path=dir+"needsave.avi";
run("AVI... ", "compression=JPEG frame=5 save=&path");
close();

However I want the directory to be the current location in terminal. For example:

MYs-MBP:~ csh;
[MYs-MBP:~] cd desktop/test/test2
[MYs-MBP:~/desktop/test/test2] /Applications/Fiji.app/Contents/MacOS/ImageJ-macosx --headless -macro ~/desktop/testing.ijm.ijm

and therefore I will process everything in test2 by using the Fiji script I write.

Geyao Li
  • 21
  • 2

1 Answers1

1

Use this macro command:

cwd = call("java.lang.System.getProperty", "user.dir");

Note that this question was cross-posted to the ImageJ mailing list (1) and to the ImageJ Forum (2).

In future, when cross-posting, please link to all other places you are asking the question, to protect the time of those answering your question.

ctrueden
  • 6,751
  • 3
  • 37
  • 69