@Test public void testNaturalBreaksHistogram() throws Exception { RenderedImage image = createImage(); ParameterBlockJAI pb = new ParameterBlockJAI(new ClassBreaksDescriptor()); pb.addSource(image); pb.setParameter("method", ClassificationMethod.NATURAL_BREAKS); pb.setParameter("numClasses", 4); pb.setParameter("extrema", getExtrema(image)); pb.setParameter("histogram", true); pb.setParameter("histogramBins", 100); RenderedImage op = JAI.create("ClassBreaks", pb, null); Classification classification = (Classification) op.getProperty(ClassBreaksDescriptor.CLASSIFICATION_PROPERTY); assertNotNull(classification); Number[] breaks = classification.getBreaks()[0]; assertEquals(5, breaks.length); assertEquals(1, breaks[0].doubleValue(), EPS); assertEquals(3, breaks[1].doubleValue(), EPS); assertEquals(16, breaks[2].doubleValue(), EPS); assertEquals(26, breaks[3].doubleValue(), EPS); assertEquals(53, breaks[4].doubleValue(), EPS); }
@Override public Object getProperty(String name) { Object obj = properties.getProperty(ClassBreaksDescriptor.CLASSIFICATION_PROPERTY); if (obj == Image.UndefinedProperty) { Classification c = preCalculate(); if (c != null) { properties.setProperty(ClassBreaksDescriptor.CLASSIFICATION_PROPERTY, c); } } return super.getProperty(name); }
ClassBreaksOpImage extends StatisticsOpImage { @Override public Object getProperty(String name) { Object obj = properties.getProperty(ClassBreaksDescriptor.CLASSIFICATION_PROPERTY); if (obj == Image.UndefinedProperty) { Classification c = preCalculate(); if (c != null) { properties.setProperty(ClassBreaksDescriptor.CLASSIFICATION_PROPERTY, c); } } return super.getProperty(name); } }
ClassBreaksOpImage extends StatisticsOpImage { @Override public Object getProperty(String name) { Object obj = properties.getProperty(ClassBreaksDescriptor.CLASSIFICATION_PROPERTY); if (obj == Image.UndefinedProperty) { Classification c = preCalculate(); if (c != null) { properties.setProperty(ClassBreaksDescriptor.CLASSIFICATION_PROPERTY, c); } } return super.getProperty(name); } ClassBreaksOpImage(
            RenderedImage image,
            Integer numClasses,
            Double[][] extrema,
            ROI roi,
            Integer[] bands,
            Integer xStart,
            Integer yStart,
            Integer xPeriod,
            Integer yPeriod,
            Double noData,
            Boolean percentages); }
ClassBreaksOpImage extends StatisticsOpImage { @Override public Object getProperty(String name) { Object obj = properties.getProperty(ClassBreaksDescriptor.CLASSIFICATION_PROPERTY); if (obj == Image.UndefinedProperty) { Classification c = preCalculate(); if (c != null) { properties.setProperty(ClassBreaksDescriptor.CLASSIFICATION_PROPERTY, c); } } return super.getProperty(name); } ClassBreaksOpImage(
            RenderedImage image,
            Integer numClasses,
            Double[][] extrema,
            ROI roi,
            Integer[] bands,
            Integer xStart,
            Integer yStart,
            Integer xPeriod,
            Integer yPeriod,
            Double noData,
            Boolean percentages); @Override Object getProperty(String name); @Override void setProperty(String name, Object value); }
ClassBreaksOpImage extends StatisticsOpImage { @Override public Object getProperty(String name) { Object obj = properties.getProperty(ClassBreaksDescriptor.CLASSIFICATION_PROPERTY); if (obj == Image.UndefinedProperty) { Classification c = preCalculate(); if (c != null) { properties.setProperty(ClassBreaksDescriptor.CLASSIFICATION_PROPERTY, c); } } return super.getProperty(name); } ClassBreaksOpImage(
            RenderedImage image,
            Integer numClasses,
            Double[][] extrema,
            ROI roi,
            Integer[] bands,
            Integer xStart,
            Integer yStart,
            Integer xPeriod,
            Integer yPeriod,
            Double noData,
            Boolean percentages); @Override Object getProperty(String name); @Override void setProperty(String name, Object value);  }