gvsig-raster / org.gvsig.raster / tags / 2.0.0 / org.gvsig.raster.lib / org.gvsig.raster.lib.impl / src / main / java / org / gvsig / raster / impl / grid / filter / histogramMatching / HistogramMatchingByteFilter.java @ 1708
History | View | Annotate | Download (2.11 KB)
1 | 30 | nbrodin | /* gvSIG. Geographic Information System of the Valencian Government
|
---|---|---|---|
2 | *
|
||
3 | * Copyright (C) 2007-2008 Infrastructures and Transports Department
|
||
4 | * of the Valencian Government (CIT)
|
||
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., 51 Franklin Street, Fifth Floor, Boston,
|
||
19 | * MA 02110-1301, USA.
|
||
20 | *
|
||
21 | */
|
||
22 | package org.gvsig.raster.impl.grid.filter.histogramMatching; |
||
23 | |||
24 | |||
25 | 55 | nbrodin | import org.gvsig.fmap.dal.coverage.dataset.Buffer; |
26 | 30 | nbrodin | |
27 | /**
|
||
28 | * Filtro para la aplicaci?n de HistogramMatching a un raster de tipo byte.
|
||
29 | *
|
||
30 | * @author aMu?oz (alejandro.munoz@uclm.es)
|
||
31 | * @version 27-5-2008
|
||
32 | *
|
||
33 | * */
|
||
34 | |||
35 | public class HistogramMatchingByteFilter extends HistogramMatchingFilter { |
||
36 | |||
37 | /**
|
||
38 | * Filtro de Histogram Matching par imagenes de tipo byte
|
||
39 | * */
|
||
40 | 239 | nbrodin | public HistogramMatchingByteFilter() {
|
41 | 30 | nbrodin | super();
|
42 | } |
||
43 | |||
44 | /**
|
||
45 | * Ejecucion del filtro tipo byte
|
||
46 | * */
|
||
47 | public void process(int x, int y) { |
||
48 | int index = 0; |
||
49 | 239 | nbrodin | for(int band = 0; band < rasterResult.getBandCount(); band++) { |
50 | 30 | nbrodin | int data= (int) (raster.getElemByte(y,x,band)); |
51 | index = data & 0xff;
|
||
52 | rasterResult.setElem(y,x,band,(byte)tableAsign[band][index]);
|
||
53 | } |
||
54 | } |
||
55 | |||
56 | /**
|
||
57 | * @return tipo de dato del buffer de entrada
|
||
58 | * */
|
||
59 | |||
60 | public int getInRasterDataType() { |
||
61 | return Buffer.TYPE_BYTE; |
||
62 | } |
||
63 | |||
64 | |||
65 | /**
|
||
66 | * @return tipo de dato del buffer de salida
|
||
67 | * */
|
||
68 | public int getOutRasterDataType() { |
||
69 | return Buffer.TYPE_BYTE; |
||
70 | } |
||
71 | |||
72 | |||
73 | /**
|
||
74 | * @return buffer resultante tras aplicar el filtro
|
||
75 | * */
|
||
76 | public Object getResult(String name) { |
||
77 | if (name.equals("raster")) |
||
78 | return rasterResult;
|
||
79 | return null; |
||
80 | } |
||
81 | |||
82 | } // Fin de la clase |