svn-gvsig-desktop / trunk / libraries / libRaster / src / org / gvsig / raster / grid / filter / enhancement / LinearEnhancementShortFilter.java @ 11067
History | View | Annotate | Download (2.34 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.gvsig.raster.grid.filter.enhancement; |
25 |
|
26 |
import org.gvsig.raster.dataset.IBuffer; |
27 |
|
28 |
/**
|
29 |
* Realzado Lineal (Amplitude Rescaling) para imagenes de 16 bits.
|
30 |
* @author Luis W. Sevilla (sevilla_lui@gva.es)
|
31 |
* @author Nacho Brodin (nachobrodin@gmail.com)
|
32 |
*/
|
33 |
public class LinearEnhancementShortFilter extends LinearEnhancementFilter { |
34 |
/**
|
35 |
* Constructor
|
36 |
*/
|
37 |
public LinearEnhancementShortFilter() {
|
38 |
super();
|
39 |
} |
40 |
|
41 |
/* (non-Javadoc)
|
42 |
* @see org.cresques.io.raster.IRasterFilter#pre()
|
43 |
*/
|
44 |
public void pre() { |
45 |
super.pre();
|
46 |
} |
47 |
|
48 |
/* (non-Javadoc)
|
49 |
* @see org.cresques.io.raster.IRasterFilter#process(int, int)
|
50 |
*/
|
51 |
public void process(int col, int line) { |
52 |
for (int iBand = 0; iBand < nbands; iBand ++) { |
53 |
short p = raster.getElemShort(line, col, iBand);
|
54 |
if (p > maxBandValue[iBand])
|
55 |
p = (short)maxBandValue[iBand];
|
56 |
else if (p < minBandValue[iBand]) |
57 |
p = (short)minBandValue[iBand];
|
58 |
|
59 |
p = (short)(((short) ((((double) p) * scale[iBand]) + offset[iBand])) & 0xff); |
60 |
rasterResult.setElem(line, col, iBand, (byte)p);
|
61 |
} |
62 |
} |
63 |
|
64 |
/* (non-Javadoc)
|
65 |
* @see org.cresques.io.raster.IRasterFilter#getInRasterDataType()
|
66 |
*/
|
67 |
public int getInRasterDataType() { |
68 |
return IBuffer.TYPE_SHORT;
|
69 |
} |
70 |
|
71 |
/* (non-Javadoc)
|
72 |
* @see org.cresques.io.raster.IRasterFilter#post()
|
73 |
*/
|
74 |
public void post() { |
75 |
} |
76 |
} |