|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectjaitools.media.jai.zonalstats.ZonalStats
public class ZonalStats
Holds the results of the ZonalStats operator. An instance of this class is stored as a property of the destination image.
Chaining methods are provided to select a subset of the results...
ZonalStats allStats = ...
// Get results for a given band
int bandIndex = ...
List bandResults = allStats.band(bandIndex).results();
// Get Statistic.MEAN values for the specified band and zone
List subsetResults = allStats.band(b).zone(z).statistic(Statistic.MEAN).results();
// Impress your friends with pretty printing !
Statistic[] statistics = {
Statistic.MIN,
Statistic.MAX,
Statistic.MEDIAN,
Statistic.APPROX_MEDIAN,
Statistic.SDEV
};
System.out.println(" exact approx");
System.out.println(" band zone min max median median sdev");
System.out.println("-----------------------------------------------------------");
for (int b : allStats.getImageBands()) {
for (int z : zs.getZones()) {
System.out.printf(" %4d %4d", b, z);
ZonalStats subset = zs.band(b).zone(z);
for (Statistic s : statistics) {
System.out.printf(" %8.4f", zoneSubset.statistic(s).results().get(0).getValue());
}
System.out.println();
}
}
Result,
ZonalStatsDescriptor| Method Summary | |
|---|---|
ZonalStats |
band(int b)
Get the subset of results for the given band. |
java.util.SortedSet<java.lang.Integer> |
getZones()
Get the integer IDs read from the zone image. |
java.util.List<Result> |
results()
Returns the list of Result objects. |
ZonalStats |
statistic(Statistic s)
Get the subset of results for the given Statistic. |
ZonalStats |
zone(int z)
Get the subset of results for the given zone. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Method Detail |
|---|
public java.util.SortedSet<java.lang.Integer> getZones()
Note that statistics will not necessarily have been calculated for all zones.
public ZonalStats band(int b)
b - band index
ZonalStats object containing results for the band
(data are shared with the source object rather than copied)public ZonalStats zone(int z)
z - zone ID
ZonalStats object containing results for the zone
(data are shared with the source object rather than copied)public ZonalStats statistic(Statistic s)
Statistic.
See the example of chaining this method in the class docs.
s - the statistic
ZonalStats object containing results for the statistic
(data are shared with the source object rather than copied)public java.util.List<Result> results()
Result objects.
Result
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||