package ac.ooechs.oil.segmentation;

import ac.essex.ooechs.imaging.commons.segmentation.Segmenter;
import ac.essex.ooechs.imaging.commons.PixelLoader;
import ac.essex.ooechs.imaging.commons.ColourChannels;
import ac.essex.gp.multiclass.PCM;
import ac.essex.gp.multiclass.BetterDRS;

/**
 * <p/>
 * This program is free software; you can redistribute it and/or
 * modify it under the terms of the GNU General Public License
 * as published by the Free Software Foundation; either version 2
 * of the License, or (at your option) any later version,
 * provided that any use properly credits the author.
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
 * GNU General Public License for more details at http://www.gnu.org
 * </p>
 *
 * @author Olly Oechsle, University of Essex, Date: 07-Mar-2008
 * @version 1.0
 */
public class TestSegmenter extends Segmenter {

   
PCM pcm = new BetterDRS(-660.1791819844442,254.22222900390625,new int[]{3,3,3,3,3,3,3,3,3,3,3,3,3,3,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,2,2,2,2,2,2,-1,5,5,1,5,1,5,5,5,-1,-1,-1,-1,3,3});
public int segment(PixelLoader image, int x, int y) {
    boolean node1 = 2.1596017366926343 < image.getVLine2().getEdgeCount(image, x, y);
    boolean node6 = image.get3x3Mean(x, y) > 0;
    double node5 = node6? 0.8960221718150903 : image.getVLine2().getEdgeCount(image, x, y);
    double node4 = node5 - 0.5502315674541226;
    boolean node13 = image.getPerimeter2().getStatistics(image, x, y).getStandardDeviation() < 1.649404886039592;
    boolean node23 = image.getPerimeter1().getStatistics(image, x, y).getStandardDeviation() > 2.592097132883169;
    double node26 = 2.8608903121304;
    double node22 = node23? node26 : image.get3x3Stats(x, y, ColourChannels.RED).getStandardDeviation();
    double node20 = image.getPerimeter2().getStatistics(image, x, y).getStandardDeviation() + node22;
    double node19 = node20 - image.getPerimeter2().getMean(image, x, y);
    double node17 = 2.6269359040962574 * node19;
    double node12 = node13? image.get3x3Stats(x, y, ColourChannels.BLUE).getMean() : node17;
    return pcm.getClassFromOutput(node1? node4 : node12);
}

}
