Revision 1708 org.gvsig.raster/tags/2.0.0/org.gvsig.raster.lib/org.gvsig.raster.lib.impl/src/main/java/org/gvsig/raster/impl/datastruct/BufferHistogramImpl.java

View differences:

BufferHistogramImpl.java
425 425

  
426 426
		double[][] res = new double[5][];
427 427

  
428
		double[] min = new double[bandCount];// M?nimo
429
		double[] max = new double[bandCount];// M?ximo
430
		for (int iBand = 0; iBand < bandCount; iBand++) {
431
			max[iBand] = Double.NEGATIVE_INFINITY;
432
			min[iBand] = Double.POSITIVE_INFINITY;
433
		}
434 428
		double[] average = new double[bandCount]; // Valor de pixel medio (Media)
435 429
		double[] middle = new double[bandCount]; // Mediana
436 430
		double[] nPixelsBand = new double[bandCount];// N?mero de pixels por banda
......
440 434
		for (int iBand = 0; iBand < histogram.length; iBand++) {
441 435
			if (bands[iBand]) {
442 436
				for (int i = beginPos; i <= endPos; i++) {
443
					// Calculo del m?nimo
444
					if (histogram[iBand][i].getValue() != 0 && histogram[iBand][i].getMin() < min[showBandCounter])
445
						min[showBandCounter] = histogram[iBand][i].getMin();
446

  
447
					// Calculo del m?ximo
448
					if (histogram[iBand][i].getValue() != 0 && histogram[iBand][i].getMax() > max[showBandCounter])
449
						max[showBandCounter] = histogram[iBand][i].getMin();
450

  
451 437
					// Calculo del n?mero de pixeles
452 438
					nPixelsBand[showBandCounter] += histogram[iBand][i].getValue();
453

  
454 439
					average[showBandCounter] += histogram[iBand][i].getValue() * ((histogram[iBand][i].getMax() + histogram[iBand][i].getMin())/2);
455 440
				}
456 441
				// Calculo de la media
......
462 447

  
463 448
				// Calculo de mediana
464 449
				double stopPos = nPixelsBand[showBandCounter] / 2;
465
				int aux = 0;
450
				double aux = 0;
466 451
				int i = beginPos;
467 452
				for (i = beginPos; aux <= stopPos; i++) {
468 453
					if (i >= histogram[iBand].length)
......
474 459
					}
475 460
				}
476 461
				middle[showBandCounter] = (histogram[iBand][i - 1].getMax() + histogram[iBand][i - 1].getMin()) / 2;
477

  
478 462
				showBandCounter++;
479 463
			}
480 464
		}

Also available in: Unified diff