root / trunk / libraries / libCq_CMS_praster / src / org / cresques / filter / statistics / PercentTailTrimImageFilter.java @ 8026
History | View | Annotate | Download (2.8 KB)
1 | 8026 | nacho | /*
|
---|---|---|---|
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.statistics; |
||
25 | |||
26 | import java.awt.Image; |
||
27 | import java.awt.image.BufferedImage; |
||
28 | |||
29 | import org.cresques.io.data.RasterBuf; |
||
30 | |||
31 | |||
32 | /**
|
||
33 | * Proceso del filtro de recorte de colas aplicado a objetos Image
|
||
34 | * @author Nacho Brodin (brodin_ign@gva.es)
|
||
35 | *
|
||
36 | */
|
||
37 | public class PercentTailTrimImageFilter extends PercentTailTrimFilter { |
||
38 | public PercentTailTrimImageFilter() {
|
||
39 | } |
||
40 | |||
41 | /**
|
||
42 | * Obtiene par?metros para el filtro y obtiene el ancho y alto de
|
||
43 | * la imagen sobre la que se aplica el filtro
|
||
44 | */
|
||
45 | public void pre() { |
||
46 | //Obtenci?n de par?metros
|
||
47 | this.image = (Image) params.get("raster"); |
||
48 | height = image.getHeight(null);
|
||
49 | width = image.getWidth(null);
|
||
50 | super.pre();
|
||
51 | } |
||
52 | |||
53 | /**
|
||
54 | * Carga sobre el vector de muestras los valores de estas cogidos
|
||
55 | * de la imagen
|
||
56 | */
|
||
57 | public void process(int col, int line) { |
||
58 | int pt = ((BufferedImage) image).getRGB(col, line); |
||
59 | sample[0][count] = ((pt & 0xff0000) >> 16) & 0xff; |
||
60 | sample[1][count] = ((pt & 0xff00) >> 8) & 0xff; |
||
61 | sample[2][count] = (pt & 0xff); |
||
62 | count++; |
||
63 | } |
||
64 | |||
65 | /* (non-Javadoc)
|
||
66 | * @see org.cresques.io.raster.IRasterFilter#processSuperSampling(int, int)
|
||
67 | */
|
||
68 | public void processSuperSampling(int col, int line) { |
||
69 | process(col, line); |
||
70 | } |
||
71 | |||
72 | /* (non-Javadoc)
|
||
73 | * @see org.cresques.io.raster.IRasterFilter#getInRasterDataType()
|
||
74 | */
|
||
75 | public int getInRasterDataType() { |
||
76 | return RasterBuf.TYPE_IMAGE;
|
||
77 | } |
||
78 | |||
79 | /* (non-Javadoc)
|
||
80 | * @see org.cresques.io.raster.IRasterFilter#getOutRasterDataType()
|
||
81 | */
|
||
82 | public int getOutRasterDataType() { |
||
83 | return RasterBuf.TYPE_IMAGE;
|
||
84 | } |
||
85 | |||
86 | /* (non-Javadoc)
|
||
87 | * @see org.cresques.io.raster.RasterFilter#processLine(int)
|
||
88 | */
|
||
89 | public void processLine(int y) { |
||
90 | } |
||
91 | |||
92 | /* (non-Javadoc)
|
||
93 | * @see org.cresques.io.raster.IRasterFilter#post()
|
||
94 | */
|
||
95 | public void post() { |
||
96 | super.post();
|
||
97 | } |
||
98 | } |