/** * */ package cortexrules; import java.awt.geom.*; /** *

This program allows access to the different rules. * *

* @author John H. Krantz, Ph.D. * Copyright 2007 * @version 0.1 * */ public class Rules { // rules GeoOrientLineJoin rule1 = new GeoOrientLineJoin(); ConOrientLineJoin rule2 = new ConOrientLineJoin(); ContOrientSensJoin rule3 = new ContOrientSensJoin(); ContOrientSens rule4 = new ContOrientSens(); ConnectSame rule5 = new ConnectSame(); // rule constants public final static int RULE_1 = 0; public final static int RULE_2 = 1; public final static int RULE_3 = 2; public final static int RULE_4 = 3; public final static int RULE_5 = 4; private int rule = RULE_1; private int ruleLast = RULE_5; // constants for the arragment of the type // of edges in the shapes array public final static int POS = 0; public final static int NEG = 1; public Rules(){ } public final static String [] RULE_DESC = { GeoOrientLineJoin.NAME, ConOrientLineJoin.NAME, ContOrientSensJoin.NAME, ContOrientSens.NAME, ConnectSame.NAME}; // get methods /** * getAllShapes: allows all segmented shapes to be discovered * in the output of the cortex model * @param double [][][] cortex the cortex output data * @param Rectangle2D [][] rfArray the plotting array for the cortex * @return GeneralPath[][] the segmented shapes: * positive contoours in [0][], * negative contours in [1][] */ public GeneralPath [][] getAllShapes(double [][][] cortex, Rectangle2D [][] rfArray){ // objects to return GeneralPath [][] shapes = null; switch (rule){ // get shapes depending upon rule case RULE_1 : shapes = rule1.getAllShapes(cortex,rfArray); break; case RULE_2 : shapes = rule2.getAllShapes(cortex,rfArray); break; case RULE_3 : shapes = rule3.getAllShapes(cortex,rfArray); break; case RULE_4 : shapes = rule4.getAllShapes(cortex,rfArray); break; case RULE_5 : shapes = rule5.getAllShapes(cortex,rfArray); break; } return shapes; } // set methods public void setRule(int r){ rule = (r >=0 & r <= ruleLast ? r : rule); } }