06-jun-2024
Norbert Vischer
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 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.
Before marking an egg, choose ObjectJ> Key Table [T] , or press key T. This will show a the table with the avaliable species labels, and automatically activate the 'Egg tool' 'E' in ObjectJ Tools. Then select the desired row such as hom-0
for subsequent marking. Alternatively, simply type the corresponding code 20
, which will adjust the table selection.
Subsequently, eggs of type hom-0
can be marked by clicking-and- dragging from the top to the bottom of a Horse Mackerel-0
egg, which creates a circular egg contour. The astereisk in code "*20"
indicates that the egg must be marked as contour ('shell') and not only as single point.
If the mouse is clicked-and-dragged 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.
You can rename an object by locating the cursor upon it, press key S to select 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, and activates the "Egg" tool E in ObjectJ Tools. An asterisk (*) left of 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 Key Table [T] and select 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 releas
ing 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
Plase cursor inside a contour or close to a spot, and press key "S" to select it.
If a selected object is in front, you can enter either an allowed numerical code, a predefined label like "hom-3". After pressing 'return', you have the choice to focus on the next egg, see screenshot "Rename in slide show mode".
Renames all objects with a certain label. Supports wildcard characters *
and ?
in field 'Old Label'. The corresponding images need not to be 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.
Allows to navigate to previous/ curent/ next object in zoomed mode.
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.
Isolates each marked egg as stack slice (e.g 300 x 300px), together with object number and optinally egg name.
Shows labels of all marked eggs in a table which can be saved in csv format.
If you experience unwanted stack scrolling, e.g. by slightly moving your index finger on the surface of an Apple Magic Mouse, you can block this behaviour in ImageJ1.54j21.
The Egg Tool (E) in ObjectJ Tools is automatically activated when an egg type is "ObjectJ> Key Table [T]" is selected.
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 |