for (int y = 0; y < height; y++) {
if (shape.accept(
x,
y)) {
for (int b = 0; b < numBands; b++) {
indices.add(new SampleIndex(
x,
y,
b));
}
// this will ignore the no data values for this x,y
// which should be fine because the shape will
// always classify this x,y as "no data"
continue;
}
else if (!skipNoData) {
for (int b = 0; b < numBands; b++) {
if (allNoDataValues[b] == null) {
continue;
}
else {
final double[] samples = data.getSampleValues(
x,
y,
b);
for (int i = 0; i < allNoDataValues[b].length; i++) {
// if a single sample is not a "no data" value
// then it is valid
boolean noData = true;
for (final double sample : samples) {
if (sample != allNoDataValues[b][i]) {
noData = false;
break;
}
}
if (noData) {
indices.add(new SampleIndex(
x,
y,
b));
noDataValuesPerBand[b].add(allNoDataValues[b][i]);
}