svn-gvsig-desktop / trunk / libraries / libRaster / src / org / gvsig / raster / grid / filter / enhancement / ContrastFilter.java @ 11672
History | View | Annotate | Download (2.76 KB)
1 |
/* gvSIG. Sistema de Informaci?n Geogr?fica de la Generalitat Valenciana
|
---|---|
2 |
*
|
3 |
* Copyright (C) 2004 IVER T.I. 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 |
|
20 |
package org.gvsig.raster.grid.filter.enhancement; |
21 |
|
22 |
import org.gvsig.raster.dataset.Params; |
23 |
import org.gvsig.raster.grid.filter.RasterFilter; |
24 |
|
25 |
/**
|
26 |
* Clase base para todos los filtros de contraste
|
27 |
* @author Miguel ?ngel Querol Carratal? (miguelangel.querol@iver.es)
|
28 |
*
|
29 |
*/
|
30 |
public abstract class ContrastFilter extends RasterFilter{ |
31 |
|
32 |
public static String genericName = "contrast"; |
33 |
|
34 |
/**
|
35 |
* Variable que contendra el incremento del contraste.
|
36 |
*/
|
37 |
int incrContraste = 0; |
38 |
|
39 |
/**
|
40 |
* Valor que toma el pixel despues de aplicarle el algoritmo de
|
41 |
* mejora del contraste.
|
42 |
*/
|
43 |
int result = 0; |
44 |
|
45 |
|
46 |
/**
|
47 |
* Constructor
|
48 |
*/
|
49 |
public ContrastFilter(){
|
50 |
super();
|
51 |
super.fName = genericName;
|
52 |
} |
53 |
|
54 |
public void pre() { |
55 |
} |
56 |
|
57 |
public void post() { |
58 |
} |
59 |
|
60 |
/**
|
61 |
* Obtiene el incremento de contraster que se est? aplicando
|
62 |
* @return entero que representa el incremento de contraste aplicado.
|
63 |
*/
|
64 |
public int getContrastIncrease(){ |
65 |
return this.incrContraste; |
66 |
} |
67 |
|
68 |
/*
|
69 |
* (non-Javadoc)
|
70 |
* @see org.gvsig.raster.grid.filter.RasterFilter#getName()
|
71 |
*/
|
72 |
public String getName() { |
73 |
return genericName;
|
74 |
} |
75 |
|
76 |
/*
|
77 |
* (non-Javadoc)
|
78 |
* @see org.gvsig.raster.grid.filter.IRasterFilter#getGroup()
|
79 |
*/
|
80 |
public String getGroup() { |
81 |
return "basics"; |
82 |
} |
83 |
|
84 |
|
85 |
/*
|
86 |
* (non-Javadoc)
|
87 |
* @see org.gvsig.raster.grid.filter.IRasterFilter#getParams()
|
88 |
*/
|
89 |
public Params getParams() {
|
90 |
Params params = new Params();
|
91 |
params.setParam("Contrast",
|
92 |
incrContraste + "",
|
93 |
Params.SLIDER, |
94 |
new String[]{ "0", "255", "50", "1", "25" }); //min, max, valor defecto, intervalo peque?o, intervalo grande; |
95 |
return params;
|
96 |
} |
97 |
|
98 |
/*
|
99 |
* (non-Javadoc)
|
100 |
* @see org.gvsig.raster.grid.filter.IRasterFilter#setParams(org.gvsig.raster.dataset.Params)
|
101 |
*/
|
102 |
public void setParams(Params value) { |
103 |
for (int i=0; i<value.getNumParams(); i++) { |
104 |
if (value.getParam(i).id.equals("Contrast")) |
105 |
addParam("incrContraste", new Integer(Integer.parseInt(value.getParam(i).defaultValue))); |
106 |
} |
107 |
} |
108 |
} |