Segmentation in OCT imaging


Dear all!
I was wondering if any of you knows the correct analysis for the following problem. The figure below shows a representation of the human skin with corresponding names.
Plaatje forum
It is possible to use ImageJ to automatically select the 3 different layers based on the right threshold and segmentation, but I can’t figure it out. I want to analyse these pictures (as shown below) as objectively and quantitatively as possible without having to draw the lines myself (subjective). The problem is that the intensity differences are really small and I hope that someone has experienced this problem before or has the knowledge to help me out

The first layer is more hyporeflective compared to the layer below it and the second layer is hypereflective compared to the third layer below that.
Thanks in advance!


Good day,

OCT images appear not being well-suited for automatic image analyses …

In your sample image, would it be sufficient to analyse the layers between two of the darker vertical streaks? But even then the lower bound of the reticular dermis appears impossible to reliably detect.

In any case you need some kind of lowpass filtering to reduce the noise before the analysis.

I see a chance for thickness estimations of the first and second layer.




Hey @Wouter

Check out the Trainable Weka Segmentation (TWS) plugin. I can be trained and then the classifier applied to multiple images - as long as everyone was acquired using the same parameters. Too - it is scriptable via macro code. In general - this is a great tool for segmentation that comes directly with Fiji. NOTE: Fiji is Just ImageJ - it is simply a distribution of ImageJ that comes with a bunch of plugins bundled - ready for you to use out-of-the-box. If you are just getting started, we recommend downloading/using Fiji.

Here is the quick-and-dirty segmentation I got just playing around quickly:


  1. I only used a crop of your image.
  2. there are obvious issues at the boundaries between regions… but perhaps can be addressed with some pre-processing/filtering steps - as @Herbie suggested above too
  3. you can adjust the settings as you see fit… I was just playing a bit (see what I used below) - so these too could be adjusted/optimized.

You can obviously look at other Segmentation tools - but at least this is a decent start.

If you have more questions - feel free to post again!

eta :slight_smile:


Hi Herbie,

First of all Thank you very much for replying to my post:) I don’t think I completely understand what you mean with the analysis of the vertical streaks. What you said about filtering is right and I am primarily focusing on that now, but since the intensities differences are so small, not one filter is sufficient enough to process the entire image and combination of filters results in losing details. But I won’t give up, thanks for the help!

Kind regards,


Hi @etarena

This technique is amazing and works perfectly (mixed with some preprocessing). However, I do have an additional question, when I have successfully created the separated the classes how do I get the thickness measurements out of the segmentation. The scale can be set with the scale bar but I don’t know how to get the (average) thickness out of the classes (calculated and not with subjective draw tools).
I hope you can help with the as well:)
Kind Regards,




Great news !!! So… to get the thickness… check out this other forum post:

All the links and answers you need should be in there to get you well on your way… any more questions after that - just post again!

eta :slight_smile:


Hi @etarena,

Thanks I’ll have a look into that:)
The picture I posted was a .png file but the original images are 120 frames in a .tif file. I want to be able to run all the pictures with the plugin to get the average thickness over all 120 frames, but when I tried that I got this error

Ever experienced this and how to fix it?

Thanks in advance!

Kind regards,



So this is when you are applying your trained classifier to other images? Sorry… this wasn’t so clear to me what step this error occurred - please clarify.

In any case - I will ping @iarganda - he will better help you in regards to these errors…



This happens when I want to train my classifier over a Tif file. So when I create a new classifier and not load an existing one.

Kind regards,



Try using just a cropped section of your image for training the classifier… For this - use a cropped image and then open another, apply, and train and so on. Once you are happy with the segmentation - you can use this ‘master’ classifier to apply to the full images.

It’s true that working with large images - and so many of them - might be a bit burdensome for TWS. But again - @iarganda can better assist …



Good day Wouter,

I wrote:

[…] would it be sufficient to analyse the layers between two of the darker vertical streaks?

For example as indicated here:

Concerning classification, as proposed by Ellen, I doubt that the lower bound of the third layer can reliably be detected. A statistical analysis seems appropriate!

Classifiers appear to do magical processing, but their basis is pure maths, i.e. statistics. The results must be interpreted correspondingly, i.e. statistically. Furthermore, and this appears to be not commonly known, the learning sample must be related to the number of parameters that are to be adjusted. The minimum size is about 3 linear independent and class-characteristic sample signals/images per parameter.
(This is the reason why layered artificial neural network classifiers with up to many millions of adjustable synaptic weights need incredibly large numbers of samples …)

Good luck



This error involves you run out of RAM memory to apply the classifier at the same time to all images. One option would be to train on a smaller set of images (or a cropped version of the image) or use less features in the Settings dialog.