Statistics
| Revision:

svn-gvsig-desktop / branches / CqCMSDvp / libraries / libCq CMS for java.old / src / org / cresques / io / raster / RasterStats.java @ 2669

History | View | Annotate | Download (3.55 KB)

1
/*
2
 * Cresques Mapping Suite. Graphic Library for constructing mapping applications.
3
 *
4
 * Copyright (C) 2004-5.
5
 *
6
 * This program is free software; you can redistribute it and/or
7
 * modify it under the terms of the GNU General Public License
8
 * as published by the Free Software Foundation; either version 2
9
 * of the License, or (at your option) any later version.
10
 *
11
 * This program is distributed in the hope that it will be useful,
12
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14
 * GNU General Public License for more details.
15
 *
16
 * You should have received a copy of the GNU General Public License
17
 * along with this program; if not, write to the Free Software
18
 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307,USA.
19
 *
20
 * For more information, contact:
21
 *
22
 * cresques@gmail.com
23
 */
24
package org.cresques.io.raster;
25

    
26
import java.util.ArrayList;
27

    
28

    
29
/**
30
 * Clase para estadisticas
31
 * @author Luis W. Sevilla (sevilla_lui@gva.es)
32
 */
33
public class RasterStats {
34
    /**
35
     * M?nimo valor de pixel por banda
36
     */
37
    public int[] minBandValue = {
38
                                    Integer.MAX_VALUE, Integer.MAX_VALUE,
39
                                    Integer.MAX_VALUE
40
                                };
41

    
42
    /**
43
     * M?ximo valor de pixel por banda
44
     */
45
    public int[] maxBandValue = {
46
                                    Integer.MIN_VALUE, Integer.MIN_VALUE,
47
                                    Integer.MIN_VALUE
48
                                };
49

    
50
    /**
51
     * Segundo valor m?s peque?o de pixel por banda
52
     */
53
    public int[] secondMinBandValue = {
54
                                          Integer.MAX_VALUE, Integer.MAX_VALUE,
55
                                          Integer.MAX_VALUE
56
                                      };
57

    
58
    /**
59
     * Segundo valor m?s grande de pixel por banda
60
     */
61
    public int[] secondMaxBandValue = {
62
                                          Integer.MIN_VALUE, Integer.MIN_VALUE,
63
                                          Integer.MIN_VALUE
64
                                      };
65

    
66
    /**
67
     * Historial de valores para una imagen. Esto se usa cuando se solicita varias
68
     * veces para una misma imagen solo tenga que calcular los valores una vez
69
     */
70
    public ArrayList history = new ArrayList();
71

    
72
    /**
73
     * Porcentaje de recorte de colas
74
     */
75
    public double tailPercent = 0D;
76

    
77
    /**
78
     * Constructor
79
     */
80
    public RasterStats() {
81
        super();
82
    }
83

    
84
    public void pinta() {
85
        for (int i = 0; i < 3; i++)
86
            System.out.println("  Band [" + i + "]: " + minBandValue[i] +
87
                               "..." + maxBandValue[i]);
88

    
89
        System.out.println("Porcentaje de recorte: " + tailPercent);
90
    }
91

    
92
    /**
93
     * Clase que contiene los valores calculados para una imagen.
94
     * Esto se usa cuando se solicita varias veces para una misma imagen solo
95
     * tenga que calcular los valores una vez.
96
     * @author Nacho Brodin (brodin_ign@gva.es)
97
     */
98
    public class History {
99
        public String file = null;
100
        public int[] min = null;
101
        public int[] max = null;
102
        public int[] secMin = null;
103
        public int[] secMax = null;
104

    
105
        public History(String file, int[] min, int[] max, int[] secMin,
106
                       int[] secMax) {
107
            this.file = file;
108
            this.min = (int[]) min.clone();
109
            this.max = (int[]) max.clone();
110
            this.secMin = (int[]) secMin.clone();
111
            this.secMax = (int[]) secMax.clone();
112
        }
113
    }
114
}