Revision 11196 trunk/libraries/libRaster/src/org/gvsig/raster/dataset/properties/DatasetStatistics.java
DatasetStatistics.java | ||
---|---|---|
53 | 53 |
protected RasterDataset grf = null; |
54 | 54 |
protected boolean calculated = false; |
55 | 55 |
protected Hashtable tailTrim = new Hashtable(); |
56 |
private boolean canceled = false; |
|
56 | 57 |
|
57 | 58 |
/** |
58 | 59 |
* Constructor. Asigna el fichero asociado. |
... | ... | |
205 | 206 |
|
206 | 207 |
byte[] b = null;short[] s = null;int[] i = null;float[] f = null;double[] d = null; |
207 | 208 |
|
208 |
for(int iBand = 0; iBand < grf.getBandCount(); iBand ++){ |
|
209 |
for (int iBand = 0; iBand < grf.getBandCount(); iBand ++){
|
|
209 | 210 |
iValues = 0; |
210 | 211 |
max[iBand] = Double.MIN_VALUE; |
211 | 212 |
min[iBand] = Double.MAX_VALUE; |
212 | 213 |
secondMax[iBand] = Double.MIN_VALUE; |
213 | 214 |
secondMin[iBand] = Double.MAX_VALUE; |
214 | 215 |
mean[iBand] = variance[iBand] = 0; |
215 |
for(int line = 0; line < grf.getHeight(); line ++){
|
|
216 |
for (int line = 0; line < grf.getHeight(); line ++) {
|
|
216 | 217 |
Object buf = null; |
217 | 218 |
try { |
218 | 219 |
buf = grf.readCompleteLine(line, iBand); |
... | ... | |
255 | 256 |
mean[iBand] += z; |
256 | 257 |
variance[iBand] += z * z; |
257 | 258 |
iValues++; |
258 |
} |
|
259 |
} |
|
260 |
|
|
261 |
if (isCanceled()) |
|
262 |
return; |
|
259 | 263 |
} |
260 | 264 |
if( iValues > 0 ){ |
261 | 265 |
mean[iBand] /= (double) iValues; |
... | ... | |
316 | 320 |
String s = new Double(percent).toString(); |
317 | 321 |
return tailTrim.get(s); |
318 | 322 |
} |
319 |
|
|
320 |
} |
|
323 |
|
|
324 |
/* |
|
325 |
* (non-Javadoc) |
|
326 |
* @see org.gvsig.raster.util.ICancellable#isCanceled() |
|
327 |
*/ |
|
328 |
public boolean isCanceled() { |
|
329 |
return canceled; |
|
330 |
} |
|
331 |
|
|
332 |
/* |
|
333 |
* (non-Javadoc) |
|
334 |
* @see org.gvsig.raster.util.ICancellable#setCanceled(boolean) |
|
335 |
*/ |
|
336 |
public void setCanceled(boolean value) { |
|
337 |
canceled = value; |
|
338 |
} |
|
339 |
} |
Also available in: Unified diff