001: /*
002: * GeoTools - OpenSource mapping toolkit
003: * http://geotools.org
004: * (C) 2005-2006, Geotools Project Managment Committee (PMC)
005: * (C) 2005, Institut de Recherche pour le Développement
006: *
007: * This library is free software; you can redistribute it and/or
008: * modify it under the terms of the GNU Lesser General Public
009: * License as published by the Free Software Foundation; either
010: * version 2.1 of the License, or (at your option) any later version.
011: *
012: * This library is distributed in the hope that it will be useful,
013: * but WITHOUT ANY WARRANTY; without even the implied warranty of
014: * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
015: * Lesser General Public License for more details.
016: */
017: package org.geotools.coverage.processing.operation;
018:
019: // JAI dependencies (for javadoc)
020: import javax.media.jai.operator.RescaleDescriptor;
021:
022: // Geotools dependencies
023: import org.geotools.util.NumberRange;
024: import org.geotools.coverage.processing.OperationJAI;
025:
026: /**
027: * Maps the sample values of a coverage from one range to another range. The rescaling is done by
028: * multiplying each sample value by one of a set of constants and then adding another constant to
029: * the result of the multiplication. The destination sample values are defined by the pseudocode:
030: *
031: * <BLOCKQUOTE><CODE>
032: * dst[<var>x</var>][<var>y</var>][<var>b</var>] =
033: * src[<var>x</var>][<var>y</var>][<var>b</var>]*<strong>constant</strong> + <strong>offset</strong>;
034: * </CODE></BLOCKQUOTE>
035: *
036: * <P><STRONG>Name:</STRONG> <CODE>"Rescale"</CODE><BR>
037: * <STRONG>JAI operator:</STRONG> <CODE>"{@linkplain RescaleDescriptor Rescale}"</CODE><BR>
038: * <STRONG>Parameters:</STRONG></P>
039: * <table border='3' cellpadding='6' bgcolor='F4F8FF'>
040: * <tr bgcolor='#B9DCFF'>
041: * <th>Name</th>
042: * <th>Class</th>
043: * <th>Default value</th>
044: * <th>Minimum value</th>
045: * <th>Maximum value</th>
046: * </tr>
047: * <tr>
048: * <td>{@code "Source"}</td>
049: * <td>{@link org.geotools.coverage.grid.GridCoverage2D}</td>
050: * <td align="center">N/A</td>
051: * <td align="center">N/A</td>
052: * <td align="center">N/A</td>
053: * </tr>
054: * <tr>
055: * <td>{@code "constants"}</td>
056: * <td><code>double[]</code></td>
057: * <td align="center">1.0</td>
058: * <td align="center">N/A</td>
059: * <td align="center">N/A</td>
060: * </tr>
061: * <tr>
062: * <td>{@code "offsets"}</td>
063: * <td><code>double[]</code></td>
064: * <td align="center">0.0</td>
065: * <td align="center">N/A</td>
066: * <td align="center">N/A</td>
067: * </tr>
068: * </table>
069: *
070: * @since 2.2
071: * @source $URL: http://svn.geotools.org/geotools/tags/2.4.1/modules/library/coverage/src/main/java/org/geotools/coverage/processing/operation/Rescale.java $
072: * @version $Id: Rescale.java 20970 2006-08-11 07:53:22Z jgarnett $
073: * @author Martin Desruisseaux
074: *
075: * @see org.geotools.coverage.processing.Operations#rescale
076: * @see RescaleDescriptor
077: *
078: * @todo Should operates on {@code sampleToGeophysics} transform when possible.
079: * See <A HREF="http://jira.codehaus.org/browse/GEOT-610">GEOT-610</A>.
080: */
081: public class Rescale extends OperationJAI {
082: /**
083: * Serial number for interoperability with different versions.
084: */
085: private static final long serialVersionUID = -9150531690336265741L;
086:
087: /**
088: * Constructs a default {@code "Rescale"} operation.
089: */
090: public Rescale() {
091: super ("Rescale");
092: }
093:
094: /**
095: * Returns the expected range of values for the resulting image.
096: *
097: * @todo Not yet implemented.
098: */
099: protected NumberRange deriveRange(final NumberRange[] ranges,
100: final Parameters parameters) {
101: return super.deriveRange(ranges, parameters);
102: }
103: }
|