Statistics
| Revision:

svn-gvsig-desktop / trunk / libraries / libRaster / src / org / gvsig / raster / grid / filter / enhancement / LinearEnhancementShortFilter.java @ 11183

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
/**
30
 * Realzado Lineal (Amplitude Rescaling) para imagenes de 16 bits.
31
 * @author Luis W. Sevilla (sevilla_lui@gva.es)
32
 * @author Nacho Brodin (nachobrodin@gmail.com)
33
 */
34
public class LinearEnhancementShortFilter extends LinearEnhancementFilter {        
35
    /**
36
     * Constructor
37
     */
38
    public LinearEnhancementShortFilter() {
39
        super();
40
    }
41

    
42
    /* (non-Javadoc)
43
     * @see org.cresques.io.raster.IRasterFilter#pre()
44
     */
45
    public void pre() {
46
        super.pre();
47
    }
48

    
49
    /* (non-Javadoc)
50
     * @see org.cresques.io.raster.IRasterFilter#process(int, int)
51
     */
52
    public void process(int col, int line) {
53
        for (int iBand = 0; iBand < nbands; iBand ++) {
54
                short p = raster.getElemShort(line, col, iBand);
55
            if (p > maxBandValue[iBand])
56
                p = (short)maxBandValue[iBand];
57
            else if (p < minBandValue[iBand])
58
                p = (short)minBandValue[iBand];
59
           
60
            p = (short)(((short) ((((double) p) * scale[iBand]) + offset[iBand])) & 0xff);
61
            rasterResult.setElem(line, col, iBand, (byte)p);
62
        }
63
    }
64

    
65
    /* (non-Javadoc)
66
     * @see org.cresques.io.raster.IRasterFilter#getInRasterDataType()
67
     */
68
    public int getInRasterDataType() {
69
        return IBuffer.TYPE_SHORT;
70
    }
71

    
72
    /* (non-Javadoc)
73
     * @see org.cresques.io.raster.IRasterFilter#post()
74
     */
75
    public void post() {
76
    }
77
}