Revision 30754 branches/v2_0_0_prep/libraries/libRaster/src-test/org/gvsig/raster/dataset/TestStatisticMultiFile.java

View differences:

TestStatisticMultiFile.java
30 30
/**
31 31
 * Prueba el calculo de estadisticas para un dataset con multiples ficheros.
32 32
 * Comprueba que los valores obtenidos en las estadisticas son correctos.
33
 * 
33
 *
34 34
 * @author Nacho Brodin (nachobrodin@gmail.com)
35 35
 */
36 36
public class TestStatisticMultiFile extends BaseTestCase {
......
39 39
	private String path1 = baseDir + "band1-30x28byte.tif";
40 40
	private String path2 = baseDir + "band2-30x28byte.tif";
41 41
	private String path3 = baseDir + "band3-30x28byte.tif";
42
	
42

  
43 43
	private RasterDataset f1 = null;
44 44
	private RasterDataset f2 = null;
45 45
	private RasterDataset f3 = null;
46
	
46

  
47 47
	static {
48 48
		RasterLibrary.wakeUp();
49 49
	}
50
	
51
	public void start() {
50

  
51
	public void start() throws Exception {
52 52
		this.setUp();
53 53
		this.testStack();
54 54
	}
55
	
56
	public void setUp() {
55

  
56
	protected void doSetUp() throws Exception {
57
		super.doSetUp();
57 58
		System.err.println("TestStatisticMultiFile running...");
58 59
		try {
59 60
			deleteRMF(path1);
......
68 69
			e.printStackTrace();
69 70
		}
70 71
	}
71
	
72

  
72 73
	public void testStack() {
73 74
		MultiRasterDataset grmf = new MultiRasterDataset();
74 75
		try {
......
101 102
		assertEquals((int)stats.getMean()[0], 19);
102 103
		assertEquals((int)stats.getVariance()[0], 11599);
103 104
	}
104
	
105

  
105 106
	private void dataTestB2(DatasetStatistics stats){
106 107
		assertEquals(new Double(stats.getMaxRGB()[1]), new Double(234.0));
107 108
		assertEquals(new Double(stats.getMinRGB()[1]), new Double(49.0));
......
110 111
		assertEquals((int)stats.getMean()[1], 51);
111 112
		assertEquals((int)stats.getVariance()[1], 7109);
112 113
	}
113
	
114

  
114 115
	private void dataTestB3(DatasetStatistics stats){
115 116
		assertEquals(new Double(stats.getMaxRGB()[2]), new Double(255.0));
116 117
		assertEquals(new Double(stats.getMinRGB()[2]), new Double(28.0));
......
119 120
		assertEquals((int)stats.getMean()[2], -12);
120 121
		assertEquals((int)stats.getVariance()[2], 7991);
121 122
	}
122
	
123

  
123 124
	public void print(MultiRasterDataset grmf) {
124 125
		for (int iBand = 0; iBand < grmf.getStatistics().getBandCount(); iBand++) {
125 126
			System.out.println("Band " + iBand);

Also available in: Unified diff