01: /*
02: * GeoTools - OpenSource mapping toolkit
03: * http://geotools.org
04: * (C) 2003-2006, Geotools Project Managment Committee (PMC)
05: * (C) 2003, Institut de Recherche pour le Développement
06: *
07: * This library is free software; you can redistribute it and/or
08: * modify it under the terms of the GNU Lesser General Public
09: * License as published by the Free Software Foundation; either
10: * version 2.1 of the License, or (at your option) any later version.
11: *
12: * This library is distributed in the hope that it will be useful,
13: * but WITHOUT ANY WARRANTY; without even the implied warranty of
14: * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15: * Lesser General Public License for more details.
16: */
17: package org.geotools.coverage.processing;
18:
19: // OpenGIS dependencies
20: import org.opengis.coverage.processing.OperationNotFoundException;
21:
22: // Geotools dependencies
23: import org.geotools.coverage.GridSampleDimension;
24:
25: /**
26: * Common super-class for filter operation. The following is adapted from OpenGIS specification:
27: *
28: * <blockquote>
29: * Filtering is an enhancement operation that alters the grid values on the basis of the
30: * neighborhood grid values. For this reason, filtering is considered to be a spatial or
31: * area opeartion. There are many different filters that can be applied to a grid coverage
32: * but the general concept of filtering is the same. A filter window or kernel is defined,
33: * its dimension being an odd number in the <var>x</var> and <var>y</var> dimensions. Each
34: * cell in this window contains a co-efficient or weighting factor representative of some
35: * mathmetical relationship. A filtered grid coverage is generated by multipling each
36: * coefficient in the window by the grid value in the original grid coverage corresponding
37: * to the window’s current location and assigning the result to the central pixel location
38: * of the window in the filtered grid coverage. The window is moved thoughout the grid coverage
39: * on pixel at a time. This window multiplication process is known as convolution. A grid coverage
40: * contains both low and high spatial information. High frequencies describe rapid change from one
41: * grid cell to another such as roads or other boundary conditions. Low frequencies describe gradual
42: * change over a large number of cells such as water bodies. High pass filters allow only high
43: * frequency information to be generated in the new grid coverage Grid coverages generated with high
44: * pass filters will show edge conditions. Low pass filters allow low frequency information
45: * to be generated in the new grid coverage. The grid coverage produced from a filtering
46: * operation will have the same dimension as the source grid coverage. To produce filtered
47: * values around the edges of the source grid coverage, edge rows and columns will be
48: * duplicated to fill a complete kernel.
49: * </blockquote>
50: *
51: * @since 2.2
52: * @source $URL: http://svn.geotools.org/geotools/tags/2.4.1/modules/library/coverage/src/main/java/org/geotools/coverage/processing/FilterOperation.java $
53: * @version $Id: FilterOperation.java 20970 2006-08-11 07:53:22Z jgarnett $
54: * @author Martin Desruisseaux
55: */
56: public class FilterOperation extends OperationJAI {
57: /**
58: * Serial number for interoperability with different versions.
59: */
60: private static final long serialVersionUID = 7984379314515755769L;
61:
62: /**
63: * Constructs a new filter operation.
64: *
65: * @param name The JAI operation name.
66: * @throws OperationNotFoundException if no JAI descriptor was found for the given name.
67: */
68: public FilterOperation(final String name)
69: throws OperationNotFoundException {
70: super (name);
71: }
72:
73: /**
74: * Returns the target sample dimensions. Since filter operation do not change the range of
75: * values, this method returns the same sample dimension than the first source.
76: */
77: protected GridSampleDimension[] deriveSampleDimension(
78: final GridSampleDimension[][] bandLists,
79: final Parameters parameters) {
80: return bandLists[0];
81: }
82: }
|