Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- input = getDirectory("Input directory");
- output = getDirectory("Output directory");
- processFolder(input);
- print ("1");
- function processFolder(input) {
- FolderList = getFileList(input);
- print ("processing" + input)
- for (i = 0; i < FolderList.length; i++) {
- folderItem = FolderList[i];
- print ("2");
- //isFolderDirectory is either true, or false
- isFolderItemADirectory = File.isDirectory(folderItem);
- print ("3");
- if(isFolderItemADirectory) {
- //folderItem is a directory, process it a a folder
- processFolder(input + "/" + FolderList[i]);
- print ("4");
- }
- //folderItem is not a directory, so lets see if its an image
- doesFolderItemEndsWithTif = endsWith(folderItem, ".tif");
- print ("5");
- if(doesFolderItemEndsWithTif ) {
- processFile(folderItem);
- print ("6");
- }
- }
- }
- function processFile(folderItem) {
- run("Image Sequence...", "open=[folderItem] number=300 starting=1 increment=1 sort ");
- print ("7");
- run("Set Scale...", "distance=1 known=6.6 pixel=1 unit=ยตm global");
- //Rescale: depth = number of images
- run("Scale...", "x=0.75 y=0.75 z=1.0 width=960 height=384 depth=300 interpolation=Bilinear average process create");
- run("Scale Bar...", "width=500 height=10 font=40 color=White background=None location=[Lower Right] bold overlay label");
- //Change label position depending on rescale
- run("Label...", "format=0 starting=0 interval=1 x=800 y=50 font=40 text=ms range=1-300 use");
- //Save as video
- saveAs("AVI... ", "compression=JPEG frame=30 output + File.separator + FolderList");
- close()
- }
- print ("done");
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement