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