svn-gvsig-desktop / trunk / libraries / libjni-mrsid / src / main / java / es / gva / cit / jmrsid / TestReadMrSid.java @ 20374
History | View | Annotate | Download (1.76 KB)
1 |
package es.gva.cit.jmrsid; |
---|---|
2 |
|
3 |
import java.io.IOException; |
4 |
|
5 |
import junit.framework.TestCase; |
6 |
import es.gva.cit.jmrsid.LTIMetadataDatabase; |
7 |
import es.gva.cit.jmrsid.LTIMetadataRecord; |
8 |
import es.gva.cit.jmrsid.MrSIDException; |
9 |
import es.gva.cit.jmrsid.MrSIDImageReader; |
10 |
|
11 |
/**
|
12 |
* Test de lectura de jmrsid.
|
13 |
* @author Miguel ?ngel Querol Carratal? <miguelangel.querol@iver.es>
|
14 |
*
|
15 |
*/
|
16 |
public class TestReadMrSid extends TestCase{ |
17 |
|
18 |
private MrSIDImageReader sid = null; |
19 |
|
20 |
private String fileName = "Urban_10cm.sid"; |
21 |
private String baseDir = "./test-images/"; |
22 |
private String file1 = baseDir + fileName; |
23 |
|
24 |
private int numBands = 0; |
25 |
private int width = 0; |
26 |
private int height = 0; |
27 |
private String projection = null; |
28 |
private LTIMetadataDatabase metadata = null; |
29 |
private LTIMetadataRecord record = null; |
30 |
|
31 |
public void start(){ |
32 |
setUp(); |
33 |
testStack(); |
34 |
} |
35 |
|
36 |
|
37 |
public void setUp(){ |
38 |
try {
|
39 |
sid = new MrSIDImageReader(file1);
|
40 |
sid.initialize(); |
41 |
|
42 |
} catch (MrSIDException e) {
|
43 |
e.printStackTrace(); |
44 |
} catch (IOException e) { |
45 |
e.printStackTrace(); |
46 |
} |
47 |
|
48 |
|
49 |
} |
50 |
|
51 |
public void testStack(){ |
52 |
try {
|
53 |
numBands = sid.getNumBands(); |
54 |
width = sid.getWidth(); |
55 |
height = sid.getHeight(); |
56 |
metadata = sid.getMetadata(); |
57 |
System.out.println("**** TEST DE ACCESO A IM?GENES MRSID ****"); |
58 |
System.out.println(" IMAGEN: " + fileName); |
59 |
System.out.println("N?mero de bandas: " + numBands); |
60 |
System.out.println("Anchura: " + width); |
61 |
System.out.println("Altura: " + height); |
62 |
|
63 |
// for (int i = 0 ; i<metadata.getIndexCount() ; i++){
|
64 |
// record = metadata.getDataByIndex(i);
|
65 |
// System.out.println(record.getTagName() + ": " + record.getScalarData());
|
66 |
// }
|
67 |
sid.close(); |
68 |
} catch (MrSIDException e) {
|
69 |
e.printStackTrace(); |
70 |
} |
71 |
|
72 |
} |
73 |
|
74 |
} |