wekaimagejfiji

Export Weka Fiji plugin segmentation as ROI


I am using Imagej/Fiji Weka plugin for classifying different regions of the image and I would like to obtain those regions for further processing… (as Rois? a table with the classes?)

So in the end I want to get the area for each of the segmented classes.. I need to script this task as it is part of a pipeline… But not sure how to do extract the results from Weka Imagej Plugin…

Actually this code example is just to illustrate the idea.. Anyone has a basic example on applying a classifier and exporting results? Thank you in advance

import trainableSegmentation.*;
import ij.IJ;
import ij.ImagePlus;

// input train image
input  = IJ.openImage( someImage.jpg" );

// create Weka Segmentation object
segmentator = new WekaSegmentation( input );

// load classifier from file
segmentator.loadClassifier( "classifier.model" );

result = segmentator.applyClassifier( input );
...

Solution

  • You have a couple of answers about that in the image.sc forum: https://forum.image.sc/t/measuring-area-fraction-in-a-weka-classifed-image/7979 https://forum.image.sc/t/quantifing-weka-output/4660/6

    That being said, you can also directly use the resulting label image for measurement within other plugins, such as the ones from MorphoLibJ (after installation, under Plugins > MorphoLibJ > Analyze).