1

I am trying to create a macro on Fiji (ImageJ). I cannot find how to introduce a user input. I want to sum a stack with z project. Each sum is the result of 10 stacks. But the start is not the same. It varies between 1 and 11. So it would be fine when the user choose a startpoint. when the file is saved, the filename should contain the start and endpoint. So I know some weeks later which stacks I used. Thanks for some hints!

imageTitle=getTitle();
path = "D:/test/";
first = Dialog.getChoice();
// first = 8;
last = first+9;
selectWindow(imageTitle);
run("Z Project...", "start=first stop=last projection=[Sum Slices]");
run("Red");
saveAs("Tiff", path+"SUM_"+imageTitle+"("+first+last+")";

I get the error message:

"No dialog created with Dialog.create() in line 3: first = Dialog.getChoice> () ;

When I didnt choose the start I get the error message:

" ')' expected in line 9: saveAs ( "Tiff" , path + "SUM_" + imageTitle + "(" + first + last + ")" <;>

ross
  • 2,684
  • 2
  • 13
  • 22
Alexander
  • 73
  • 7
  • 1
    I modified my code a bit and now it works. I changed line 4 to first = getNumber("first?", 8); and the last line to: part1 = "("+first; saveAs("Tiff", path+"SUM_"+imageTitle+part1+last+")"); – Alexander Sep 02 '19 at 09:27

0 Answers0