root / branches / piloto3d / libraries / libCq CMS for java.old / src / org / cresques / filter / bands / RemoveBandsShortFilter.java @ 9523
History | View | Annotate | Download (3.22 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.cresques.filter.bands; |
25 |
|
26 |
import java.awt.image.BufferedImage; |
27 |
|
28 |
import org.cresques.io.data.RasterBuf; |
29 |
|
30 |
|
31 |
/**
|
32 |
* Proceso del filtro de recorte de colas aplicado a im?genes 16 bits
|
33 |
* @author Nacho Brodin (brodin_ign@gva.es)
|
34 |
*
|
35 |
*/
|
36 |
public class RemoveBandsShortFilter extends RemoveBandsFilter { |
37 |
private short[] px = new short[4]; |
38 |
|
39 |
public RemoveBandsShortFilter() {
|
40 |
} |
41 |
|
42 |
/* (non-Javadoc)
|
43 |
* @see org.cresques.io.raster.IRasterFilter#pre()
|
44 |
*/
|
45 |
public void pre() { |
46 |
//Obtenci?n de par?metros
|
47 |
this.raster = (RasterBuf) params.get("raster"); |
48 |
height = raster.getHeight(); |
49 |
width = raster.getWidth(); |
50 |
super.pre();
|
51 |
} |
52 |
|
53 |
/* (non-Javadoc)
|
54 |
* @see org.cresques.io.raster.IRasterFilter#process(int, int)
|
55 |
*/
|
56 |
public void process(int col, int line) { |
57 |
raster.getElemShort(line, col, px); |
58 |
px[0] = (short)(px[0] & m1); |
59 |
px[1] = (short)(px[1] & m2); |
60 |
px[2] = (short)(px[2] & m3); |
61 |
raster.setElemShort(line, col, px); |
62 |
} |
63 |
|
64 |
/* (non-Javadoc)
|
65 |
* @see org.cresques.io.raster.IRasterFilter#processSuperSampling(int, int)
|
66 |
*/
|
67 |
public void processSuperSampling(int col, int line) { |
68 |
raster.getElemShort(line, col, px); |
69 |
px[0] = (short)(px[0] & m1); |
70 |
px[1] = (short)(px[1] & m2); |
71 |
px[2] = (short)(px[2] & m3); |
72 |
for(int j = col; j < raster.getWidth() && j < (col + stepX[contX + 1]); j++) |
73 |
for(int i = line; i < raster.getHeight() && i < (line + stepY[contY + 1]); i++) |
74 |
raster.setElemShort(i, j, px); |
75 |
} |
76 |
|
77 |
/* (non-Javadoc)
|
78 |
* @see org.cresques.io.raster.IRasterFilter#getInRasterDataType()
|
79 |
*/
|
80 |
public int getInRasterDataType() { |
81 |
return RasterBuf.TYPE_SHORT;
|
82 |
} |
83 |
|
84 |
/* (non-Javadoc)
|
85 |
* @see org.cresques.io.raster.IRasterFilter#getOutRasterDataType()
|
86 |
*/
|
87 |
public int getOutRasterDataType() { |
88 |
return RasterBuf.TYPE_SHORT;
|
89 |
} |
90 |
|
91 |
/* (non-Javadoc)
|
92 |
* @see org.cresques.io.raster.RasterFilter#processLine(int)
|
93 |
*/
|
94 |
public void processLine(int y) { |
95 |
} |
96 |
|
97 |
/* (non-Javadoc)
|
98 |
* @see org.cresques.io.raster.IRasterFilter#getResult(java.lang.String)
|
99 |
*/
|
100 |
public Object getResult(String name) { |
101 |
if (name.equals("raster")) { |
102 |
return (Object) this.image; |
103 |
} else {
|
104 |
return null; |
105 |
} |
106 |
} |
107 |
|
108 |
public void post() { |
109 |
super.post();
|
110 |
} |
111 |
} |