Macro for Image sequence
Posted by JakubD on Dec 02, 2016; 9:36am
URL: http://imagej.273.s1.nabble.com/Macro-for-Image-sequence-tp5017672.html
Hi all,
I am trying to make a macro to process data from MRI (usually many folders at once) in a way that I don't have to do anything else than set the input and output folders. The folder structure is the same for every measurement so, it is a viable approach.
The macro works just as it should untill the moment it is supposed to save the image sequence (alternating 5 or 10 images). It opens the file in folder structure, it creates a folder in the output folder, for an unknown reason it doesn't save anything and even doesn't show a sign of error, closes the images and moves on. Last folder gives an error in a way that there is some bracket expected.
Thank you in advance,
Jakub
Macro
input=input_images+input_folder;
output=output_images + output_folder;
setBatchMode(true);
list = getFileList(input);
list=Array.trim(list, list.length-3); //last 3 files in the folder don't contain images
for (i = 0; i < list.length; i++)
save_all(input, output, list[i]);
setBatchMode(false);
function save_all(input, output, filename) {
input_file=filename+"pdata\\1\\2dseq";
file=input+input_file;
File.makeDirectory(output+filename)
open(file);
fileNameStack="2dseq.png"; //this can be anything as long as there are numbers of the stack position
run("Image Sequence... ", "format=PNG name="+fileNameStack+" digits=2 save=[output+filename]);
close();
}