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