Advertisement
Guest User

Untitled

a guest
Nov 23rd, 2017
77
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.63 KB | None | 0 0
  1. input = getDirectory("Input directory");
  2. output = getDirectory("Output directory");
  3. processFolder(input);
  4.  
  5. print ("1");
  6.  
  7. function processFolder(input) {
  8. FolderList = getFileList(input);
  9. print ("processing" + input)
  10. for (i = 0; i < FolderList.length; i++) {
  11.  
  12. folderItem = FolderList[i];
  13. print ("2");
  14. //isFolderDirectory is either true, or false
  15. isFolderItemADirectory = File.isDirectory(folderItem);
  16. print ("3");
  17. if(isFolderItemADirectory) {
  18. //folderItem is a directory, process it a a folder
  19. processFolder(input + "/" + FolderList[i]);
  20. print ("4");
  21. }
  22. //folderItem is not a directory, so lets see if its an image
  23. doesFolderItemEndsWithTif = endsWith(folderItem, ".tif");
  24. print ("5");
  25. if(doesFolderItemEndsWithTif ) {
  26. processFile(folderItem);
  27. print ("6");
  28. }
  29. }
  30. }
  31.  
  32. function processFile(folderItem) {
  33. run("Image Sequence...", "open=[folderItem] number=300 starting=1 increment=1 sort ");
  34. print ("7");
  35. run("Set Scale...", "distance=1 known=6.6 pixel=1 unit=ยตm global");
  36.  
  37. //Rescale: depth = number of images
  38. run("Scale...", "x=0.75 y=0.75 z=1.0 width=960 height=384 depth=300 interpolation=Bilinear average process create");
  39.  
  40. run("Scale Bar...", "width=500 height=10 font=40 color=White background=None location=[Lower Right] bold overlay label");
  41.  
  42. //Change label position depending on rescale
  43. run("Label...", "format=0 starting=0 interval=1 x=800 y=50 font=40 text=ms range=1-300 use");
  44.  
  45. //Save as video
  46. saveAs("AVI... ", "compression=JPEG frame=30 output + File.separator + FolderList");
  47. close()
  48. }
  49.  
  50. print ("done");
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement