root / trunk / libraries / libRaster / src / org / gvsig / raster / grid / filter / enhancement / LinearEnhancementShortFilter.java @ 12180
History | View | Annotate | Download (1.99 KB)
1 |
/* gvSIG. Sistema de Informaci?n Geogr?fica de la Generalitat Valenciana
|
---|---|
2 |
*
|
3 |
* Copyright (C) 2006 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.dataset.IBuffer; |
22 |
/**
|
23 |
* Filtro de realce para tipos de datos short. En el m?todo de proceso procesa
|
24 |
* un solo pixel short. Asigna su valor en relaci?n a los datos calculados en el
|
25 |
* m?todo pre() del padre.
|
26 |
*
|
27 |
* @version 11/05/2007
|
28 |
* @author Nacho Brodin (nachobrodin@gmail.com)
|
29 |
*/
|
30 |
public class LinearEnhancementShortFilter extends LinearEnhancementFilter { |
31 |
|
32 |
/*
|
33 |
* (non-Javadoc)
|
34 |
* @see org.gvsig.raster.grid.filter.enhancement.LinearEnhancementFilter#process(int, int)
|
35 |
*/
|
36 |
public void process(int col, int line) { |
37 |
for (int iBand = 0; iBand < nbands; iBand++) { |
38 |
short p = raster.getElemShort(line, col, iBand);
|
39 |
if (p > maxBandValue[iBand])
|
40 |
p = (short) maxBandValue[iBand];
|
41 |
else if (p < minBandValue[iBand]) |
42 |
p = (short) minBandValue[iBand];
|
43 |
|
44 |
p = (short) (((short) ((((double) p) * scale[iBand]) + offset[iBand])) & 0xff); |
45 |
rasterResult.setElem(line, col, iBand, (byte) p);
|
46 |
} |
47 |
} |
48 |
|
49 |
/*
|
50 |
* (non-Javadoc)
|
51 |
* @see org.gvsig.raster.grid.filter.enhancement.LinearEnhancementFilter#getInRasterDataType()
|
52 |
*/
|
53 |
public int getInRasterDataType() { |
54 |
return IBuffer.TYPE_SHORT;
|
55 |
} |
56 |
} |