http://imagej.273.s1.nabble.com/Problem-with-getting-stats-from-trainable-weka-segmentation-plugin-tp5007531p5007557.html
set to more meaningful values: 0, 1, 2... So your macro should work if you
Let me know if you have more problems.
> 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>
Ignacio Arganda-Carreras, Ph.D.
43 Vassar St.