gc icon Gilles Carpentier Research Web Site: Computer Image Analysis - Methods and Examples. ima
---
ijasA method to create Apple Script applications allowing
 an automatic treatment of file images by an ImageJ
§  macro
using drag and drop.

Mac OS X3 to Mac OS X5 (Intel and powerPC compatible)
ImageJ and AppleScript Main Page
preview


26-06-2004. Last update, 15-01-2008: it now works with the latest java and system updates from MacOS X.3 to MacOS X.5.

This method uses MacroSet.txt ImageJ macro file.

! The MacOS 10.3.9 (15-04-2005) update may cause troubles on some computers: for example, sometimes, ImageJ isn't recognised by the finder. In that case, the script asks what application has to be used during the first use after updating. Choose ImageJ in the list. The further utilisations of the script shall work correctly.

! It is advised to use a G4 or G3 400 Mhz (512K L2) computer at least, and to start ImageJ (and so java engine) before using the demo script.



Description:
--MacOS X -+ - -- ---+ ----

Apple Script is a technology developped by Apple since several years to automatize finder repetitive tasks, and to pilote scriptable applications. It is available on MacOS X and it is installed by default. An application, to be scriptable needs to be customized by adding a dictionary of functions which allows Apple Script to send and receive Apple events. Although ImageJ hasn't a so dictionary, this page shows one way to pilot it, using User Interface scripting (UI Scripting). This technology also called GUI Scripting (related link), allows users to script non scriptable applications by controlling the computer's graphic user interface via AppleScript. This function must be activated in the Universel Access Control Panel.

UI Scripting allows to activate the shortcuts associated to the ImageJ menus, and those of the installed macros. The present example shows how to apply to an image, a very basic macro (invert function). For a description of the ImageJ macro language functionalities, illustrated by several examples, see this link.

Functionalities used:
- Apple Script drag and drop application.
- Auto-installation of macros contained into a text file when it is opened by ImageJ.
- AppleScript can manipulate text: the macro code is contained in the Apple Script application which auto-write a MacroSet.txt file.
- Shortcuts "Y" and "y" menu shortcuts are used to activate two macros by UI Scripting.
menu


Notice:
notice
  • Download the example. Installation : put the download folder on the desktop, open the folder, start ImageJ and drop the image on the  "IJd&d - MacOSX3 and Later" AppleScript application.



Note: Image J doesn't send an apple event when a process is completed. So, a delay between some operations is imposed to ensure a correct execution order of commands. Sometimes even with these delay, a misfunction may occure, when a hard disk is in sleep mode, or when other process run at the same time. To avoid the problem, it is advised to start ImageJ before using this Apple Script.
A more elaborated method for piloting ImageJ with AppleScript using "shell" commands, avoiding these delais, is described at this link [§3].
  • Commented code of the script example. The following code is described step by step in order to be as clear as possible for beginners. Computer languages are not very natural especially for biologists, so I tried to make an easy understanding page. Sorry for developers if they find it too basic :-)


References:



ij § ImageJ (http://rsb.info.nih.gov/ij/) is a public domain Java image processing program inspired by NIH Image for the Macintosh. It runs, either as an online applet or as a downloadable application, on any computer with a Java 1.1 or later virtual machine. Downloadable distributions are available for Windows, Mac OS, Mac OS X and Linux. The author, Wayne Rasband (wayne@codon.nih.gov), is at the Research Services Branch, National Institute of Mental Health, Bethesda, Maryland, USA.

ima Page author:
Gilles Carpentier
, Faculte des Sciences et Technologies,
Universite Paris 12 Val-de-Marne, France.
bioch
Microscopy Image Acquisition
and ImageJ contributions
mail Computer Data Acquisition
for Biochemistry Practice Works

Special thanks to Alessandra Albano for the English correction of this page.
--
Locations of visitors to this page

--

-

-

-

-

-

-

-

-

-

-

-

-

-

-

-

-

-

-

-

-

-

-

-

-

-

-

-

-

-

-

-

-

-

-

-

-

-

-

-

-

-

-

-

-

-

-

-

-

-

-

-

-

-

-

-

-

-

-

-

-

-

-

-

-

-

-

-

-

----

----

------