Zebrafish Embryo Tools

Normalize the orientation of the images of the Zebrafish embryos, find the point of injection of tumor cells and measure the distribution of Cy3 stained tumor foci.

For the time being only the normalization is implemented. You can find example images here: B2.tif, B3.tif, B6.tif, B10.tif.

The implementation is inspired by the protocol described in:

Getting started

To install the tools, drag the link Zebrafish_Embryo_Tools.ijm to the ImageJ launcher window, save it under macros/toolsets in the ImageJ installation and restart ImageJ.

the zebrafish embryo tools toolbar

  • the first button (the one with the image) opens this help page
  • the n button normalizes the angle and orientation of the zebrafish in the current image
  • the b button starts a batch processing of the normalization on a folder containing the input images


The normalization will turn the zebrafish and orient it in a way that the fish is parallel to the horizontal axis looking to the right. The input images should either be one channel images or hyperstacks containing the different channels.

It works the following way:

Normalization of the angle:
  1. If necessary convert the hyperstack to an rgb image
  2. Convert the rgb image to 8-bit. This will combine the different channels to one 8-bit image.
  3. Apply a mean filter to smooth the image.
  4. Apply a mean-threshold.
  5. Use the particle analyzer to remove small objects.
  6. Apply close and fill holes commands to get a smooth, connected outline
  7. Use the particle analyzer to remove small objects (up to 10 times the size in step 5).
  8. Create a selection from the mask.
  9. Measure the angle with the help of the "fit ellipse" measurements.
  10. Rotate the original image by the measured angle.
Normalization of the horizontal orientation:
  1. Create a selection of the zebrafish and transfer it to the original image as above.
  2. Calculate the center of mass and the centeroid of the zebrafish.
  3. If the center of mass is left of the centeroid, flip the image horizontally.
Normalization of the vertical orientation:
  1. From the left end of the zebrafish calculate the points x_s that is at 75% of the length
  2. Find the position y_s that at x_s is halfway between the upper and the lower border of the zebrafish
  3. Measure the intensity in a rectangle in the upper half and in the lower half at x_s
  4. If the intensity in the upper half if bigger than in the lower half, flip the zebrafish vertically


A right click on the n-button opens the parameter dialog.

  • thresholding method - the auto-threshold method used to create the mask and the selection of the zebrafish
  • min object size - objects smaller than this size are removed from the mask and after some operations to connect the pixels in the mask, objects smaller than ten times this size are removed.
  • normalize horizontal orientation - allows to skip the normalization of the horizontal orientation
  • normalize vertical orientation - allows to skip the normalization of the vertical orientation
  • smooth image - if selected the image is smoothed with a mean filter before the segmentation of the zebrafish is done
  • radius of filter - the radius of the mean filter
  • subtract background - a fixed value that is subtracted from the 8-bit version of the image when doing the segmentation
  • fish length ratio - the ratio of the fish length from tail end of the embryo at which the yolk sac is located
  • horizontal radius of box - half of the horizontal diameter of the rectangle used to determine the vertical orientation
  • height of box - the height of the rectangle used to determine the vertical orientation
  • crop - when checked the image is cropped to the bounding box of the segmented zebrafish plus a given border size
  • border size - size of the border that is kept around the zebrafish when the image is cropped


zebrafish embryo input image zebrafish embryo output image

Batch Processing

When pressing the b-button a dialog is opened that allows the user to select the input folder containing the images. Par default the tif-images in this folder are treated and the results are written to a subfolder "normalized". The image file extension and the name of the output folder can be changed in the options (right-click on the b-button).