24-mar-2022
Norbert Vischer
Bacterial Cell Biology
University of Amsterdam
Watch the Video (4 min, 12 MB, with sound)
StampFishEggs is a project for manual classification of fish eggs.
It runs under ImageJ in combination with plugin ObjectJ.
In this marine research project, individual fish eggs need to be classified and marked with one of ~100 acronyms, such as her
(= herring ), or mac-2
(= mackerel in development stage 2). For some species, the circular egg outline plus any internal oil droplets need to be marked. Other species are marked with a single point only.
StampFishEggs.ojj is software that focusses on optimal support for manual marking. The .ojj project file contains all needed embedded macro commands, a table of shortcuts and acronyms, and receives all marked regions of interest.
If not done yet, install ImageJ from: http://imagej.nih.gov/ij/
If the ObjectJ plugin is already visible under menu Plugins, jump to (4).
Otherwise, you can install ObjectJ as follows:
Download objectj_.jar from
https://sils.fnwi.uva.nl/bcb/objectj/download/current/
Make sure objectj_.jar
was not renamed (which can happen when an older version already exists in the download folder).
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.
Optionally 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.
StampFishEggs_xx.ojj
project file and move it into the folder that contains the images to be markedOpen StampFishEggs_xx.ojj
by dragging its file icon from the Finder/Explorer into the ImageJ's main window; alternatively, use ImageJ's File>Open... menu.
The "ObjectJ" menu between "Analyze" and "Plugins" is visible now, and the project window StampFishEggs_xx.ojj
with its "Linked Images" panel is shown.
Populate the panel for linked images with the images to be analyzed. This can be done by dragging their icons from the Finder or Windows Explorer into the panel for linked images, or choose ObjectJ>Linked Images>Link>Link Image from Project Folder.
Green bullets confirm that the image files are in the same folder as the project.
Open the first linked image by double-clicking its name.
Make sure the image scale is correct. In the "Linked Images" panel, right-click a field below "px/unit" and assign the correct value (for the demo images, use 177 pixels/mm). The scale can be propagated to all linked images, and is stored in the .ojj
project file.
Optinally choose ObjectJ> Show Code Table [T] to observe the available labels and their shortcuts. For example, *20 hom-0
means "Horse Mackerel egg in development stage 0", and shortcut keys are '20'. The leading asterisk (*) indicates that the egg contour should be marked, not its center.
Before marking an egg, adjust the current preset: choose ObjectJ>Preset[P] and enter a label such as hom-0
for subsequent marking. A faster way would be to type directly 20
without invoking the menu. The preset appears in the images label field at the top left.
Note: You also can click in the Key Table to select the desired species. However, the preset indicator in the top left label field is then not immediately updated. In case "Egg Tool E" wasn't active yet, choose ObjectJ>Preset[P].
Subsequently, eggs of type hom-0
can be marked by positioning the cursor at the top of a Horse Mackerel-0
egg and then matching the circular roi with the outer egg contour, as hom-0
has the astereisk and thus 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).
Table entries without asterisk (*) are of shape "Spot", i.e. marked with single points. For example, if Herring (her) has code 4, then press key "4" and click on one or several herring eggs to mark them with a single point.
You can rename an object by locating the cursor upon it and choose ObjectJ>Rename [R]
You can kill an object by locating the cursor upon it and choose ObjectJ>Kill [K]
Results can be shown via ObjectJ>Frequencies>Stage or ObjectJ>Frequencies>Species. You also can look at the entire results table via ObjectJ>Show Object Results
Periodically, choose ObjectJ>Save Project to save markings in the .ojj project file.
This shows the available shortcut numbers (single or dual digits) and the connected labels. An asterisk (*) next to the key indicates that the egg is expected to be marked with a circular contour (which in turn can receive oil droplets), otherwise with a point only. In the demo, the first label is "dummy" with key 0 , which suggests that you change the label after marking (see "Rename").
Before marking, choose Preset and enter the desired label, for example hom-3
for Horse Mackerel stage 3. The label field in top-left corner of the front image will show: *23: hom-3
. Here, the asterisk * means that the item type is "Shell". The digits "23" indicate the shortcut for this egg type.
For faster access, you also can type "2" and "3" within 1.5 sec to preset hom-3
.
Mark Contour:
As the chosen code is of type "Shell" (with the asterisk *), click in the image and drag until circular roi matches the egg contour; when releasing the mouse, the egg is labeled with hom-3
. The the labels' font size can be changed under ObjectJ Tools>Sizes...
Oil droplets:
Now or any time later, you can mark oil droplets inside any contour (observe the oil diameter in the status bar). If egg contours overlap, then keep the alt-key down to avoid marking of oil droplets.
Mark Spot:
If a point object is preselected (key without asterisk), a single mouse click marks and labels the point under the cursor.
You can delete an entire object by placing the cursor either inside a contour or close to a spot, and press key "K" (= kill). This will update the ObjectJ results table. Alternatively, use the Pistol tool from ObjectJ> Show ObjectJ Tools, which also can be used in combination with the shift key to kill an oil droplet only
Selects the object that is closest to the cursor either inside a contour or close to a spot, and press key "K" (= kill).
For renaming an object, place the cursor inside a contour or close to a point object, and press key "R" (= Rename). You can enter either an allowed numerical code, a predefined label like "hom-3", or a new label that was not defined yet.
Choose **ObjectJ>Batch Rename to rename all objects with a certain label. This also works if the corresponding images need not open.
"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.
Displays the frequency of individual egg labels, where different stages are counted separately.
Displays the frequency of the species labels independent of their stages.
Note: you also can observe the linked results via ObjectJ>Show ObjectJ Results. Here, one egg occupies one row.
The Egg Tool (E) in ObjectJ Tools is automatically activated when an egg type is "Preset" as preparation for marking eggs.
Column | Explanation |
---|---|
Keys: | keyboard shotrcuts, |
Label: | Label used for overlay |
* | asterisk (*) asks for circular contour, otherwise single point marker |
Key table with explanation
The ObjectJ Results table is linked to the image markers and shows one object per row
Column | Explanation |
---|---|
File | File name |
Label | Object label |
Spec | Species, part of label before the minus sign |
Stage | Development stage, digit after the minus sign |
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 |