Advertisement
arjunbkool

pythin_imageJ

May 6th, 2019
597
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.96 KB | None | 0 0
  1. import os
  2. import fijibin
  3. import fijibin.macro
  4. import subprocess
  5.  
  6. path_to_imageJ = os.path.join(os.getcwd(), "Application\\Fiji.app\\ImageJ-win64.exe")  # Location of ImageJ
  7. path_to_file = os.path.join(os.getcwd(), "clown1.jpg")  # Location of the first image file of my sequence
  8. x = 100  # Variable distance value
  9. y = 543  # Variable known value
  10.  
  11. macro_single_file = """ run("Open...");
  12. run("Image Sequence...", "open=[path_to_file] sort");
  13. run("Set Scale...", "distance=x known=y unit=microns"); """
  14.  
  15. subprocess.call([path_to_imageJ])  # This successfully opens the imageJ GUI
  16. fijibin.macro.run(macro_single_file)  # This should ideally run my macro in the loaded GUI above
  17.  
  18. # As per the suggested links, I can also run the commands in terminal by using
  19. # os.system('dir')
  20. #                            --or--
  21. # proc = subprocess.Popen('cmd.exe', stdin = subprocess.PIPE, stdout = subprocess.PIPE)
  22. # stdout, stderr = proc.communicate(b'dir c:\\')
  23. # print(stdout)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement