When I am changing open image window it forgets the directory, how can I retrieve it to save again This is how I create a direcotry in Stack image folder
dir=getDirectory("image");
print(dir)
splitDir= dir + "OneChannel";
File.makeDirectory(splitDir);
print(splitDir);
This is where I change the active image window to Montage.tiff to save it to splitDir folder
title= getTitle()
saveAs("tiff",splitDir+title);
The error is undefined variable. Should I make global splitdir to keep it when I change the active image window
Error: Undefined variable in line 2:
saveAs ( "tiff" , <splitDir> + title ) ;
Thanks in advance
Variables in ImageJ macros are case-sensitive. In your code you have defined
splitDir
but have not definedsplitdir
, hence the error. Change the line tosaveAs("tiff",splitDir+title);
and it should work.