Revision 26348

View differences:

branches/v2_0_0_prep/extensions/extRemoteSensing/distribution/distribution.xml
1
<assembly>
2
	<id>distribution</id>
3
	<formats>
4
		<format>dir</format>
5
	</formats>
6
	<fileSets>
7
	<!-- Extructure for the extension -->
8
		<fileSet>
9
			<directory>config</directory>
10
			<outputDirectory>${extension-distribution}</outputDirectory>
11
		</fileSet>
12
		<fileSet>
13
			<directory>data</directory>
14
			<outputDirectory>${extension-distribution}/data</outputDirectory>
15
		</fileSet>
16
		<fileSet>
17
			<directory>images</directory>
18
			<outputDirectory>/${extension-distribution}/images</outputDirectory>
19
		</fileSet>
20
	</fileSets>
21
	<files>
22
		<file>
23
			<source>build.number</source>
24
			<outputDirectory>${extension-distribution}
25
			</outputDirectory>
26
		</file>
27
	</files>
28
	
29
	<dependencySets>
30
		<dependencySet>
31
			<outputDirectory>${extension-distribution}/${library-dir}</outputDirectory>
32
			<includes>
33
				<include>org.gvsig:extRemoteSensing</include>
34
			</includes>
35
		</dependencySet>
36
		<dependencySet>
37
			<outputDirectory>${extension-distribution}/${library-dir}</outputDirectory>
38
			<includes>
39
				<include>org.gvsig.legacy:castor</include>
40
				<include>org.gvsig.legacy:jcommon</include>
41
				<include>org.gvsig.legacy:jfreechart</include>
42
				<include>org.gvsig.legacy:jama</include>
43
				<include>org.gvsig.legacy:jep</include>
44
				<include>org.gvsig.legacy:TableLayout</include>
45
				<include>org.gvsig.legacy:jgraph</include>
46
				<include>org.gvsig:gdbms-0.8-SNAPSHOT</include>
47
			</includes>
48
		</dependencySet>
49
	</dependencySets>
50
</assembly>
branches/v2_0_0_prep/extensions/extRemoteSensing/test-images/pc_CreateImageTest.rmf
1
<?xml version="1.0" encoding="ISO-8859-15"?>
2
<RasterMetaFile>
3
<FLyrGeoRaster>
4
	<Projection>EPSG:23030</Projection>
5
	<Extent>
6
			<X>71.041</X>
7
			<Y>731.983</Y>
8
			<RotationX>0.0</RotationX>
9
			<RotationY>0.0</RotationY>
10
			<PixelSizeX>1.0032500000000013</PixelSizeX>
11
			<PixelSizeY>-0.9879999999999995</PixelSizeY>
12
			<Width>4.013000000000005</Width>
13
			<Height>3.951999999999998</Height>
14
	</Extent>
15
	<Dimension>
16
			<ImagePxWidth>4.0</ImagePxWidth>
17
			<ImagePxHeight>4.0</ImagePxHeight>
18
	</Dimension>
19
</FLyrGeoRaster>
20
<ColorInterpretation>
21
	<BandCount>3</BandCount>
22
	<Band>Red</Band>
23
	<Band>Green</Band>
24
	<Band>Blue</Band>
25
</ColorInterpretation>
26
<Statistics>
27
	<BandCount>3</BandCount>
28
	<Band>
29
		<Max>461.0</Max>
30
		<Min>320.0</Min>
31
		<SecondMax>459.0</SecondMax>
32
		<SecondMin>352.0</SecondMin>
33
		<MaxRGB>0.0</MaxRGB>
34
		<MinRGB>0.0</MinRGB>
35
		<SecondMaxRGB>0.0</SecondMaxRGB>
36
		<SecondMinRGB>255.0</SecondMinRGB>
37
		<Mean>395.875</Mean>
38
		<Variance>1624.109375</Variance>
39
	</Band>
40
	<Band>
41
		<Max>1191.0</Max>
42
		<Min>817.0</Min>
43
		<SecondMax>1190.0</SecondMax>
44
		<SecondMin>818.0</SecondMin>
45
		<MaxRGB>0.0</MaxRGB>
46
		<MinRGB>0.0</MinRGB>
47
		<SecondMaxRGB>0.0</SecondMaxRGB>
48
		<SecondMinRGB>255.0</SecondMinRGB>
49
		<Mean>1016.0</Mean>
50
		<Variance>10723.125</Variance>
51
	</Band>
52
	<Band>
53
		<Max>1986.0</Max>
54
		<Min>1706.0</Min>
55
		<SecondMax>1985.0</SecondMax>
56
		<SecondMin>1708.0</SecondMin>
57
		<MaxRGB>0.0</MaxRGB>
58
		<MinRGB>0.0</MinRGB>
59
		<SecondMaxRGB>0.0</SecondMaxRGB>
60
		<SecondMinRGB>255.0</SecondMinRGB>
61
		<Mean>1828.6875</Mean>
62
		<Variance>8545.46484375</Variance>
63
	</Band>
64
</Statistics>
65
</RasterMetaFile>
branches/v2_0_0_prep/extensions/extRemoteSensing/test-images/mosaic_test1.rmf
1
<?xml version="1.0" encoding="ISO-8859-15"?>
2
<RasterMetaFile>
3
<FLyrGeoRaster>
4
	<Projection></Projection>
5
	<Extent>
6
			<X>581515.26</X>
7
			<Y>4308729.43</Y>
8
			<RotationX>0.0</RotationX>
9
			<RotationY>0.0</RotationY>
10
			<PixelSizeX>25.4737731201183</PixelSizeX>
11
			<PixelSizeY>-25.546318726074208</PixelSizeY>
12
			<Width>1324.6362022461835</Width>
13
			<Height>1149.584342673421</Height>
14
	</Extent>
15
	<Dimension>
16
			<ImagePxWidth>52.0</ImagePxWidth>
17
			<ImagePxHeight>45.0</ImagePxHeight>
18
	</Dimension>
19
</FLyrGeoRaster>
20
<ColorInterpretation>
21
	<BandCount>3</BandCount>
22
	<Band>Red</Band>
23
	<Band>Green</Band>
24
	<Band>Blue</Band>
25
</ColorInterpretation>
26
<Statistics>
27
	<BandCount>3</BandCount>
28
	<Band>
29
		<Max>118.0</Max>
30
		<Min>-128.0</Min>
31
		<SecondMax>108.0</SecondMax>
32
		<SecondMin>-119.0</SecondMin>
33
		<MaxRGB>255.0</MaxRGB>
34
		<MinRGB>69.0</MinRGB>
35
		<SecondMaxRGB>245.0</SecondMaxRGB>
36
		<SecondMinRGB>78.0</SecondMinRGB>
37
		<Mean>-14.109401709401709</Mean>
38
		<Variance>5567.109398787347</Variance>
39
	</Band>
40
	<Band>
41
		<Max>120.0</Max>
42
		<Min>-128.0</Min>
43
		<SecondMax>-1.0</SecondMax>
44
		<SecondMin>-121.0</SecondMin>
45
		<MaxRGB>255.0</MaxRGB>
46
		<MinRGB>120.0</MinRGB>
47
		<SecondMaxRGB>248.0</SecondMaxRGB>
48
		<SecondMinRGB>128.0</SecondMinRGB>
49
		<Mean>-52.032051282051285</Mean>
50
		<Variance>696.0472633136092</Variance>
51
	</Band>
52
	<Band>
53
		<Max>121.0</Max>
54
		<Min>-128.0</Min>
55
		<SecondMax>115.0</SecondMax>
56
		<SecondMin>-122.0</SecondMin>
57
		<MaxRGB>255.0</MaxRGB>
58
		<MinRGB>85.0</MinRGB>
59
		<SecondMaxRGB>249.0</SecondMaxRGB>
60
		<SecondMinRGB>97.0</SecondMinRGB>
61
		<Mean>-47.97478632478632</Mean>
62
		<Variance>2238.3570565782748</Variance>
63
	</Band>
64
</Statistics>
65
<Histogram>
66
	<BandCount>3</BandCount>
67
	<DataType>0</DataType>
68
	<Band>
69
		<Min>-128.0</Min>
70
		<Max>127.0</Max>
71
		<Values>69 0 0 0 0 0 0 0 0 50 0 0 0 0 0 0 0 0 0 34 0 0 0 0 0 0 0 0 0 100 0 0 0 0 0 0 0 0 0 85 0 0 0 0 0 0 0 0 0 160 0 0 0 0 0 0 0 0 120 0 0 0 0 0 0 0 0 0 199 0 0 0 0 0 0 0 0 0 174 0 0 0 0 0 0 0 0 0 217 0 0 0 0 0 0 0 0 0 131 0 0 0 0 0 0 0 0 100 0 0 0 0 0 0 0 0 0 91 0 0 0 0 0 0 0 0 0 227 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 2 0 0 0 0 0 0 0 0 0 68 0 0 0 0 0 0 0 0 0 189 0 0 0 0 0 0 0 0 0 229 0 0 0 0 0 0 0 0 0 94 0 0 0 0 0 0 0 0 0</Values>
72
	</Band>
73
	<Band>
74
		<Min>-128.0</Min>
75
		<Max>127.0</Max>
76
		<Values>28 0 0 0 0 0 0 13 0 0 0 0 0 0 24 0 0 0 0 0 0 34 0 0 0 0 0 0 57 0 0 0 0 0 0 111 0 0 0 0 0 0 75 0 0 0 0 0 0 75 0 0 0 0 0 0 125 0 0 0 0 0 0 112 0 0 0 0 0 0 247 0 0 0 0 0 0 274 0 0 0 0 0 0 0 415 0 0 0 0 0 0 300 0 0 0 0 0 0 151 0 0 0 0 0 0 133 0 0 0 0 0 0 74 0 0 0 0 0 0 48 0 0 0 0 0 0 42 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 2 0 0 0 0 0 0 0</Values>
77
	</Band>
78
	<Band>
79
		<Min>-128.0</Min>
80
		<Max>127.0</Max>
81
		<Values>13 0 0 0 0 0 13 0 0 0 0 0 56 0 0 0 0 0 122 0 0 0 0 0 214 0 0 0 0 0 145 0 0 0 0 0 70 0 0 0 0 0 36 0 0 0 0 0 30 0 0 0 0 0 60 0 0 0 0 0 78 0 0 0 0 0 104 0 0 0 0 0 73 0 0 0 0 0 109 0 0 0 0 0 0 125 0 0 0 0 0 182 0 0 0 0 0 141 0 0 0 0 0 109 0 0 0 0 0 83 0 0 0 0 0 93 0 0 0 0 0 74 0 0 0 0 0 341 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 3 0 0 0 0 0 5 0 0 0 0 0 9 0 0 0 0 0 26 0 0 0 0 0 25 0 0 0 0 0 0</Values>
82
	</Band>
83
</Histogram>
84
</RasterMetaFile>
branches/v2_0_0_prep/extensions/extRemoteSensing/test-images/mosaic_test2.rmf
1
<?xml version="1.0" encoding="ISO-8859-15"?>
2
<RasterMetaFile>
3
<FLyrGeoRaster>
4
	<Projection></Projection>
5
	<Extent>
6
			<X>582264.31</X>
7
			<Y>4309377.86</Y>
8
			<RotationX>0.0</RotationX>
9
			<RotationY>0.0</RotationY>
10
			<PixelSizeX>25.527363981606904</PixelSizeX>
11
			<PixelSizeY>-25.557201082544076</PixelSizeY>
12
			<Width>1199.786107135471</Width>
13
			<Height>1124.516847631894</Height>
14
	</Extent>
15
	<Dimension>
16
			<ImagePxWidth>47.0</ImagePxWidth>
17
			<ImagePxHeight>44.0</ImagePxHeight>
18
	</Dimension>
19
</FLyrGeoRaster>
20
<ColorInterpretation>
21
	<BandCount>3</BandCount>
22
	<Band>Red</Band>
23
	<Band>Green</Band>
24
	<Band>Blue</Band>
25
</ColorInterpretation>
26
<Statistics>
27
	<BandCount>3</BandCount>
28
	<Band>
29
		<Max>125.0</Max>
30
		<Min>-126.0</Min>
31
		<SecondMax>119.0</SecondMax>
32
		<SecondMin>-120.0</SecondMin>
33
		<MaxRGB>255.0</MaxRGB>
34
		<MinRGB>85.0</MinRGB>
35
		<SecondMaxRGB>249.0</SecondMaxRGB>
36
		<SecondMinRGB>91.0</SecondMinRGB>
37
		<Mean>-36.970986460348165</Mean>
38
		<Variance>4471.639390322834</Variance>
39
	</Band>
40
	<Band>
41
		<Max>124.0</Max>
42
		<Min>-125.0</Min>
43
		<SecondMax>118.0</SecondMax>
44
		<SecondMin>-119.0</SecondMin>
45
		<MaxRGB>255.0</MaxRGB>
46
		<MinRGB>111.0</MinRGB>
47
		<SecondMaxRGB>248.0</SecondMaxRGB>
48
		<SecondMinRGB>118.0</SecondMinRGB>
49
		<Mean>-33.94003868471954</Mean>
50
		<Variance>1313.2478553176525</Variance>
51
	</Band>
52
	<Band>
53
		<Max>123.0</Max>
54
		<Min>-124.0</Min>
55
		<SecondMax>114.0</SecondMax>
56
		<SecondMin>-115.0</SecondMin>
57
		<MaxRGB>255.0</MaxRGB>
58
		<MinRGB>62.0</MinRGB>
59
		<SecondMaxRGB>246.0</SecondMaxRGB>
60
		<SecondMinRGB>70.0</SecondMinRGB>
61
		<Mean>6.6764990328820115</Mean>
62
		<Variance>5895.4615947064785</Variance>
63
	</Band>
64
</Statistics>
65
<Histogram>
66
	<BandCount>3</BandCount>
67
	<DataType>0</DataType>
68
	<Band>
69
		<Min>-128.0</Min>
70
		<Max>127.0</Max>
71
		<Values>0 0 81 0 0 0 0 0 95 0 0 0 0 0 79 0 0 0 0 106 0 0 0 0 0 99 0 0 0 0 0 79 0 0 0 0 60 0 0 0 0 0 32 0 0 0 0 0 40 0 0 0 0 23 0 0 0 0 0 41 0 0 0 0 0 58 0 0 0 0 49 0 0 0 0 0 72 0 0 0 0 0 87 0 0 0 0 68 0 0 0 0 0 35 0 0 0 0 0 43 0 0 0 0 83 0 0 0 0 0 90 0 0 0 0 0 150 0 0 0 0 121 0 0 0 0 0 253 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 2 0 0 0 0 0 3 0 0 0 0 5 0 0 0 0 0 10 0 0 0 0 0 51 0 0 0 0 58 0 0 0 0 0 45 0 0 0 0 0 50 0 0</Values>
72
	</Band>
73
	<Band>
74
		<Min>-128.0</Min>
75
		<Max>127.0</Max>
76
		<Values>0 0 0 17 0 0 0 0 0 13 0 0 0 0 0 0 29 0 0 0 0 0 11 0 0 0 0 0 0 32 0 0 0 0 0 46 0 0 0 0 0 0 38 0 0 0 0 0 0 47 0 0 0 0 0 48 0 0 0 0 0 0 23 0 0 0 0 0 45 0 0 0 0 0 0 112 0 0 0 0 0 114 0 0 0 0 0 0 166 0 0 0 0 0 358 0 0 0 0 0 0 285 0 0 0 0 0 203 0 0 0 0 0 0 219 0 0 0 0 0 146 0 0 0 0 0 0 62 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 13 0 0 0 0 0 0 20 0 0 0 0 0 21 0 0 0</Values>
77
	</Band>
78
	<Band>
79
		<Min>-128.0</Min>
80
		<Max>127.0</Max>
81
		<Values>0 0 0 0 38 0 0 0 0 0 0 0 0 42 0 0 0 0 0 0 0 65 0 0 0 0 0 0 0 0 71 0 0 0 0 0 0 0 0 52 0 0 0 0 0 0 0 0 80 0 0 0 0 0 0 0 0 84 0 0 0 0 0 0 0 45 0 0 0 0 0 0 0 0 46 0 0 0 0 0 0 0 0 107 0 0 0 0 0 0 0 0 137 0 0 0 0 0 0 0 0 201 0 0 0 0 0 0 0 104 0 0 0 0 0 0 0 0 112 0 0 0 0 0 0 0 0 48 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 30 0 0 0 0 0 0 0 93 0 0 0 0 0 0 0 0 123 0 0 0 0 0 0 0 0 161 0 0 0 0 0 0 0 0 136 0 0 0 0 0 0 0 0 167 0 0 0 0 0 0 0 84 0 0 0 0 0 0 0 0 42 0 0 0 0</Values>
82
	</Band>
83
</Histogram>
84
</RasterMetaFile>
branches/v2_0_0_prep/extensions/extRemoteSensing/src-test/org/gvsig/remotesensing/AllTests.java
1 1
package org.gvsig.remotesensing;
2 2

  
3
import junit.framework.Test;
4
import junit.framework.TestCase;
5
import junit.framework.TestSuite;
6

  
3 7
import org.gvsig.remotesensing.decisontrees.DecisionTreesTest;
8
import org.gvsig.remotesensing.processtest.TClassificationProcessTest;
9
import org.gvsig.remotesensing.processtest.TGridMathProcessTest;
4 10
import org.gvsig.remotesensing.processtest.TPCImageProcess;
5 11
import org.gvsig.remotesensing.processtest.TPCStatisticProcess;
6 12
import org.gvsig.remotesensing.processtest.TTasseledCapProcess;
7 13

  
8
import junit.framework.Test;
9
import junit.framework.TestCase;
10
import junit.framework.TestSuite;
11

  
12 14
public class AllTests extends TestCase {
13 15
	
14 16
	public static Test suite() {
15 17
		TestSuite suite = new TestSuite("Test for extRemoteSensing");
16 18
		//$JUnit-BEGIN$
17
		//	suite.addTestSuite(TGridMathProcessTest.class);
19
		suite.addTestSuite(TGridMathProcessTest.class);
18 20
		suite.addTestSuite(TPCStatisticProcess.class);
19 21
		suite.addTestSuite(TPCImageProcess.class);
20 22
		suite.addTestSuite(TTasseledCapProcess.class);
23
		suite.addTestSuite(TClassificationProcessTest.class);
21 24
		suite.addTestSuite(DecisionTreesTest.class);
22 25
		//$JUnit-END$
23 26
		return suite;
branches/v2_0_0_prep/extensions/extRemoteSensing/src-test/org/gvsig/remotesensing/featherprocess/FeatherProcessTest.java
1
package org.gvsig.remotesensing.featherprocess;
2

  
3
import java.io.File;
4

  
5
import org.gvsig.fmap.raster.layers.FLyrRasterSE;
6
import org.gvsig.raster.BaseTestCase;
7
import org.gvsig.raster.Configuration;
8
import org.gvsig.raster.RasterLibrary;
9
import org.gvsig.remotesensing.mosaic.process.FeatherProcess;
10

  
11
import com.iver.cit.gvsig.exceptions.layers.LoadLayerException;
12

  
13
public class FeatherProcessTest extends BaseTestCase {
14
	
15
	private String baseDir = "./test-images/";
16
	
17
	static{
18
		RasterLibrary.wakeUp();
19
	}
20
	
21
	protected void setUp(){
22
	}
23
	
24
	public void start() {
25
		this.setUp();
26
		this.testStack();
27
	}
28

  
29
	public void testStack() {
30
		try {
31
			FLyrRasterSE.setConfiguration(Configuration.getSingleton());
32
			FLyrRasterSE lyr1 = FLyrRasterSE.createLayer("m1", baseDir + "mosaic_test1.tif", null);
33
			FLyrRasterSE lyr2 = FLyrRasterSE.createLayer("m2", baseDir + "mosaic_test2.tif", null);
34
			//FLyrRasterSE lyr1 = FLyrRasterSE.createLayer("m1", "/home/dguerrero/datos/Raster/mosaico/Cn_ccolor_l5_20033_20070624/cn_ccolor_i5_20033_20070624_subset.img", null);
35
			//FLyrRasterSE lyr2 = FLyrRasterSE.createLayer("m2", "/home/dguerrero/datos/Raster/mosaico/Cn_ccolor_l5_19933_20070703/cn_ccolor_i5_19933_20070703_subset.img", null);
36
			FLyrRasterSE[] layers = new FLyrRasterSE[2]; 
37
			layers[0]=lyr1;
38
			layers[1]=lyr2;
39
			FeatherProcess featherProcess = new FeatherProcess();
40
			featherProcess.addParam("inputRasterLayers", layers);
41
			featherProcess.addParam("filename", tempDir + File.separator+"mosaicResult.tif");
42
			featherProcess.init();
43
			featherProcess.process();
44
			
45
		} catch (LoadLayerException e) {
46
			e.printStackTrace();
47
			assertFalse(true);
48
		} catch (InterruptedException e) {
49
			e.printStackTrace();
50
			assertFalse(true);
51
		}
52
	}
53

  
54
}
branches/v2_0_0_prep/extensions/extRemoteSensing/src-test/org/gvsig/remotesensing/featherprocess/FeatherProcessBuffTest.java
1
package org.gvsig.remotesensing.featherprocess;
2

  
3
import java.io.File;
4

  
5
import org.gvsig.fmap.raster.layers.FLyrRasterSE;
6
import org.gvsig.raster.BaseTestCase;
7
import org.gvsig.raster.Configuration;
8
import org.gvsig.raster.RasterLibrary;
9
import org.gvsig.remotesensing.mosaic.process.FeatherProcessBuff;
10

  
11
import com.iver.cit.gvsig.exceptions.layers.LoadLayerException;
12

  
13
public class FeatherProcessBuffTest extends BaseTestCase {
14
	
15
	private String baseDir = "./test-images/";
16
	
17
	static{
18
		RasterLibrary.wakeUp();
19
	}
20
	
21
	protected void setUp(){
22
	}
23
	
24
	public void start() {
25
		this.setUp();
26
		this.testStack();
27
	}
28

  
29
	public void testStack() {
30
		try {
31
			FLyrRasterSE.setConfiguration(Configuration.getSingleton());
32
			//FLyrRasterSE lyr1 = FLyrRasterSE.createLayer("m1", baseDir + "mosaic_test1.tif", null);
33
			//FLyrRasterSE lyr2 = FLyrRasterSE.createLayer("m2", baseDir + "mosaic_test2.tif", null);
34
			FLyrRasterSE lyr1 = FLyrRasterSE.createLayer("m1", "/home/dguerrero/datos/Raster/mosaico/Cn_ccolor_l5_20033_20070624/cn_ccolor_i5_20033_20070624_subset.img", null);
35
			FLyrRasterSE lyr2 = FLyrRasterSE.createLayer("m2", "/home/dguerrero/datos/Raster/mosaico/Cn_ccolor_l5_19933_20070703/cn_ccolor_i5_19933_20070703_subset.img", null);
36
			FLyrRasterSE[] layers = new FLyrRasterSE[2]; 
37
			layers[0]=lyr1;
38
			layers[1]=lyr2;
39
			FeatherProcessBuff featherProcessBuff = new FeatherProcessBuff();
40
			featherProcessBuff.addParam("inputRasterLayers", layers);
41
			featherProcessBuff.addParam("outputPath", tempDir + File.separator+"mosaicResult.tif");
42
			featherProcessBuff.init();
43
			featherProcessBuff.process();
44
			
45
		} catch (LoadLayerException e) {
46
			e.printStackTrace();
47
			assertFalse(true);
48
		} catch (InterruptedException e) {
49
			e.printStackTrace();
50
			assertFalse(true);
51
		}
52
	}
53

  
54
}
branches/v2_0_0_prep/extensions/extRemoteSensing/src-test/org/gvsig/remotesensing/processtest/TGridMathProcessTest.java
1
/* gvSIG. Sistema de Informaci?n Geogr?fica de la Generalitat Valenciana
2
 *
3
 * Copyright (C) 2006 Instituto de Desarrollo Regional and Generalitat Valenciana.
4
 *
5
 * This program is free software; you can redistribute it and/or
6
 * modify it under the terms of the GNU General Public License
7
 * as published by the Free Software Foundation; either version 2
8
 * of the License, or (at your option) any later version.
9
 *
10
 * This program is distributed in the hope that it will be useful,
11
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13
 * GNU General Public License for more details.
14
 *
15
 * You should have received a copy of the GNU General Public License
16
 * along with this program; if not, write to the Free Software
17
 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307,USA.
18
 *
19
 * For more information, contact:
20
 *
21
 *  Generalitat Valenciana
22
 *   Conselleria d'Infraestructures i Transport
23
 *   Av. Blasco Iba?ez, 50
24
 *   46010 VALENCIA
25
 *   SPAIN
26
 *
27
 *      +34 963862235
28
 *   gvsig@gva.es
29
 *      www.gvsig.gva.es
30
 *
31
 *    or
32
 *
33
 *   Instituto de Desarrollo Regional (Universidad de Castilla La-Mancha)
34
 *   Campus Universitario s/n
35
 *   02071 Alabacete
36
 *   Spain
37
 *
38
 *   +34 967 599 200
39
 */
40

  
1 41
package org.gvsig.remotesensing.processtest;
2 42

  
3 43
import junit.framework.TestCase;
......
5 45
import org.gvsig.raster.RasterLibrary;
6 46
import org.gvsig.raster.buffer.BufferFactory;
7 47
import org.gvsig.raster.buffer.RasterBufferInvalidException;
48
import org.gvsig.raster.dataset.IBuffer;
8 49
import org.gvsig.raster.dataset.NotSupportedExtensionException;
9 50
import org.gvsig.raster.dataset.RasterDataset;
10 51
import org.gvsig.raster.dataset.io.RasterDriverException;
11 52
import org.gvsig.raster.grid.Grid;
53
import org.gvsig.raster.grid.GridExtent;
54
import org.gvsig.remotesensing.gridmath.GridMathProcess;
12 55
import org.gvsig.remotesensing.gridmath.gui.GridMathPanel;
13
import org.nfunk.jep.JEP;
14 56

  
57
/**
58
* Este test prueba el proceso de construcci?n de la imagen resultante al operar las 
59
* dos bandas, elemento a elemento, de la imagen pc_CreateImageTest.tif.
60
* 
61
* ** @author Alejandro Mu?oz Sanchez (alejandro.munoz@uclm.es)
62
* */
15 63

  
64

  
16 65
public class TGridMathProcessTest extends TestCase {
17 66
	
18 67
	private String baseDir = "./test-images/";
19
	private String path1 = baseDir + "bhtmref.img";
68
	private String path1 = baseDir + "pc_CreateImageTest.tif";
20 69
	private RasterDataset f1 = null;
21 70
	private BufferFactory ds1 = null;
22 71
	
......
34 83
		try {
35 84
			f1 = RasterDataset.open(null, path1);
36 85
		} catch (NotSupportedExtensionException e) {
37
			e.printStackTrace();
86
			System.out.print("Open file error..");
38 87
		} catch (RasterDriverException e) {
39
			// TODO Auto-generated catch block
40
			e.printStackTrace();
88
			System.out.print("Invalid access..");
41 89
		} 
42 90
		ds1 = new BufferFactory(f1);
43 91
		
......
45 93
	public void testStack() {
46 94
		try {
47 95
			
48
			JEP j= new JEP();
49
			// public GridMathProcess(String expression, HashMap params,GridExtent resultExtent,MapContext mapContext,String filePath)
50
			Grid g = new Grid(ds1,new int[]{1});
51
			Grid g2 = new Grid(ds1,new int[]{2});
96
	
97
			Grid g = new Grid(ds1,new int[]{0});
98
			Grid g2 = new Grid(ds1,new int[]{1});
52 99
			GridMathPanel cp= new GridMathPanel(null,null);
53 100
			cp.getCalculatorPanel().getQWindowsHash().put("b1", g);
54 101
			cp.getCalculatorPanel().getQWindowsHash().put("b2", g2);
55
	//		GridMathProcess proceso= new GridMathProcess("b1+b2", cp.getQWindowsHash(),g.getGridExtent(),null,"filename");
56
	//		proceso.run();
57 102
			
103
			GridMathProcess proceso= new GridMathProcess();
104
			proceso.addParam("expresion", new String("b1+b2"));
105
			proceso.addParam("extent",(GridExtent)g.getGridExtent());
106
			
107
			// Se a?aden las variables al hashmap
108
			cp.getCalculatorPanel().getQWindowsHash().put("b1", new Object[]{g.getRasterBuf(), new Integer(2)});		
109
			cp.getCalculatorPanel().getQWindowsHash().put("b2", new Object[]{g2.getRasterBuf(), new Integer(2)});
110
			proceso.addParam("params",cp.getCalculatorPanel().getQWindowsHash());		
111
			proceso.run();
112
			IBuffer result= (IBuffer)proceso.getResult();
113
			
114
			// Imagen monobanda
115
			assertEquals(result.getBandCount(),1);
116
				
117
			//Comparaci?n de valores
118
			assertEquals(result.getElemDouble(0, 0,0),1390,0.1);
119
			assertEquals(result.getElemDouble(0, 1,0),1293,0.1);
120
			assertEquals(result.getElemDouble(0, 2,0),1295,0.1);
121
			assertEquals(result.getElemDouble(0, 3,0),1137,0.1);	
122
			
123
			assertEquals(result.getElemDouble(1, 0,0),1452,0.1);
124
			assertEquals(result.getElemDouble(1, 1,0),1490,0.1);
125
			assertEquals(result.getElemDouble(1, 2,0),1431,0.1);
126
			assertEquals(result.getElemDouble(1, 3,0),1172,0.1);
127
			
128
			assertEquals(result.getElemDouble(2, 0,0),1615,0.1);
129
			assertEquals(result.getElemDouble(2, 1,0),1650,0.1);
130
			assertEquals(result.getElemDouble(2, 2,0),1493,0.1);
131
			assertEquals(result.getElemDouble(2, 3,0),1333,0.1);	
132
			
133
			assertEquals(result.getElemDouble(3, 0,0),1420,0.1);
134
			assertEquals(result.getElemDouble(3, 1,0),1456,0.1);
135
			assertEquals(result.getElemDouble(3, 2,0),1495,0.1);
136
			assertEquals(result.getElemDouble(3, 3,0),1468,0.1);	
137
			
138
			
139
			
58 140
		} catch (RasterBufferInvalidException e1) {
59 141
			e1.printStackTrace();
60 142
		}
branches/v2_0_0_prep/extensions/extRemoteSensing/src-test/org/gvsig/remotesensing/processtest/TPCImageProcess.java
1
/* gvSIG. Sistema de Informaci?n Geogr?fica de la Generalitat Valenciana
2
 *
3
 * Copyright (C) 2006 Instituto de Desarrollo Regional and Generalitat Valenciana.
4
 *
5
 * This program is free software; you can redistribute it and/or
6
 * modify it under the terms of the GNU General Public License
7
 * as published by the Free Software Foundation; either version 2
8
 * of the License, or (at your option) any later version.
9
 *
10
 * This program is distributed in the hope that it will be useful,
11
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13
 * GNU General Public License for more details.
14
 *
15
 * You should have received a copy of the GNU General Public License
16
 * along with this program; if not, write to the Free Software
17
 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307,USA.
18
 *
19
 * For more information, contact:
20
 *
21
 *  Generalitat Valenciana
22
 *   Conselleria d'Infraestructures i Transport
23
 *   Av. Blasco Iba?ez, 50
24
 *   46010 VALENCIA
25
 *   SPAIN
26
 *
27
 *      +34 963862235
28
 *   gvsig@gva.es
29
 *      www.gvsig.gva.es
30
 *
31
 *    or
32
 *
33
 *   Instituto de Desarrollo Regional (Universidad de Castilla La-Mancha)
34
 *   Campus Universitario s/n
35
 *   02071 Alabacete
36
 *   Spain
37
 *
38
 *   +34 967 599 200
39
 */
40

  
1 41
package org.gvsig.remotesensing.processtest;
2 42

  
3 43
import junit.framework.TestCase;
......
2 42

  
43
import org.gvsig.fmap.raster.layers.FLyrRasterSE;
3 44
import org.gvsig.raster.RasterLibrary;
4 45
import org.gvsig.raster.buffer.BufferFactory;
5
import org.gvsig.raster.buffer.RasterBufferInvalidAccessException;
6 46
import org.gvsig.raster.buffer.RasterBufferInvalidException;
7 47
import org.gvsig.raster.dataset.IBuffer;
8
import org.gvsig.raster.dataset.NotSupportedExtensionException;
9
import org.gvsig.raster.dataset.RasterDataset;
10
import org.gvsig.raster.dataset.io.RasterDriverException;
11 48
import org.gvsig.raster.grid.Grid;
12 49
import org.gvsig.remotesensing.principalcomponents.PCImageProcess;
13
import org.gvsig.remotesensing.principalcomponents.PCStatisticsProcess;
50
import org.gvsig.remotesensing.principalcomponents.PCStatistics;
14 51

  
52
import Jama.Matrix;
53

  
54
import com.iver.cit.gvsig.exceptions.layers.LoadLayerException;
55

  
56

  
57
/**
58
* Este test prueba el proceso de construcci?n de la imagen resultante del proceso
59
* de analisis de componentes principales de la imagen pc_CreateImageTest.tif de 
60
* dimensiones 4x4 y tres bandas. 
61
* 
62
* @author Alejandro Mu?oz Sanchez (alejandro.munoz@uclm.es)
63
* */
15 64
public class TPCImageProcess extends TestCase {
16 65

  
17
	/*
18 66
	private String baseDir = "./test-images/";
19
	private String path1 = baseDir + "PC_Recorte_ERDAS.tif";
20
	private String path2 = baseDir + "PC_Recorte.tif";
21
	private RasterDataset f1 = null;
22
	private BufferFactory ds1 = null;
23
	private RasterDataset f2 = null;
24
	private BufferFactory ds2 = null;
67
	private String path1 = baseDir + "pc_CreateImageTest.tif";
68
	FLyrRasterSE lyr = null;
69
	Grid dataGrid=null;
70
	IBuffer   result= null;
25 71
	
......
37 83
	public void setUp() {
38 84
		System.err.println("TPCImageProcess running...");
39 85
		try {
40
			f1 = RasterDataset.open(null, path1);
41
			f2 = RasterDataset.open(null, path2);
42
		} catch (NotSupportedExtensionException e) {
86
			lyr = FLyrRasterSE.createLayer(
87
					path1,
88
					path1,
89
					null
90
					);
91
			BufferFactory ds1 = new BufferFactory(lyr.getDataSource());
92
			dataGrid= new Grid(ds1);
93
		
94
		} catch (LoadLayerException e) {
95
			System.out.print("Error en la construcci?n de la capa");
96
		} catch (RasterBufferInvalidException e) {
43 97
			e.printStackTrace();
44
		} catch (RasterDriverException e) {
45
			// TODO Auto-generated catch block
46
			e.printStackTrace();
47
		} 
48
		ds1 = new BufferFactory(f1);
49
		ds2= new BufferFactory(f2);
98
		}
50 99
	}
51 100
	
52 101
	public void testStack() {
102
		
103
		PCStatistics pcStatistics = new PCStatistics(new Matrix(new double[][]{{-0.922766631036,0.2990630039783, 0.2430289371596},
104
				   {-0.030678162029,-0.685664096085, 0.7272713370632},
105
                   {0.3841361672896,0.6636460404393, 0.6418826512605}}),
106
                   new double[]{425.104,1753.227,18714.369},
107
                   null);
53 108
	
54
		Grid gridResult=null;
55
		Grid gridResultErdas=null;
56
		try {
57
			 gridResult = new Grid(ds2);
58
			 gridResultErdas = new Grid(ds1);
59
		} catch (RasterBufferInvalidException e) {
60
			e.printStackTrace();
61
		}
109
		PCImageProcess iProcess = new PCImageProcess ();
110
		iProcess.addParam("inputRasterLayer",lyr);
111
		iProcess.addParam("statistics",pcStatistics);
112
		iProcess.addParam("selectedBands", new boolean[]{true,true,true});
113
		iProcess.addParam("selectedComponents",new boolean[]{true,true,true});
114
		iProcess.run();
115
		result=iProcess.getBufferResult();
116
		compare();
117
	}
62 118
	
63
		//PCStatisticsProcess sProcess= new PCStatisticsProcess(ds1.getDataSource(),null,new boolean[]{true,true,true,true,true,true});
64
		//sProcess.calculate();
65
		//PCImageProcess iProcess = new PCImageProcess (sProcess,new boolean[]{true,true,true,true,true,true},"testPCImageProcess");
66
		//iProcess.run();
67
		try {
68
			//compare(iProcess.getBufferResult(),gridResultErdas.getRasterBuf());
69
		} catch (RasterBufferInvalidAccessException e) {
70
			e.printStackTrace();
71
		}
119
	private void compare() {
120
		
121
		// Mismo numero de bandas
122
		assertEquals(result.getBandCount(),3);
123
			
124
		//Comparaci?n de valores
125
		assertEquals(result.getElemFloat(0, 0,0),1977.6109,0.1);
126
		assertEquals(result.getElemFloat(0, 1,0),1864.9603,0.1);
127
		assertEquals(result.getElemFloat(0, 2,0),1896.0991,0.1);
128
		assertEquals(result.getElemFloat(0, 3,0),1768.2855,0.1);	
129
		
130
		assertEquals(result.getElemFloat(1, 0,0),2081.7544,0.1);
131
		assertEquals(result.getElemFloat(1, 1,0),2062.1047,0.1);
132
		assertEquals(result.getElemFloat(1, 2,0),1989.8268,0.1);
133
		assertEquals(result.getElemFloat(1, 3,0),1777.2758,0.1);
134
		
135
		assertEquals(result.getElemFloat(2, 0,0),2212.70,0.1);
136
		assertEquals(result.getElemFloat(2, 1,0),2251.86,0.1);
137
		assertEquals(result.getElemFloat(2, 2,0),2094.61,0.1);
138
		assertEquals(result.getElemFloat(2, 3,0),1907.58,0.1);	
139
		
140
		assertEquals(result.getElemFloat(3, 0,0),1986.52,0.1);
141
		assertEquals(result.getElemFloat(3, 1,0),2056.09,0.1);
142
		assertEquals(result.getElemFloat(3, 2,0),2155.27,0.1);
143
		assertEquals(result.getElemFloat(3, 3,0),2060.12,0.1);	
144
		
145
		// Comparaci?n de los resultados de la banda 2
146
		
147
		assertEquals(result.getElemFloat(0, 0,1),621.25,0.1);
148
		assertEquals(result.getElemFloat(0, 1,1),592.24,0.1);
149
		assertEquals(result.getElemFloat(0, 2,1),623.04,0.1);
150
		assertEquals(result.getElemFloat(0, 3,1),669.02,0.1);	
151
		
152
		assertEquals(result.getElemFloat(1, 0,1),639.79,0.1);
153
		assertEquals(result.getElemFloat(1, 1,1),621.29,0.1);
154
		assertEquals(result.getElemFloat(1, 2,1),632.87,0.1);
155
		assertEquals(result.getElemFloat(1, 3,1),678.50,0.1);	
156
		
157
		assertEquals(result.getElemFloat(2, 0,1),597.30,0.1);
158
		assertEquals(result.getElemFloat(2, 1,1),637.98,0.1);
159
		assertEquals(result.getElemFloat(2, 2,1),652.07,0.1);
160
		assertEquals(result.getElemFloat(2, 3,1),633.76,0.1);	
161
		
162
		assertEquals(result.getElemFloat(3, 0,1),538.32,0.1);
163
		assertEquals(result.getElemFloat(3, 1,1),610.48,0.1);
164
		assertEquals(result.getElemFloat(3, 2,1),713.41,0.1);
165
		assertEquals(result.getElemFloat(3, 3,1),704.34,0.1);	
166
		
167
		// Comparaci?n de los resultados de la banda 3
168
		
169
		assertEquals(result.getElemFloat(0, 0,2),302.79,0.1);
170
		assertEquals(result.getElemFloat(0, 1,2),301.65,0.1);
171
		assertEquals(result.getElemFloat(0, 2,2),318.75,0.1);
172
		assertEquals(result.getElemFloat(0, 3,2),335.75,0.1);	
173
		
174
		assertEquals(result.getElemFloat(1, 0,2),336.23,0.1);
175
		assertEquals(result.getElemFloat(1, 1,2),283.88,0.1);
176
		assertEquals(result.getElemFloat(1, 2,2),267.51,0.1);
177
		assertEquals(result.getElemFloat(1, 3,2),304.35,0.1);	
178
		
179
		assertEquals(result.getElemFloat(2, 0,2),315.77,0.1);
180
		assertEquals(result.getElemFloat(2, 1,2),302.42,0.1);
181
		assertEquals(result.getElemFloat(2, 2,2),301.33,0.1);
182
		assertEquals(result.getElemFloat(2, 3,2),286.24,0.1);	
183
		
184
		assertEquals(result.getElemFloat(3, 0,2),314.02,0.1);
185
		assertEquals(result.getElemFloat(3, 1,2),317.80,0.1);
186
		assertEquals(result.getElemFloat(3, 2,2),336.10,0.1);
187
		assertEquals(result.getElemFloat(3, 3,2),271.26,0.1);	
72 188

  
73 189
	}
74
	
75
	private void compare(IBuffer buffer, IBuffer buffer2) throws RasterBufferInvalidAccessException {
76
		assertEquals(buffer.getBandCount(),buffer2.getBandCount());
77
		for(int band=0; band<buffer.getBandCount();band++){
78
			for(int line = 0; line < buffer2.getHeight(); line++){
79
				for(int col = 0; col < buffer2.getWidth(); col++){
80
					assertEquals(buffer2.getElemShort(col,line,band), buffer.getElemShort(col, line,band),1);
81
				}
82
			}
83
		}
84
	}*/
85
	
86
	
87 190
}
branches/v2_0_0_prep/extensions/extRemoteSensing/src-test/org/gvsig/remotesensing/processtest/LinearTransforTest.java
1 1
package org.gvsig.remotesensing.processtest;
2 2

  
3 3
import java.awt.geom.Point2D;
4

  
4 5
import junit.framework.TestCase;
5 6

  
6 7
import org.gvsig.raster.datastruct.GeoPoint;
branches/v2_0_0_prep/extensions/extRemoteSensing/src-test/org/gvsig/remotesensing/processtest/TFusionPCProcess.java
1
/* gvSIG. Sistema de Informaci?n Geogr?fica de la Generalitat Valenciana
2
 *
3
 * Copyright (C) 2006 Instituto de Desarrollo Regional and Generalitat Valenciana.
4
 *
5
 * This program is free software; you can redistribute it and/or
6
 * modify it under the terms of the GNU General Public License
7
 * as published by the Free Software Foundation; either version 2
8
 * of the License, or (at your option) any later version.
9
 *
10
 * This program is distributed in the hope that it will be useful,
11
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13
 * GNU General Public License for more details.
14
 *
15
 * You should have received a copy of the GNU General Public License
16
 * along with this program; if not, write to the Free Software
17
 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307,USA.
18
 *
19
 * For more information, contact:
20
 *
21
 *  Generalitat Valenciana
22
 *   Conselleria d'Infraestructures i Transport
23
 *   Av. Blasco Iba?ez, 50
24
 *   46010 VALENCIA
25
 *   SPAIN
26
 *
27
 *      +34 963862235
28
 *   gvsig@gva.es
29
 *      www.gvsig.gva.es
30
 *
31
 *    or
32
 *
33
 *   Instituto de Desarrollo Regional (Universidad de Castilla La-Mancha)
34
 *   Campus Universitario s/n
35
 *   02071 Alabacete
36
 *   Spain
37
 *
38
 *   +34 967 599 200
39
 */
40

  
41
package org.gvsig.remotesensing.processtest;
42

  
43
import junit.framework.TestCase;
44

  
45

  
46
import org.gvsig.fmap.raster.layers.FLyrRasterSE;
47
import org.gvsig.raster.RasterLibrary;
48
import org.gvsig.raster.buffer.BufferFactory;
49
import org.gvsig.raster.buffer.RasterBuffer;
50
import org.gvsig.raster.buffer.RasterBufferInvalidException;
51
import org.gvsig.raster.grid.Grid;
52
import org.gvsig.remotesensing.principalcomponents.PCImageProcess;
53
import org.gvsig.remotesensing.principalcomponents.PCStatisticsProcess;
54

  
55
import Jama.Matrix;
56

  
57
import com.iver.cit.gvsig.exceptions.layers.LoadLayerException;
58

  
59

  
60
/**
61
* Este test prueba la obtencion de la imagen original a partir de las 
62
* componetes principales calculadas. En el proceso de fusi?n de im?genes 
63
* por el m?todo de PCA est? b?sado en transformaci?n inversa PCA.
64
* 
65
* ** @author Alejandro Mu?oz Sanchez (alejandro.munoz@uclm.es)
66
* */
67

  
68
public class TFusionPCProcess extends TestCase {
69

  
70
	private String baseDir = "./test-images/";
71
	private String path1 = baseDir+"pc_CreateImageTest.tif";
72
	FLyrRasterSE lyr = null;
73
	
74
	static{
75
		RasterLibrary.wakeUp();	
76
	}
77
	
78
	public void start() {
79
		this.setUp();
80
		this.testStack();
81
	}
82
	
83
	public void setUp() {
84
		System.err.println("TFusionPC running...");
85
		try{
86
			lyr = FLyrRasterSE.createLayer(
87
					path1,
88
					path1,
89
					null
90
					);
91
		
92
		} catch (LoadLayerException e) {
93
			System.out.print("Error en la construcci?n de la capa");
94
		} 
95
	}
96
	
97
	public void testStack() {
98
		
99
		PCStatisticsProcess sProcess= new PCStatisticsProcess();
100
		sProcess.addParam("selectedBands",new boolean[]{true,true,true});
101
		sProcess.addParam("inputRasterLayer",lyr);
102
		sProcess.run();
103
		
104
		Matrix autoV=sProcess.getAutoVectorMatrix();
105
		// Reordenamos en orden descencente del valor de los autovectores
106
		int resultOrden[]= new int[autoV.getRowDimension()];
107
		int cont = autoV.getRowDimension()-1;
108
		for(int i=0;i<autoV.getRowDimension();i++){
109
					resultOrden[i]=cont;
110
					cont--;
111
		}
112
		double order[][]= new double[autoV.getRowDimension()][autoV.getColumnDimension()];
113
		for(int i=0; i<resultOrden.length;i++)
114
			for(int j=0; j<autoV.getColumnDimension();j++)
115
				order[i][j]=autoV.get(j,resultOrden[i]);
116
				
117
		
118
		PCImageProcess imgProcess= new PCImageProcess();
119
		imgProcess.addParam("inputRasterLayer",lyr);
120
		imgProcess.addParam("statistics",sProcess.getResult());
121
		imgProcess.addParam("selectedBands",new boolean[]{true,true,true});
122
		imgProcess.addParam("selectedComponents",new boolean[]{true,true,true});
123
		imgProcess.addParam("outputPath",new String ("outfile.tif"));
124
		imgProcess.run();
125
		
126
		FLyrRasterSE resultado= (FLyrRasterSE) imgProcess.getResult();
127
		Matrix inverse=autoV.inverse();
128
		
129
		BufferFactory ds1 = new BufferFactory(resultado.getDataSource());
130
		BufferFactory ds2 = new BufferFactory(lyr.getDataSource());
131
		Grid dataGrid=null; Grid dataOrigen=null;
132
		try {
133
			dataGrid= new Grid(ds1);
134
			dataOrigen= new Grid(ds2);
135
		} catch (RasterBufferInvalidException e) {
136
			e.printStackTrace();
137
		}
138
		float newData[]= new float[3];
139
		float data[] = new float[3];
140
		
141
		
142
		RasterBuffer rasterResult= RasterBuffer.getBuffer(RasterBuffer.TYPE_FLOAT, dataGrid.getRasterBuf().getWidth(), dataGrid.getRasterBuf().getHeight(), dataGrid.getBandCount(), true);
143
		for(int row=0; row<dataGrid.getRasterBuf().getHeight(); row++){	 
144
			for(int col=0; col<dataGrid.getRasterBuf().getWidth();col++){	
145
				dataGrid.getRasterBuf().getElemFloat(row,col,data);{
146
				
147
						newData=solveSystem(new Matrix(order),data);
148
						//newData[i]+= data[i]*inverse.get(resultOrden[i],j);	
149
				}
150
				rasterResult.setElemFloat(row,col,newData);
151
			}
152
		}
153
	
154
		
155
//		 Comprobar que el resultado de la imagen original es el mismo que tras aplicar la inversa a las componentes
156
		
157
	for(int i=0; i<dataGrid.getRasterBuf().getHeight();i++)
158
		for(int j=0; j<dataGrid.getRasterBuf().getHeight();j++){
159
			assertEquals(rasterResult.getElemFloat(i,j,0),(float)dataOrigen.getRasterBuf().getElemShort(i,j,0),0.1);
160
			assertEquals(rasterResult.getElemFloat(i,j,1),(float)dataOrigen.getRasterBuf().getElemShort(i,j,1),0.1);
161
			assertEquals(rasterResult.getElemFloat(i,j,2),(float)dataOrigen.getRasterBuf().getElemShort(i,j,2),0.1);
162
		}
163
	}
164
	
165
	
166
	public float[] solveSystem(Matrix matrix, float columResult[]){
167
		float xCoef[] = new float[3];
168
		double[][] a = new double[columResult.length][1];
169
		for (int i = 0; i < columResult.length; i++)
170
			a[i][0] = columResult[i];
171
		Matrix c = null;
172
		//if (matrix.det() == 0.0) {
173
			// Resolucion del sistema usando la libreria flanagan
174
		//	flanagan.math.Matrix matrixFL = new flanagan.math.Matrix(matrix.getArray());
175
		//	xCoef = matrixFL.solveLinearSet(columResult);
176
		//} else {
177
		c = matrix.solve(new Matrix(a));
178
		for (int i = 0; i < columResult.length; i++)
179
				xCoef[i] = (float)c.get(i, 0);
180
	//	}
181
		return xCoef;
182
	}
183

  
184
	
185
}
branches/v2_0_0_prep/extensions/extRemoteSensing/src-test/org/gvsig/remotesensing/processtest/TTasseledCapProcess.java
1
/* gvSIG. Sistema de Informaci?n Geogr?fica de la Generalitat Valenciana
2
 *
3
 * Copyright (C) 2006 Instituto de Desarrollo Regional and Generalitat Valenciana.
4
 *
5
 * This program is free software; you can redistribute it and/or
6
 * modify it under the terms of the GNU General Public License
7
 * as published by the Free Software Foundation; either version 2
8
 * of the License, or (at your option) any later version.
9
 *
10
 * This program is distributed in the hope that it will be useful,
11
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13
 * GNU General Public License for more details.
14
 *
15
 * You should have received a copy of the GNU General Public License
16
 * along with this program; if not, write to the Free Software
17
 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307,USA.
18
 *
19
 * For more information, contact:
20
 *
21
 *  Generalitat Valenciana
22
 *   Conselleria d'Infraestructures i Transport
23
 *   Av. Blasco Iba?ez, 50
24
 *   46010 VALENCIA
25
 *   SPAIN
26
 *
27
 *      +34 963862235
28
 *   gvsig@gva.es
29
 *      www.gvsig.gva.es
30
 *
31
 *    or
32
 *
33
 *   Instituto de Desarrollo Regional (Universidad de Castilla La-Mancha)
34
 *   Campus Universitario s/n
35
 *   02071 Alabacete
36
 *   Spain
37
 *
38
 *   +34 967 599 200
39
 */
40

  
1 41
package org.gvsig.remotesensing.processtest;
2 42

  
3 43
import junit.framework.TestCase;
......
2 42

  
43
import org.gvsig.fmap.raster.layers.FLyrRasterSE;
3 44
import org.gvsig.raster.RasterLibrary;
4 45
import org.gvsig.raster.buffer.BufferFactory;
5 46
import org.gvsig.raster.buffer.RasterBufferInvalidAccessException;
47
import org.gvsig.raster.buffer.RasterBufferInvalidException;
6 48
import org.gvsig.raster.dataset.IBuffer;
49
import org.gvsig.raster.dataset.NotSupportedExtensionException;
7 50
import org.gvsig.raster.dataset.RasterDataset;
51
import org.gvsig.raster.dataset.io.RasterDriverException;
52
import org.gvsig.raster.grid.Grid;
53
import org.gvsig.remotesensing.tasseledcap.TasseledCapProcess;
8 54

  
55
import com.iver.cit.gvsig.exceptions.layers.LoadLayerException;
9 56

  
57

  
10 58
/**
......
17 65
 * detallan a continuaci?n calculados previamente con Envi.
18 66
 * Para el caso de la Imagen LandSat TM, se compara el resultado con Imagen: LandSatTM_Envi
19 67
 * Para el caso de la Imagen LandSat ETM, se compara el resultado con Imagen LandSatETM_Envi
20
 * Para el caso de la Imagen LandSat MSS, se compara el resultado con Imagen LandSatMSS_Envi
68
 * Para el caso de la Imagen LandSat MSS, se compara el resultado con Imagen LandSatMSS_Envi.tif
21 69
 *
22 70
 * @author Alejandro Mu?oz Sanchez (alejandro.munoz@uclm.es)
23 71
 * */
......
29 77
	private String path2 = baseDir + "LandSatTM_Envi";
30 78
	private String path3 = baseDir + "LandSatETM_Envi";
31 79
	private String path4 = baseDir + "LandSatMSS_Envi";
32
	private RasterDataset f1,f2,f3,f4 = null;
33
	private BufferFactory ds1,ds2,ds3,ds4 = null;
34

  
80
	private RasterDataset f2,f3,f4 = null;
81
	private BufferFactory ds2,ds3,ds4 = null;
82
	private FLyrRasterSE lyr1 = null;
35 83
	
36 84
	static{
37 85
		RasterLibrary.wakeUp();	
......
39 87
	
40 88
	public void start() {
41 89
		this.setUp();
42
		//this.testStack();
90
	    this.testStack();
43 91
	}
44 92
	
45 93
	public void setUp() {
46
		/*System.err.println("TTasseledCapProcess running...");
94
		System.err.println("TTasseledCapProcess running...");
95

  
47 96
		try {
48
			f1 = RasterDataset.open(null,path1);
97
			lyr1 = FLyrRasterSE.createLayer(
98
					path1,
99
					path1,
100
					null
101
					);
102
		} catch (LoadLayerException e) {
103
			System.out.print("Error en la construcci?n de la capa");
104
		}
105
		
106
		try {
49 107
			f2=	RasterDataset.open(null,path2);
50 108
			f3 = RasterDataset.open(null,path3);
51 109
			f4= RasterDataset.open(null, path4);
52
			
53
			
54 110
		} catch (NotSupportedExtensionException e) {
55 111
			e.printStackTrace();
56 112
		} catch (RasterDriverException e) {
57 113
			// TODO Auto-generated catch block
58 114
			e.printStackTrace();
59 115
		}
60
		ds1 = new BufferFactory(f1);
61 116
		ds2=  new BufferFactory (f2);
62 117
		ds3=  new BufferFactory (f3);
63 118
		ds4=  new BufferFactory (f4); 
......
66 121
	
67 122
	public void testStack() {
68 123
	
69
		Grid g=null;
70 124
		Grid enviResultTM=null;
71 125
		Grid enviResultETM=null;
72 126
		Grid enviResultMSS=null;
73 127
		
74 128
		try {
75
			 g = new Grid(ds1);
76 129
			 enviResultTM= new Grid(ds2);
77 130
			 enviResultETM= new Grid(ds3);
78 131
			 enviResultMSS= new Grid (ds4);
......
82 135
		}
83 136
	
84 137
		
85
		*//**Caso LandSat TM*//*
86
		TasseledCapProcess tC= new TasseledCapProcess();
87
		tC.addParam("filename",);
88
		tC.run();
89
		try {
90
			compare(tC.getBufferResult(),enviResultTM.getRasterBuf());
91
		} catch (RasterBufferInvalidAccessException e) {
92
			e.printStackTrace();
93
		}
138
//		**Caso LandSat MSS
139
		TasseledCapProcess mssProcess= new TasseledCapProcess();
140
		mssProcess.addParam("bands", new int[]{0,1,2,3});
141
		mssProcess.addParam("layer",lyr1);
142
		mssProcess.addParam("type",new Integer(0));
143
		mssProcess.run();
144
		//try {
145
		//	compare(mssProcess.getBufferResult(),enviResultMSS.getRasterBuf());
146
		//} catch (RasterBufferInvalidAccessException e) {
147
		//	e.printStackTrace();
148
		//}
94 149
		
95 150
		
96
		*//**Caso LandSat ETM*//*
97 151
		
98
		tC= new TasseledCapProcess(ds1.getDataSource(),null,2,"LandSat ETM");
99
		tC.run();
152
		//**Caso LandSat TM
153
		TasseledCapProcess tmProcess= new TasseledCapProcess();
154
		tmProcess.addParam("bands", new int[]{0,1,2,3,4,5});
155
		tmProcess.addParam("layer",lyr1);
156
		tmProcess.addParam("type",new Integer(1));
157
		tmProcess.run();
100 158
		try {
101
			compare(tC.getBufferResult(),enviResultETM.getRasterBuf());
159
			compare(tmProcess.getBufferResult(),enviResultTM.getRasterBuf());
102 160
		} catch (RasterBufferInvalidAccessException e) {
103 161
			e.printStackTrace();
104 162
		}
105 163
		
106
	
107
		*//**Caso de LandSat MSS*//*
164
		
165
		//**Caso LandSat ETM
166
		TasseledCapProcess etmProcess= new TasseledCapProcess();
167
		etmProcess.addParam("bands", new int[]{0,1,2,3,4,5});
168
		etmProcess.addParam("layer",lyr1);
169
		etmProcess.addParam("type",new Integer(2));
170
		etmProcess.run();
108 171
		try {
109
			g = new Grid(ds1,new int[]{0,1,2,3});
110
		} catch (RasterBufferInvalidException e1) {
111
			e1.printStackTrace();
112
		}
113
		tC= new TasseledCapProcess(ds1.getDataSource(),null,0,"LandSat MSS");
114
		tC.run();
115
		*//** La imagen LandSat MSS No se compara porque los coeficientes utilizados por ENVI no son similares  
116
		a los de la matriz de coeficientes proporcionados por Jose *//*
117
		try {
118
			
119
			//compare(tC.getGridResult(),enviResultMSS);
120
			
172
			compare(etmProcess.getBufferResult(),enviResultETM.getRasterBuf());
121 173
		} catch (RasterBufferInvalidAccessException e) {
122 174
			e.printStackTrace();
123 175
		}
124
		*/
176
		
177
		
125 178
	}
126
		
127 179
	
128
	/**Metodo que compara celda a celda cada uno de los valores de dos grids.
129
	 * Para imagenes LandSat ETM, la sexta banda no se compara porque envi realiza una transformacion 
130
	 * para evitar los numeros negativos */
180
	//**Metodo que compara celda a celda cada uno de los valores de dos grids.
181
	 // Para imagenes LandSat ETM, la sexta banda no se compara porque envi realiza una transformacion 
182
	 // para evitar los numeros negativos *//*
131 183
	private void compare(IBuffer buffer, IBuffer buffer2) throws RasterBufferInvalidAccessException {
132 184
		assertEquals(buffer.getBandCount(),buffer2.getBandCount());
133 185
		for(int band=0; band<buffer.getBandCount();band++){
......
141 193

  
142 194
		}
143 195
	}
144

  
145 196
}
branches/v2_0_0_prep/extensions/extRemoteSensing/src-test/org/gvsig/remotesensing/processtest/TPCStatisticProcess.java
1
/* gvSIG. Sistema de Informaci?n Geogr?fica de la Generalitat Valenciana
2
 *
3
 * Copyright (C) 2006 Instituto de Desarrollo Regional and Generalitat Valenciana.
4
 *
5
 * This program is free software; you can redistribute it and/or
6
 * modify it under the terms of the GNU General Public License
7
 * as published by the Free Software Foundation; either version 2
8
 * of the License, or (at your option) any later version.
9
 *
10
 * This program is distributed in the hope that it will be useful,
11
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13
 * GNU General Public License for more details.
14
 *
15
 * You should have received a copy of the GNU General Public License
16
 * along with this program; if not, write to the Free Software
17
 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307,USA.
18
 *
19
 * For more information, contact:
20
 *
21
 *  Generalitat Valenciana
22
 *   Conselleria d'Infraestructures i Transport
23
 *   Av. Blasco Iba?ez, 50
24
 *   46010 VALENCIA
25
 *   SPAIN
26
 *
27
 *      +34 963862235
28
 *   gvsig@gva.es
29
 *      www.gvsig.gva.es
30
 *
31
 *    or
32
 *
33
 *   Instituto de Desarrollo Regional (Universidad de Castilla La-Mancha)
34
 *   Campus Universitario s/n
35
 *   02071 Alabacete
36
 *   Spain
37
 *
38
 *   +34 967 599 200
39
 */
40

  
1 41
package org.gvsig.remotesensing.processtest;
2 42

  
43
import java.io.File;
44

  
3 45
import junit.framework.TestCase;
4 46

  
47
import org.gvsig.fmap.raster.layers.FLyrRasterSE;
5 48
import org.gvsig.raster.RasterLibrary;
6
import org.gvsig.raster.buffer.BufferFactory;
7
import org.gvsig.raster.buffer.RasterBufferInvalidException;
8
import org.gvsig.raster.dataset.NotSupportedExtensionException;
9
import org.gvsig.raster.dataset.RasterDataset;
10
import org.gvsig.raster.dataset.io.RasterDriverException;
11
import org.gvsig.raster.grid.Grid;
12 49
import org.gvsig.remotesensing.principalcomponents.PCStatisticsProcess;
13 50

  
14 51
import Jama.Matrix;
15 52

  
53
import com.iver.cit.gvsig.exceptions.layers.LoadLayerException;
16 54

  
55

  
17 56
/**
18 57
* Este test prueba el proceso de calculo de las matriz de autovectores de la 
19 58
* imagen "PCA_bouldr_tm_int16.img", de seis bandas.
20 59
* Los elementos de la matriz obtenida en el proceso se comparan en valor absoluto
21 60
* comparan con los elementos de la matriz de autovalores proporcionada por ERDAS.
61
* 
22 62
* ** @author Alejandro Mu?oz Sanchez (alejandro.munoz@uclm.es)
23 63
* */
24 64

  
25 65
public class TPCStatisticProcess extends TestCase {
26 66

  
27
	/*private String baseDir = "./test-images/";
67
	private String baseDir = "./test-images/";
28 68
	private String path1 = baseDir + "bouldr_tm_Int16.dat";
29
	private RasterDataset f1 = null;
30
	private BufferFactory ds1 = null;
31 69

  
32
	
33 70
	static{
34 71
		RasterLibrary.wakeUp();	
35 72
	}
......
41 78
	
42 79
	public void setUp() {
43 80
		System.err.println("TPCStatisticProcess running...");
44
		try {
45
			f1 = RasterDataset.open(null, path1);
46
		} catch (NotSupportedExtensionException e) {
47
			e.printStackTrace();
48
		} catch (RasterDriverException e) {
49
			// TODO Auto-generated catch block
50
			e.printStackTrace();
51
		} 
52
		ds1 = new BufferFactory(f1);
53
	
54 81
	}
55 82
	
56 83
	public void testStack() {
......
65 92
				{0.3276151521697355 ,0.3959638943275853 ,-0.0361409474886444, -0.2504588305907446 ,0.8196505984901843 ,0.004243695755382132}		
66 93
		};
67 94
		
68
		Grid g=null;
95

  
96
		FLyrRasterSE lyr = null;
97
		int endIndex = path1.lastIndexOf(".");
98
		if (endIndex < 0)
99
			endIndex = path1.length();
69 100
		try {
70
			 g = new Grid(ds1);
71
		} catch (RasterBufferInvalidException e) {
72
			e.printStackTrace();
101
			lyr = FLyrRasterSE.createLayer(
102
					path1.substring(path1.lastIndexOf(File.separator) + 1, endIndex),
103
					path1,
104
				null
105
					);
106
		} catch (LoadLayerException e) {
107
			System.out.print("Error en la construcci?n de la capa");
73 108
		}
74
	
75
		PCStatisticsProcess sProcess= new PCStatisticsProcess(ds1.getDataSource(),null,new boolean[]{true,true,true,true,true,true});
76
		sProcess.calculate();
109

  
110
		
111
		PCStatisticsProcess sProcess= new PCStatisticsProcess();
112
		sProcess.addParam("selectedBands",new boolean[]{true,true,true,true,true,true});
113
		sProcess.addParam("inputRasterLayer",lyr);
114
		sProcess.run();
115
		
77 116
		Matrix autoV=sProcess.getAutoVectorMatrix();
78 117
		// Reordenamos en orden descencente del valor de los autovectores
79 118
		int resultOrden[]= new int[autoV.getRowDimension()];
......
83 122
					cont--;
84 123
		}
85 124
		
86
		*//**La comparacion se realiza en valor absoluto, ya que el criterio de signos puede variar*//*
125
		/** La comparacion se realiza en valor absoluto, ya que el criterio de signos 
126
		 *  puede variar */
127
		
87 128
		for(int i=0; i<autoVectorMatrixERDAS.length;i++)
88 129
			for(int j=0;j<autoVectorMatrixERDAS[0].length;j++)
89 130
			{	
90 131
				assertEquals(java.lang.Math.abs(autoVectorMatrixERDAS[i][j]), java.lang.Math.abs(autoV.get(i, resultOrden[j])), 0.005);
91 132
			}
92
		
93 133
	}
94
	*/
95
	
96

  
97
		
98 134
}
branches/v2_0_0_prep/extensions/extRemoteSensing/src-test/org/gvsig/remotesensing/processtest/Process.java
64 64
	public String getTitle() {
65 65
		return "Rulando";
66 66
	}
67

  
68
	public boolean isCancelable() {
69
		return true;
70
	}
71

  
72
	public boolean isPausable() {
73
		return false;
74
	}
67 75
}
branches/v2_0_0_prep/extensions/extRemoteSensing/src-test/org/gvsig/remotesensing/processtest/TClassificationProcessTest.java
1
/* gvSIG. Sistema de Informaci?n Geogr?fica de la Generalitat Valenciana
2
 *
... This diff was truncated because it exceeds the maximum size that can be displayed.

Also available in: Unified diff