Revision 11182 trunk/libraries/libRaster/src/org/gvsig/raster/dataset/properties/DatasetListHistogram.java

View differences:

DatasetListHistogram.java
54 54
	 * @return histograma 
55 55
	 */
56 56
	public Histogram getHistogram()throws FileNotOpenException, RasterDriverException{
57
		if(multiDataset != null) {
57
		if (multiDataset != null) {
58 58
			//Obtenemos los histogramas de cada dataset
59 59
			Histogram[] hList = new Histogram[multiDataset.getDatasetCount()];
60
			double max = Double.MIN_VALUE;
61
			double min = Double.MAX_VALUE;
60 62
			for (int i = 0; i < hList.length; i++) {
61 63
				hList[i] = multiDataset.getDataset(i).getHistogram().getHistogram();
64
				if (max < multiDataset.getDataset(i).getHistogram().getMaximum())
65
					max = multiDataset.getDataset(i).getHistogram().getMaximum();
66
				if (min > multiDataset.getDataset(i).getHistogram().getMinimum())
67
					min = multiDataset.getDataset(i).getHistogram().getMinimum();
62 68
				if (isCanceled() || (hList[i] == null)) 
63 69
					return null;
64 70
			}
65
			
66
			if(hList[0].getNumBands() == 0)
71

  
72
			if (hList[0].getNumBands() == 0)
67 73
				return null;
68 74
			
75
			histogram = new Histogram(multiDataset.getBandCount(), hList[0].getNumValues(), min, max);
69 76
			
70
			histogram = new Histogram(multiDataset.getBandCount(), hList[0].getNumValues());
71
			
72 77
			int band = 0;
73 78
			for (int iDataset = 0; iDataset < hList.length; iDataset++) {
74 79
				for (int iBand = 0; iBand < hList[iDataset].getNumBands(); iBand++) {
75 80
					for (int iPxValue = 0; iPxValue < hList[iDataset].getBandLenght(iBand); iPxValue ++) {
76 81
						if (isCanceled()) 
77 82
							return null;
78
						histogram.setHistogramValue(band, iPxValue, hList[iDataset].getHistogramValue(iBand, iPxValue));
83
						histogram.setHistogramValueByPos(band, iPxValue, (long) hList[iDataset].getHistogramValueByPos(iBand, iPxValue));
79 84
					}
80 85
					band ++;
81 86
				}	

Also available in: Unified diff