01: /*
02: * Geotools 2 - OpenSource mapping toolkit
03: * (C) 2005, Geotools Project Management Committee (PMC)
04: * (C) 2005, Institut de Recherche pour le Développement
05: *
06: * This library is free software; you can redistribute it and/or
07: * modify it under the terms of the GNU Lesser General Public
08: * License as published by the Free Software Foundation; either
09: * version 2.1 of the License, or (at your option) any later version.
10: *
11: * This library 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 GNU
14: * Lesser General Public License for more details.
15: *
16: * You should have received a copy of the GNU Lesser General Public
17: * License along with this library; if not, write to the Free Software
18: * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
19: */
20: package org.geotools.coverage.processing.operation;
21:
22: // JAI dependencies (for javadoc)
23: import javax.media.jai.operator.LogDescriptor;
24:
25: // Geotools dependencies
26: import org.geotools.util.NumberRange;
27: import org.geotools.coverage.processing.OperationJAI;
28:
29: /**
30: * Takes the natural logarithm of the sample values of a coverage.
31: *
32: * <P><STRONG>Name:</STRONG> <CODE>"Log"</CODE><BR>
33: * <STRONG>JAI operator:</STRONG> <CODE>"{@linkplain LogDescriptor Log}"</CODE><BR>
34: * <STRONG>Parameters:</STRONG></P>
35: * <table border='3' cellpadding='6' bgcolor='F4F8FF'>
36: * <tr bgcolor='#B9DCFF'>
37: * <th>Name</th>
38: * <th>Class</th>
39: * <th>Default value</th>
40: * <th>Minimum value</th>
41: * <th>Maximum value</th>
42: * </tr>
43: * <tr>
44: * <td>{@code "Source"}</td>
45: * <td>{@link org.geotools.coverage.grid.GridCoverage2D}</td>
46: * <td align="center">N/A</td>
47: * <td align="center">N/A</td>
48: * <td align="center">N/A</td>
49: * </tr>
50: * </table>
51: *
52: * @since 2.2
53: * @source $URL: http://svn.geotools.org/geotools/tags/2.4.1/modules/library/coverage/src/main/java/org/geotools/coverage/processing/operation/Log.java $
54: * @version $Id: Log.java 17672 2006-01-19 00:25:55Z desruisseaux $
55: * @author Martin Desruisseaux
56: *
57: * @see org.geotools.coverage.processing.Operations#log
58: * @see LogDescriptor
59: */
60: public class Log extends OperationJAI {
61: /**
62: * Serial number for interoperability with different versions.
63: */
64: private static final long serialVersionUID = -3622176942444895367L;
65:
66: /**
67: * Constructs a default {@code "Log"} operation.
68: */
69: public Log() {
70: super ("Log");
71: }
72:
73: /**
74: * Returns the expected range of values for the resulting image.
75: */
76: protected NumberRange deriveRange(final NumberRange[] ranges,
77: final Parameters parameters) {
78: final NumberRange range = ranges[0];
79: final double min = Math.log(range.getMinimum());
80: final double max = Math.log(range.getMaximum());
81: return new NumberRange(min, max);
82: }
83: }
|