@Test public void testMultiband() { ParameterBlockJAI pb = new ParameterBlockJAI("ZonalStats"); pb.setSource("dataImage", multibandImage); pb.setParameter("stats", new Statistic[]{Statistic.MIN, Statistic.MAX, Statistic.RANGE}); pb.setParameter("bands", new Integer[]{0, 2}); RenderedOp op = JAI.create("ZonalStats", pb); ZonalStats stats = (ZonalStats) op.getProperty(ZonalStatsDescriptor.ZONAL_STATS_PROPERTY); final int MIN = 0, MAX = 1, RANGE = 2; final int[] flag = new int[3]; for (Result r : stats.results()) { switch (r.getStatistic()) { case MIN: assertEquals(-9999.0, r.getValue(), EPS); flag[MIN]++ ; break; case MAX: assertEquals(r.getImageBand() + 1, r.getValue(), EPS); flag[MAX]++; break; case RANGE: assertEquals(r.getImageBand() + 10000.0, r.getValue(), EPS); flag[RANGE]++; break; default: fail("unexpected statistic: " + r.getStatistic()); } } for (int i = 0; i < flag.length; i++) { assertEquals(2, flag[i]); } }
public List<Result> results() { return Collections.unmodifiableList(results); }
ZonalStats { public List<Result> results() { return Collections.unmodifiableList(results); } }
ZonalStats { public List<Result> results() { return Collections.unmodifiableList(results); } ZonalStats(); private  ZonalStats(ZonalStats src, Integer band, Integer zone, Statistic stat, List<Range> ranges); }
ZonalStats { public List<Result> results() { return Collections.unmodifiableList(results); } ZonalStats(); private  ZonalStats(ZonalStats src, Integer band, Integer zone, Statistic stat, List<Range> ranges); SortedSet<Integer> getZones(); ZonalStats band(int b); ZonalStats zone(int z); ZonalStats statistic(Statistic s); ZonalStats ranges(List<Range> ranges); List<Result> results(); }
ZonalStats { public List<Result> results() { return Collections.unmodifiableList(results); } ZonalStats(); private  ZonalStats(ZonalStats src, Integer band, Integer zone, Statistic stat, List<Range> ranges); SortedSet<Integer> getZones(); ZonalStats band(int b); ZonalStats zone(int z); ZonalStats statistic(Statistic s); ZonalStats ranges(List<Range> ranges); List<Result> results();  }