Image Segmentation of ... Roots

weka
javascript
imagej
segmentation

#1

Hi guys, I’m trying to analyze a plug of roots and soil. I’d like to measure root development or root coverage on the plug.

The problem is that my plug have shiny dirt that can easily be taken for root.

Steps of what I tried :

  • 8 bits
  • Median filter (2.0)
  • Subtract background
    (-Crop)
  • Otsu automatic thresholding
  • Watershed (because analyze particles was not fully working without oddly)
  • Analyze Particles (Without the small particles)

Result :


I think I have some “not so bad” results for the amount of tinkering I did but is there a more elegant manner to do it ? Any idea of what I should do for some more “professional” results ?

How would you get the perimeter of the plug ?

Thank you in advance,

J. Ben


#2

It’s me again, I went with another approach reading the forum : Weka.

It worked quite well and I was able to get an idea of the roots coverage.

Montage3

However, as I’m trying to write a script.js I can’t use Weka :frowning:
I used what I found here :

importClass(Packages.ij.IJ);
importClass(Packages.trainableSegmentation.WekaSegmentation);

var imp = IJ.openImage("/home/jbenetti/Documents/Fiji.app/test/1.png");
var weka = WekaSegmentation(imp);
var classifierFile = "/home/jbenetti/Documents/Fiji.app/test/classifier.model";
weka.loadClassifier(classifierFile);
weka.applyClassifier(True);
var result = weka.getClassifiedImage();
result.show();

I have this issue :

Scripts/Script_.js:19 TypeError: [JavaClass trainableSegmentation.WekaSegmentation] is not a function

What do I do wrong ?

Thank you in advance,

J. Ben


#3

In Javascript, you need the new keyword to initialize an object:

var weka = new WekaSegmentation(imp);

I realize that this was missing in my post in the topic you linked (possibly due to copy-pasting from python). But if you read that topic to the end, @iarganda actually replied with a working version of the code:

Hope that helps.


#4

Hi thanks for the answer.

I tried both of them (with and without new) and I had another error so I thought I was wrong.

I switched to Python in the meantime and it is correctly working.

Thanks,

J. Ben