root / trunk / libraries / libRaster / src / org / gvsig / raster / grid / filter / enhancement / ContrastDoubleFilter.java @ 12122
History | View | Annotate | Download (2.23 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 |
package org.gvsig.raster.grid.filter.enhancement; |
20 |
|
21 |
import org.gvsig.raster.buffer.RasterBuffer; |
22 |
import org.gvsig.raster.dataset.IBuffer; |
23 |
/**
|
24 |
* Filtro de contraste para tipo de datos double.
|
25 |
*
|
26 |
* @author Miguel ?ngel Querol Carratal? (miguelangel.querol@iver.es)
|
27 |
*/
|
28 |
public class ContrastDoubleFilter extends ContrastFilter { |
29 |
/**
|
30 |
* Constructor. Llama al constructor de la clase
|
31 |
* padre.
|
32 |
*/
|
33 |
public ContrastDoubleFilter() {
|
34 |
super();
|
35 |
} |
36 |
|
37 |
/*
|
38 |
* (non-Javadoc)
|
39 |
* @see org.gvsig.raster.grid.filter.enhancement.ContrastFilter#pre()
|
40 |
*/
|
41 |
public void pre() { |
42 |
super.pre();
|
43 |
rasterResult = RasterBuffer.getBuffer(IBuffer.TYPE_DOUBLE, raster.getWidth(), raster.getHeight(), raster.getBandCount(), true);
|
44 |
} |
45 |
|
46 |
/*
|
47 |
* (non-Javadoc)
|
48 |
* @see org.gvsig.raster.grid.filter.enhancement.ContrastFilter#process(int, int)
|
49 |
*/
|
50 |
public void process(int col, int line) { |
51 |
for (int i = 0; i < raster.getBandCount(); i++) |
52 |
rasterResult.setElem(line, col, i, |
53 |
(double) calcContrast((int) raster.getElemDouble(line, col, i) & 0xff) |
54 |
); |
55 |
} |
56 |
|
57 |
/*
|
58 |
* (non-Javadoc)
|
59 |
* @see org.gvsig.raster.grid.filter.enhancement.ContrastFilter#getInRasterDataType()
|
60 |
*/
|
61 |
public int getInRasterDataType() { |
62 |
return RasterBuffer.TYPE_DOUBLE;
|
63 |
} |
64 |
|
65 |
/*
|
66 |
* (non-Javadoc)
|
67 |
* @see org.gvsig.raster.grid.filter.enhancement.ContrastFilter#getOutRasterDataType()
|
68 |
*/
|
69 |
public int getOutRasterDataType() { |
70 |
return RasterBuffer.TYPE_DOUBLE;
|
71 |
} |
72 |
} |