Coral growth analysis- How to count the number of branches or nodes?

I am a final year biology undergrad and for my final year project I am analysing the the growth of a coral sea fans. I have over 1000 images to analyse. I want to measure growth by counting the number of new branches the coral makes each year.

Does anybody know If I could use the Strahler Analysis Plugin for this? Will it be able to recognise the nodes/branches/junctions in my seafans and then count them?

I would have just downloaded it and has a go but the instructions for downloading it are completely baffling to me! I know nothing about programming and using scripts to download. Could anyone help me with this? Is there an easy way to download these programs?

I have included a sample photo of one of my Sea Fans, I have placed red dots in the photos on the "junctions’ I wish to count. At the moment the only way I can figure out to do this is by dotting the images and then manually counting the dots.

I would really appreciate any advice you guys have :slight_smile: Thank you!

Hi @Seafan1,

I’m not familiar with the Strahler Analysis plugin, but maybe Analyze Skeleton would be helpful. At least with it you can count the total number of junctions and end points in an image. Before you run Analyze Skeleton you need to skeletonize your image. You can achieve this with the Skeletonize plugin. Both provide good tutorials on how to use them.

To install these plugins just download their JAR-files, and drop them to you ImageJ / Fiji plugins folder.You can find the JAR-files by following the File link. Then on the bottom right corner select the Artifact tab and click Download.

Richard Domander


Just an idea. But you can also have a look at root analysis plugins and macros. Some of them a semi automatic:




Just a comment to @rimadoma’s installation instructions: if you use Fiji, the plugins are already installed by default :wink:



Hi thanks so much for this suggestion!! That also would be perfect. But unfortunately when I apply the skeletonize function it makes my whole image black. Is this a common problem? Would it help if I altered the contrast of the image before?

I did convert it to 8 bit before using, it says you need to.

Thank you @iarganda Fiji is much easier to use however it does not have the Analyze skeleton plugin :confused:

Also thanks @Bio7 for the suggestion, I have tried similar things, such as (for assessing leaf venation) but I was unable to get this to work either.

Just to add, I just tried using binary form instead of 8 bit and it did work but the image is showing every polyp (individual animal in the coral)! This is not what I want either! I’ve attached the photo below, the original photo, the binary and after the skeleton plugin was applied.

I was wondering is there a way of changing the sensitivity of the skeleton plugin?

Analyze Skeleton comes within Fiji and it is now under the menu Analyze > Skeleton.

No, you may need to pre-process your image first, maybe with a Gaussian blur?

1 Like

You can convert the image (here I used your black and white image) to a binary. Then you can play with ‘Erode’. A Median filter will eliminate the tiny structures in the image to work out the main branches.

Something like this:

`setOption(“BlackBackground”, false);
run(“Make Binary”);
run(“Median…”, “radius=4”);

which results in somthing like this:

Then you can try to skeletonize this image.

In the next example I carefully thresholded the red channel of the original RGB image and applied a median filter only:

Median filter:


You can certainly find more improvements by carefully choosing the parameters or by using, e.g., the color threshold, etc.


This is brilliant thank you so much! This is a crucial step! I’ve managed to skeltonize the image now :slightly_smiling:

However when I run the analyse skeleton, it counts too many junctions, probably because of the loops, as you can see from your image above. The Strahler plugin I mentioned previously takes into account these loops and discounts them.

I’m sorry to keep asking questions!.. but I think it would be ideal if I could use this Strahler plugin. I can’t figure out how to manually download this plugin. I am using Fiji now but still can’t find this plugin.

This is the link below to the plugin description.

You can find the installation instruction here:

Users: You can enable an update site using the Help :arrow_forward: Update… command and clicking the “Manage update sites” button

Then add the update site “Add Update Site”:

Then activate the checkbox next to the line containing BAR (


Have you tried setting the cycle pruning option in AnalyzeSkeleton?


For update sites from the official list of update sites, the recommended way of installation is just to activate them in the list, not to add them manually:

(I edited your post above to avoid confusion about the best way to add update sites. I hope you don’t mind. :slightly_smiling:)


Hello Jan,

absolutely not. Thanks for the correction. I didn’t see it.

Thanks guys!

I’m very nearly there after all your help!

I managed to run the script for the strahler analysis after first processing the image by following the instructions from @Bio7

setOption("BlackBackground", false);
run("Make Binary");
run("Median...", "radius=4");

I then got this output

It’s quite dark but the image on the right shows all the counted end points which is what I want :slightly_smiling:

However to save time, I would like to be able to do this to multiple images at a time but I can’t make this work by running the script- i tried to stack the images first but it processed it as one and gave me this picture of craziness! -

I’ve followed the instructions by @imagejan (thanks!) but I still can’t find the strahler plugin :frowning: It is there but it’s not ‘active’ and has a strahler analysis.bsh see below

I can’t find this function either!

under analyze skeleton the only option I have is skeletonize. Am I missing another update somewhere? I am using Fiji.

Also if I were to use the the skeletonise and pruning function (instead of the Strahler analysis which has both built in) would I be able to analyse multiple photos at once?

You can batch process the images very easily from a folder and put all your commands in a macro which will be executed:>Macro

Of course you can also all do this in a macro, too.

For the Strahler plugin open the Update menu (Help->Update…) then press “Manage update sites” (1) and then add the BAR site (2) to the default sites:

Then press “Apply changes” and restart ImageJ.

1 Like

Hmm, the option should be visible in the dialog that pops up when you run the plugin. If you run the plugin via scripts you can set the pruning option in the first parameter to the run call:

var skel = new AnalyzeSkeleton_();
skel.setup("", imagePlus);

var skelResult =, false, true, null, true, false);

The options are: AnalyzeSkeleton_.NONE, AnalyzeSkeleton_.SHORTEST_BRANCH, AnalyzeSkeleton_.LOWEST_INTENSITY_VOXEL and AnalyzeSkeleton_.LOWEST_INTENSITY_BRANCH. The two latter also require an grayscale image of the imagePlus (this is the 4th parameter that’s null in the above code).

To answer your second question, I don’t know how AnalyzeSkeleton would handle multiple images. I know it can process multiple skeletons (objects) in the same image, and will report their statistics separately in the results table.

Hi @Seafan1,
Sorry for not jumping in earlier. I’ve developed the Strahler plugin and should be able to help. If I got it right, you need help concerning 1) Installation, 2) Batch processing and 3) Resolving closed loops the ramified structure.

@Bio7, @imagejan and @rimadoma already helped you with most of it, but just for thoroughness and future reference I will try to comment on those:

Strahler is distributed with the BAR suite of scripts. That’s why the easiest is to subscribe to the BAR update site. If I recall correctly this should be mentioned in the Installation sections of both the Strahler and BAR documentation pages. AnalyzeSkeleton (Analyze▷ Skeleton▷ Analyze Skeleton (2D/3D)…) and Skeletonize3D (Plugins▷ Skeleton▷ Skeletonize (2D/3D)…) are part of core Fiji.

Batch processing
Typically (and for highest flexibility) ImageJ plugins operate in single images with processing of multiple images being handled separately by ImageJ. As the vast majority of ImageJ plugins, Strahler is macro recordable. So the easiest way to process multiple images would be to:

  1. Start the Macro Recorder (Plugins▷ Macros▷ Record…)
  2. Run BAR▷ Morphometry▷ Strahler Analysis on the first image
  3. Copy the resulting line into the Batch Processing dialog (Process▷ Batch▷ Macro…). The recorded line would look something like it:
run("Strahler Analysis", "max.=10 infer ignore method=[shortest branch] display_iteration show");

If needed, you could also use some of BAR’s Batch_Processors. But in either case I’d explore first the procedure in a couple of images after reading the pages mentioned above. Any of us will be able to help you with this automation, but we will sure be more effective if you first give it a try.

Skeleton loops
In short: The plugin cannot process skeletons containing closed loops. You have several options to resolve such loops, including some sophisticated ones that will use the original (pre-thinned) image to determine the best way to open up loops in the structure. Rationale and details are explained in both the Strahler and AnalyzeSkeleton documentation (the core functionality of Strahler is provided by AnalyzeSkeleton, so all the information you need will always be in either documentation page). NB: Strahler will automatically disable loop-resolving options that cannot be applied to your image. E.g.: If the original grayscale image of the structure is not available, Intensity-based options will not be available.

Since your coral is a somewhat polarized structure, I wanted to mention that you will probably be interested in determining the root of the coral, as described in Root Detection (NB: There have been some recent improvements in root detection that are not yet documented). For this to work you will have to mark the root of your corals with a rectangular ROI, as mentioned in the documentation. This option is also compatible with batch processing as long as you save your images as .tiff, since the ROI will be saved in the image header and retrieved at startup by ImageJ.
On a slightly different note, I wanted to mention that you could also complement your analysis using Sholl.


Amazing! Thanks for answering! :smiley:

I’ve got strahler plugin to install and run on a single image now. I’m just struggling with the batch analysis. I’ve got to the stage where I have binary images in tiff format ready to use the Strahler analysis. But I get this error message and don’t know how to resolve this.

okay, so to break down my method for this analysis, for each image I will:

  1. Format it as binary and use the erode function so that each individual polyp is not visible. I think this will have to be done individually.
  2. Root the Fan by making a ROI (very good suggestion thank you!)
  3. save the image as a tiff file
  4. create a batch for the images of the same Sea Fan over the time series

These steps above are fine.
What I now need to figure out is:

  1. For the loops, do I need to get rid of them before running the Strahler analysis? Or does it take it into account? In the first image I used with Strahler analysis there were loops but the analysis ran anyway so I wonder if it’s necessary?
  2. The batch Strahler analysis that wouldn’t run as shown above. I would just like to mention that (typically!) I am very time limited and so being able to run the analysis in batch is crucial!

I also have another question. From my database I have selected the Sea Fans with the most simple, ‘2D’ structure. There are many Fans that are far more complicated. I was wondering if you think that the Strahler could cope with more complicated structures such as the fan seen below?

The problem is that, when making the image binary the branches tend to blur into each other.

Again, thanks to everyones help so far! I couldn’t have done it without your input!! :blush:

It seems that you copied Java code instead of ImageJ Macro code in the Batch dialog.

From which source is the code?

The error message starts at the beginning of the imports (import ij.IJ;).

However, please paste the macro code in the dialog as @tferr suggested, something like:

run("Strahler Analysis", "max.=10 infer ignore method=[shortest branch] display_iteration show");

Press “Test” to controll if everything is working as it should before you apply the macro on the selected folder of images.

1 Like

The code is from the link on the strahler plugin website.

The code I got from this link circled on the image above and then integrated the code from @tferr. Then when I ran the test I got the error I mentioned above.