All ObjectJ Examples



Norbert Vischer
Bacterial Cell Biology
University of Amsterdam



Watch the Video
(4 min, 12 MB, with sound)

StampFishEggs is a project for manaul classification of fish eggs.
It runs under ImageJ in combination with plugin ObjectJ.

Task: In this marine research project, fish eggs had to be classified and marked with one of ~100 acronyms. For two types (MAC = Mackerel and HER = herring), additionally the development stage (0..6), the egg diameter, and the diameters of any internal oil droplets had to be acquired.

Solution: The program focusses on optimal support for manual marking. The used macro contains a table of keyboard shortcuts and the corresponding acronyms.

A. Installation of ImageJ and ObjectJ:

  1. If not done yet, install ImageJ from:

  2. If the ObjectJ plugin is already visible under menu Plugins, jump to (4).
    Otherwise, you can install ObjectJ as follows:
    Download objectj_.jar from
    Make sure objectj_.jar was not renamed (because an older version already existed in the download folder).

  3. Drag objectj_.jar onto ImageJ's main window (which contains the tools).
    Confirm when ImageJ asks to store this plugin in the plugins folder, and relaunch ImageJ.

  4. You can choose Plugins> ObjectJ to make the ObjectJ menu visible (see fig 2),
    but the ObjectJ menu will appear anyway the first time you open an .ojj project file.

B. Run the demo:

  1. Download and unpack the folder '', which contains one or two images and the .ojj project file.
  2. Your project folder will now look similar to this:
  3. In order to open StampFishEggs_xx.ojj, you can either drag its file icon from the Finder/Explorer into the main window with title "ImageJ", or you can use ImageJ's Open menu.

  4. If the ObjectJ menu (between Analyze and Plugins, Fig 2) was not visible yet, it should appear now.
    Now the project window is shown. If the panel for linked images is still empty, link images by dragging them in Finder or Explorer into the panel for linked images. Alternatively, you can link images via menu ObjectJ>Linked Images.
    Green bullets confirm that the image files are in the same folder as the project.

  5. Double-click the first image to open it.

    JPG Images

  6. JPG images have undergone lossy compression and it is generally discouraged to use them. However, we do not measure intensities, and no significant errors are introduced when measuring only spatial information from contours in our case.


  7. ImageJ does not store spatial calibration inside a JPG file. Still this is correctly handled in ObjectJ, as the scales (pixels/mm) are stored inside the ".ojj" project file.
    You can change the scale of all linked images by right-clicking onto one of the fields below "px/unit" in the "Images" panel (ObjectJ v 1.03x needed). The scale can be propagated. For those images that have .tif format, the program opens these images and saves them with the new scale, so that it matches the value in the project file. For other file types (e.g. jpg) opening/resaving is not necessary.

    Code Table

  8. Choose ObjectJ> Show Table and Results to display the shortcut keys that are defined for a certain acronym. For example, species type "mac-2" is assigned to code 12. Here, "mac" means "Mackerel" and "-2" means development stage 2. The item type "shell" indicates that the program expects that the egg contour should be measured.

    Choosing an egg type

  9. By typing numerical shortcut 12, Mackerel-2 (acronym mac-2) is preselected. For 1 sec, text "mac-2" flashes close to the cursor and then disappears. Nothing is marked yet. Flash time can be changed or disabled in embedded macros. The flash also appears after pressing "E" for "egg type";
  10. Stamp eggs with contour

  11. Subsequently, "mac-2" eggs can be marked by positioning the cursor at the top of a Mackerel-2 egg, and matching the circular roi with the outer egg contour, as mac-2 is of type "Shell". If the mouse is clicked inside an existing egg, this is interpreted as one of the cell's oil droplet. (If two cells overlap, keep alt key down to avoid oil marking).

  12. Stamp eggs with single point

  13. Table entries of shape "Spot" are used for single point markers. For example, Herring (her) has code 4 and shape = SpotA. Press key "4" and click on one or several herring eggs to mark them with a single point.


  14. there is a checkbox "Show Object Layer" in ObjectJ>Show Project Window> Images Panel. This should be switched on. To show or hide individual item types, go to the "Objects" panel and check "Selective Item Visibility" which then displays clickable "eye" icons in the ObjectJ Tools window.

C. ObjectJ Menu Commands

Show Table and Results [T]

Opens the Code Table, that reflects the shortcut definitions and their species labels. Additionally, it opens and updates the ObjectJ "Linked Results" tables. In contrast, choosing ObjectJ>Show ObjectJ Results does not update columns Spec and Stage

Egg Tool [E]

Activates the Egg Tool (E) in ObjectJ Tools. This is a preparation for marking eggs. At the same time, a 1.5 sec flash appears close to the cursor to indicate currently preselected egg type.

Pistol Tool [P]

This is a shortcut for selecting the pistol tool in ObjectJ Tools, which is used to kill entire objects, or (with the shift key down) items such as an oil droplet.

Finger Tool [F]

This is a shortcut for selecting the Finger tool in ObjectJ Tools. With the finger tool, you can select an object.

Exotics [X]

To use label names that are not listed in the shortcut label, choose "ObjectJ>Exotic [X]" to enter a special name. Previous exotics may appear as radio buttons to bereused without typing. You also can enter names that are already defined in the code table.

Rename Objects...

Menu "Rename Objects" can be used to change the name of existing objects. The new name needs not to be in the code table. If you check "Confirm", each egg will be shown in zoomed mode before you click Yes or No.


"Key" menu should be ignored by the user, but it is necessary to accommodate 20 keystroke shortcuts (keys 0-9, and keys n0-n9 from the numerical keypad). You cannot choose such a key from the menu because the mouse location is used to locate the fish egg.

D. Screenshots:

Fig 2:
Left: Code table:

Column Explanation
N keyboard shotrcuts
Species: Label used for overlay
Shape: "Shell" for circular contour, "Spot" for single point marker
Column Freq: Shows count of corresponding category

Right: This macro code was used to define the code table shown on the left. When altering this for your needs, choose single digits for the most frequent species. Example: "her" is marked after pressing single digit "4". If another shortcut would try to use "41", the program would report an error.

E. ObjectJ Result Columns

Column Explanation
Cat Category, name of the acronym used as labes
Spec Name of species, same as "cat" before the dash
Stage Development stage, digit after the dash in Cat
EggDia Diameter of egg if it was measured
nOil number of oil droplets
OilDia1 Diameter of oil droplet #1
OilDia2 Diameter of oil droplet #2
OilDia3 Diameter of oil droplet #3
OilDia4 Diameter of oil droplet #4