Login  Register

Problem with getting stats from trainable weka segmentation plugin

Posted by Mr Patrick Fortuna on May 01, 2014; 1:10am
URL: http://imagej.273.s1.nabble.com/Problem-with-getting-stats-from-trainable-weka-segmentation-plugin-tp5007531.html

Hi everyone,


I'm hoping someone can help with my small problem. I've been using the trainable weka segmentation plugin to quantify some images, although havn't used it for a while since the latest update and the macro I've been using doesn't seem to do what I'm after anymore. I train with classifiers and then run this macro to get percentages of the selected classes in the image (text continues after code):


// id values of each class in the classified image

classLabels = newArray( 0, 64, 128, 191, 255 );



setBatchMode( true );

run("Set Measurements...", "area_fraction redirect=None decimal=3");



for( i=0; i<classLabels.length; i ++ )

{

minTh = classLabels[ i ];

maxTh = classLabels[ i ];

 if( i < classLabels.length - 1 )

 maxTh = classLabels[ i+1 ] -1;

else // last value is assumed to be 255

 {

minTh = classLabels[ i-1 ] +1;

 maxTh = classLabels[ i ];

}

 selectWindow("Classified image");

 run("Duplicate...", "title=[to-be-thresholded]");

selectWindow("to-be-thresholded");

 setThreshold( minTh, maxTh );

run("Convert to Mask");

 run("Measure");

close();

}



Although now the problem is the result comes back as 100% for class 1 and 0% for the rest of the classes.

I'm not proficient at all at scripting, so I'd really appreciate if anyone could debug my problem.

Thanks before hand.


Regards,

Patrick

--
ImageJ mailing list: http://imagej.nih.gov/ij/list.html