Quantifying colour area in fossil sections

Hi All,

I am sorry in advance if the problem sounds naïve but I am quite new to ImageJ/Fiji and I have used it before only for some very simple area measurements on pictures with very good contrasts.

I need to measure the area of different carbonate layers with different colours in sections of fossil shells.
From the attached picture, you can notice that the section is characterized by many not-organized layers, that can be grouped in 2 categories:

  1. grey layer” - the main matrix of the shell that looks grey with some shadows of blue/yellow
  2. white layer” - many white lenticular deposits within the grey layer

What I am trying to measure are:

  1. the total area of the shell section
  2. the area of the white layer
  3. the area of the grey layer (this would just be total – white area)

In this case I having a really hard time with thresholding and extracting both the whole section area and the white patches.
The white of the “white layer” is not so homogenous and I think that it is the main problem. I have already tried improving contrast, various filtering options in ImageJ but without success. I thought that the color contrasts in the image were enough high to get away with it without much processing.

Do you have any advice to process the image or improve contrasts with ImageJ to threshold the total/white areas more easily? Or perhaps is there a better way of doing it (such as using segmentation)?

1 Like

I would try UV light maybe some layers fluoresce, or an infra red filter in the camera.

Hi Gabriel,
Thank you for the suggestion, but I do not have access to any of those light sources/ instrument you mention, but just a very high resolution stereo microscope with reflected light. At this time I would like to find a way with this kind of photo.

You can get a UV light very cheaply (UV LEDs cost nearly nothing) and the same for a IR filters from a photography shop. I would also try polarising filters. Good luck!

1 Like

Hi Gabriel,
It appears the the image is not very uniform and that is causing some problems with segmentation. You may want to try segmenting smaller uniform areas and combining the results. Since the features you want to measure are large, applying a Gaussian blur will reduce the influence of the white material’s structure. If the contrast is due to composition, a carbonate stain like alizarin red may help. If it’s due to porosity an infusion may help (especially if it fluoresces!). Improving the imaging conditions could also help reduce the non-uniformity and improve the contrast. You may want to try to flat-field the image to correct for illumination non-uniformity. Segmentation by anisotropic diffusion is another option if none of the above are successful.
All the Best,

I addressed my initial reply to Gabriel. My Bad.
A quick dividing up the image, setting the threshold for each image and running “Analyze Particles” seemed to do a plausible job.
I first scaled the image size to 1919x391.
Dividing the image macro

run("Set Measurements...", "area mean min redirect=None decimal=3");
	makeRectangle(x, 0, 199, 391);
	run("Duplicate...", " ");

Threshold each image manually.

Analyze Particles Macro

for(x=2;x<11;x++) //image 1 is the original image
	print("Name=" + getTitle());
	run("Analyze Particles...", "size=10-Infinity show=Outlines display");

I add the areas in Excel.
I hope this is helpful

1 Like

Hi @lucat

I am not an expert in ilastik but followed the pixel classification procedure and got the following segmented image:

and here is the original image:

When I compare the two, segmentation results look pretty good to me, given that I only spent a few mins in training the classifier. Results could be improved further by spending more time in training as described in the documentation link above.

Note that the exported segmented image from ilastik had only three values corresponding to three object classes I trained on (1 for white areas shown in green, 2 for grey areas shown in blue and 3 for the background). I then applied an LUT in ImageJ to display the image in colors.

Hope it’s helpful!



Hello ,
Bio-minerals such as any ocean shells and most bones are basically “Fractal” in character, and the more you polish and try to segment, the main problem follows that trend. Which makes it difficult to get any type of ‘final’ data.
In many situations like this you must decide at what depth you want to go to for each layer, and each layer in shell types changes with temperature and environment of the shells origin.
As a test to see what I mean by this make a histogram of the image, then subtract a set amount from the image and make another histogram. You will notice that the “shape” of the histogram did not change, only the values. Therefor you will need to decide how far you wish to go at each level of study. I assume you wish to examine each layer.
If you need further assistance, include a copy of the histogram so I may better explain a proper procedure for this type of classification,
Have a look into the BoneJ plug in as it will be useful to you also.
Bob Smith

1 Like

@gabriel, thank you for the advise. I’ll give these a go in the next days, especially the polarizing filters, since it is the only one I already have with the VHX I am using (changing the light source on those is not that trivial). It might help getting better results with segmentation. I already tried that using wika or ilastik, which seem to give quite good results with this first sample.
I’ll post updates abut this.

thank you for the suggestion/pipeline! It was very useful. I am sure I am going to use this for some larger sections when I analyze them, if other more “automated” approaches fail.

Hi @vedsharma ,
thank you so much for the very helpful suggestion. I did not know about ilastik, I gave it a go and I got some nice quick results. Sure, the classifier need a bit more of training with more samples, but I think this might be a good solution for my samples. I’ll post here some updates when I have more samples.

Hi @smith_robertj ,
thank you for the comment. I see your point, essentially the more I polish the smaller the differences between structures, so the more difficult to segment. So I should find a good compromise between the two.
The test you mention is not that clear to me though. I am sorry in advance but I am very new to this kind of analysis/classification. I have attached a picture of the “original” histogram (left) and one from which I subtracted a value (25, right).

Any advice on an appropriate procedure for this type of classification would be appreciated.

Many thanks,

Hello again,

Yes, the fractal nature of bio-minerals continue down to smaller and smaller scales. Remember a fractal is a self similar repeating pattern in scales. Similar, not exactly alike and therefore are difficult to deal with.

The two peaks indicated in the returned example are at the exact same place yet of different intensities, as well the entire pattern is alike, typical of bio-minerals. Also it would be helpful if you convert to 32bit. You do not need color for the information you seek.(Always keep an copy of original) The peaks indicated are where the ‘surface’ of the image separates from the ‘deeper’ pixels. If you separate all of the pixels below this peak, then apply a Gaussian filter ( use Process > Filter > Gaussian blur (set approx. 4)) to smooth the transitions and then apply the LUT of your choice, you will find it much easier, yet just as accurate to segment.


Another bit of advice, before you begin, use the ‘Magic Wand’ tool and adjust it (double click) to a setting that completely encircles the main object then use ‘Edit>Clear’ to clear the background also. That will eliminate that problem.

So try it and if you like it yet have questions, just ask again. Happy to help.