| <!DOCTYPE HTML> |
| <html lang="en"> |
| <head> |
| <!-- Generated by javadoc (21) on Thu Oct 05 19:54:57 CEST 2023 --> |
| <title>Colorizer (Apache SIS 1.4 API)</title> |
| <meta name="viewport" content="width=device-width, initial-scale=1"> |
| <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> |
| <meta name="dc.created" content="2023-10-05"> |
| <meta name="description" content="declaration: module: org.apache.sis.feature, package: org.apache.sis.image, interface: Colorizer"> |
| <meta name="generator" content="javadoc/ClassWriterImpl"> |
| <meta name="keywords" content="org.apache.sis.image.Colorizer interface"> |
| <meta name="keywords" content="ARGB"> |
| <meta name="keywords" content="forRange()"> |
| <meta name="keywords" content="forRanges()"> |
| <meta name="keywords" content="forCategories()"> |
| <meta name="keywords" content="forInstance()"> |
| <meta name="keywords" content="apply()"> |
| <meta name="keywords" content="orElse()"> |
| <link rel="stylesheet" type="text/css" href="../../../../../stylesheet.css" title="Style"> |
| <link rel="stylesheet" type="text/css" href="../../../../../sis.css" title="Style"> |
| <link rel="stylesheet" type="text/css" href="../../../../../script-dir/jquery-ui.min.css" title="Style"> |
| <script type="text/javascript" src="../../../../../script.js"></script> |
| <script type="text/javascript" src="../../../../../script-dir/jquery-3.6.1.min.js"></script> |
| <script type="text/javascript" src="../../../../../script-dir/jquery-ui.min.js"></script> |
| </head> |
| <body class="class-declaration-page"> |
| <script type="text/javascript">var pathtoroot = "../../../../../"; |
| loadScripts(document, 'script');</script> |
| <noscript> |
| <div>JavaScript is disabled on your browser.</div> |
| </noscript> |
| <div class="flex-box"> |
| <header role="banner" class="flex-header"> |
| <nav role="navigation"> |
| <!-- ========= START OF TOP NAVBAR ======= --> |
| <div class="top-nav" id="navbar-top"><button id="navbar-toggle-button" aria-controls="navbar-top" aria-expanded="false" aria-label="Toggle navigation links"><span class="nav-bar-toggle-icon"> </span><span class="nav-bar-toggle-icon"> </span><span class="nav-bar-toggle-icon"> </span></button> |
| <div class="skip-nav"><a href="#skip-navbar-top" title="Skip navigation links">Skip navigation links</a></div> |
| <ul id="navbar-top-firstrow" class="nav-list" title="Navigation"> |
| <li><a href="../../../../../index.html">Overview</a></li> |
| <li><a href="../../../../module-summary.html">Module</a></li> |
| <li><a href="package-summary.html">Package</a></li> |
| <li class="nav-bar-cell1-rev">Class</li> |
| <li><a href="package-tree.html">Tree</a></li> |
| <li><a href="../../../../../deprecated-list.html">Deprecated</a></li> |
| <li><a href="../../../../../index-all.html">Index</a></li> |
| <li><a href="../../../../../help-doc.html#class">Help</a></li> |
| </ul> |
| <ul class="sub-nav-list-small"> |
| <li> |
| <p>Summary:</p> |
| <ul> |
| <li><a href="#nested-class-summary">Nested</a></li> |
| <li><a href="#field-summary">Field</a></li> |
| <li>Constr</li> |
| <li><a href="#method-summary">Method</a></li> |
| </ul> |
| </li> |
| <li> |
| <p>Detail:</p> |
| <ul> |
| <li><a href="#field-detail">Field</a></li> |
| <li>Constr</li> |
| <li><a href="#method-detail">Method</a></li> |
| </ul> |
| </li> |
| </ul> |
| </div> |
| <div class="sub-nav"> |
| <div id="navbar-sub-list"> |
| <ul class="sub-nav-list"> |
| <li>Summary: </li> |
| <li><a href="#nested-class-summary">Nested</a> | </li> |
| <li><a href="#field-summary">Field</a> | </li> |
| <li>Constr | </li> |
| <li><a href="#method-summary">Method</a></li> |
| </ul> |
| <ul class="sub-nav-list"> |
| <li>Detail: </li> |
| <li><a href="#field-detail">Field</a> | </li> |
| <li>Constr | </li> |
| <li><a href="#method-detail">Method</a></li> |
| </ul> |
| </div> |
| <div class="nav-list-search"><a href="../../../../../search.html">SEARCH</a> |
| <input type="text" id="search-input" disabled placeholder="Search"> |
| <input type="reset" id="reset-button" disabled value="reset"> |
| </div> |
| </div> |
| <!-- ========= END OF TOP NAVBAR ========= --> |
| <span class="skip-nav" id="skip-navbar-top"></span></nav> |
| </header> |
| <div class="flex-content"> |
| <main role="main"> |
| <!-- ======== START OF CLASS DATA ======== --> |
| <div class="header"> |
| <div class="sub-title"><span class="module-label-in-type">Module</span> <a href="../../../../module-summary.html">org.apache.sis.feature</a></div> |
| <div class="sub-title"><span class="package-label-in-type">Package</span> <a href="package-summary.html">org.apache.sis.image</a></div> |
| <h1 title="Interface Colorizer" class="title">Interface Colorizer</h1> |
| </div> |
| <section class="class-description" id="class-description"> |
| <dl class="notes"> |
| <dt>All Superinterfaces:</dt> |
| <dd><code><a href="https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/util/function/Function.html" title="class or interface in java.util.function" class="external-link">Function</a><<a href="Colorizer.Target.html" title="class in org.apache.sis.image">Colorizer.Target</a>,<wbr><a href="https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/util/Optional.html" title="class or interface in java.util" class="external-link">Optional</a><<a href="https://docs.oracle.com/en/java/javase/11/docs/api/java.desktop/java/awt/image/ColorModel.html" title="class or interface in java.awt.image" class="external-link">ColorModel</a>>></code></dd> |
| </dl> |
| <hr> |
| <div class="type-signature"><span class="modifiers">public interface </span><span class="element-name type-name-label">Colorizer</span><span class="extends-implements"> |
| extends <a href="https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/util/function/Function.html" title="class or interface in java.util.function" class="external-link">Function</a><<a href="Colorizer.Target.html" title="class in org.apache.sis.image">Colorizer.Target</a>,<wbr><a href="https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/util/Optional.html" title="class or interface in java.util" class="external-link">Optional</a><<a href="https://docs.oracle.com/en/java/javase/11/docs/api/java.desktop/java/awt/image/ColorModel.html" title="class or interface in java.awt.image" class="external-link">ColorModel</a>>></span></div> |
| <div class="block">Colorization algorithm to apply for colorizing a computed image. |
| The <a href="#apply(org.apache.sis.image.Colorizer.Target)"><code>apply(Target)</code></a> method is invoked when <a href="ImageProcessor.html" title="class in org.apache.sis.image"><code>ImageProcessor</code></a> needs a new color model for |
| the computation result. The <a href="Colorizer.Target.html" title="class in org.apache.sis.image"><code>Colorizer.Target</code></a> argument contains information about the image to colorize, |
| in particular the <a href="https://docs.oracle.com/en/java/javase/11/docs/api/java.desktop/java/awt/image/SampleModel.html" title="class or interface in java.awt.image" class="external-link"><code>SampleModel</code></a> of the computed image. The colorization result is optional, |
| i.e. the <code>apply(Target)</code> method may return an empty value if it does not support the target. |
| In the latter case the caller will fallback on a default color model, typically a grayscale. |
| |
| <p>Constants or static methods in this interface provide colorizers for common cases. |
| For example <a href="#ARGB"><code>ARGB</code></a> interprets image bands as Red, Green, Blue and optionally Alpha channels. |
| Colorizers can be chained with <a href="#orElse(org.apache.sis.image.Colorizer)"><code>orElse(Colorizer)</code></a> for trying different strategies until one succeeds.</p></div> |
| <dl class="notes"> |
| <dt>Since:</dt> |
| <dd>1.4</dd> |
| </dl> |
| </section> |
| <section class="summary"> |
| <ul class="summary-list"> |
| <!-- ======== NESTED CLASS SUMMARY ======== --> |
| <li> |
| <section class="nested-class-summary" id="nested-class-summary"> |
| <h2>Nested Class Summary</h2> |
| <div class="caption"><span>Nested Classes</span></div> |
| <div class="summary-table three-column-summary"> |
| <div class="table-header col-first">Modifier and Type</div> |
| <div class="table-header col-second">Interface</div> |
| <div class="table-header col-last">Description</div> |
| <div class="col-first even-row-color"><code>static class </code></div> |
| <div class="col-second even-row-color"><code><a href="Colorizer.Target.html" class="type-name-link" title="class in org.apache.sis.image">Colorizer.Target</a></code></div> |
| <div class="col-last even-row-color"> |
| <div class="block">Information about the computed image to colorize.</div> |
| </div> |
| </div> |
| </section> |
| </li> |
| <!-- =========== FIELD SUMMARY =========== --> |
| <li> |
| <section class="field-summary" id="field-summary"> |
| <h2>Field Summary</h2> |
| <div class="caption"><span>Fields</span></div> |
| <div class="summary-table three-column-summary"> |
| <div class="table-header col-first">Modifier and Type</div> |
| <div class="table-header col-second">Field</div> |
| <div class="table-header col-last">Description</div> |
| <div class="col-first even-row-color"><code>static final <a href="Colorizer.html" title="interface in org.apache.sis.image">Colorizer</a></code></div> |
| <div class="col-second even-row-color"><code><a href="#ARGB" class="member-name-link">ARGB</a></code></div> |
| <div class="col-last even-row-color"> |
| <div class="block">RGB(A) color model for images storing 8 bits integer on 3 or 4 bands.</div> |
| </div> |
| </div> |
| </section> |
| </li> |
| <!-- ========== METHOD SUMMARY =========== --> |
| <li> |
| <section class="method-summary" id="method-summary"> |
| <h2>Method Summary</h2> |
| <div id="method-summary-table"> |
| <div class="table-tabs" role="tablist" aria-orientation="horizontal"><button id="method-summary-table-tab0" role="tab" aria-selected="true" aria-controls="method-summary-table.tabpanel" tabindex="0" onkeydown="switchTab(event)" onclick="show('method-summary-table', 'method-summary-table', 3)" class="active-table-tab">All Methods</button><button id="method-summary-table-tab1" role="tab" aria-selected="false" aria-controls="method-summary-table.tabpanel" tabindex="-1" onkeydown="switchTab(event)" onclick="show('method-summary-table', 'method-summary-table-tab1', 3)" class="table-tab">Static Methods</button><button id="method-summary-table-tab2" role="tab" aria-selected="false" aria-controls="method-summary-table.tabpanel" tabindex="-1" onkeydown="switchTab(event)" onclick="show('method-summary-table', 'method-summary-table-tab2', 3)" class="table-tab">Instance Methods</button><button id="method-summary-table-tab3" role="tab" aria-selected="false" aria-controls="method-summary-table.tabpanel" tabindex="-1" onkeydown="switchTab(event)" onclick="show('method-summary-table', 'method-summary-table-tab3', 3)" class="table-tab">Abstract Methods</button><button id="method-summary-table-tab5" role="tab" aria-selected="false" aria-controls="method-summary-table.tabpanel" tabindex="-1" onkeydown="switchTab(event)" onclick="show('method-summary-table', 'method-summary-table-tab5', 3)" class="table-tab">Default Methods</button></div> |
| <div id="method-summary-table.tabpanel" role="tabpanel"> |
| <div class="summary-table three-column-summary" aria-labelledby="method-summary-table-tab0"> |
| <div class="table-header col-first">Modifier and Type</div> |
| <div class="table-header col-second">Method</div> |
| <div class="table-header col-last">Description</div> |
| <div class="col-first even-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab3"><code><a href="https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/util/Optional.html" title="class or interface in java.util" class="external-link">Optional</a><wbr><<a href="https://docs.oracle.com/en/java/javase/11/docs/api/java.desktop/java/awt/image/ColorModel.html" title="class or interface in java.awt.image" class="external-link">ColorModel</a>></code></div> |
| <div class="col-second even-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab3"><code><a href="#apply(org.apache.sis.image.Colorizer.Target)" class="member-name-link">apply</a><wbr>(<a href="Colorizer.Target.html" title="class in org.apache.sis.image">Colorizer.Target</a> model)</code></div> |
| <div class="col-last even-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab3"> |
| <div class="block">Returns the color model to use for an image having the given sample model.</div> |
| </div> |
| <div class="col-first odd-row-color method-summary-table method-summary-table-tab1"><code>static <a href="Colorizer.html" title="interface in org.apache.sis.image">Colorizer</a></code></div> |
| <div class="col-second odd-row-color method-summary-table method-summary-table-tab1"><code><a href="#forCategories(java.util.function.Function)" class="member-name-link">forCategories</a><wbr>(<a href="https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/util/function/Function.html" title="class or interface in java.util.function" class="external-link">Function</a><<a href="../coverage/Category.html" title="class in org.apache.sis.coverage">Category</a>,<wbr><a href="https://docs.oracle.com/en/java/javase/11/docs/api/java.desktop/java/awt/Color.html" title="class or interface in java.awt" class="external-link">Color</a>[]> colors)</code></div> |
| <div class="col-last odd-row-color method-summary-table method-summary-table-tab1"> |
| <div class="block">Creates a colorizer which will interpolate colors in ranges identified by categories.</div> |
| </div> |
| <div class="col-first even-row-color method-summary-table method-summary-table-tab1"><code>static <a href="Colorizer.html" title="interface in org.apache.sis.image">Colorizer</a></code></div> |
| <div class="col-second even-row-color method-summary-table method-summary-table-tab1"><code><a href="#forInstance(java.awt.image.ColorModel)" class="member-name-link">forInstance</a><wbr>(<a href="https://docs.oracle.com/en/java/javase/11/docs/api/java.desktop/java/awt/image/ColorModel.html" title="class or interface in java.awt.image" class="external-link">ColorModel</a> colors)</code></div> |
| <div class="col-last even-row-color method-summary-table method-summary-table-tab1"> |
| <div class="block">Creates a colorizer which will use the specified color model instance if compatible with the target.</div> |
| </div> |
| <div class="col-first odd-row-color method-summary-table method-summary-table-tab1"><code>static <a href="Colorizer.html" title="interface in org.apache.sis.image">Colorizer</a></code></div> |
| <div class="col-second odd-row-color method-summary-table method-summary-table-tab1"><code><a href="#forRange(double,double,java.awt.Color...)" class="member-name-link">forRange</a><wbr>(double lower, |
| double upper, |
| <a href="https://docs.oracle.com/en/java/javase/11/docs/api/java.desktop/java/awt/Color.html" title="class or interface in java.awt" class="external-link">Color</a>... colors)</code></div> |
| <div class="col-last odd-row-color method-summary-table method-summary-table-tab1"> |
| <div class="block">Creates a colorizer which will interpolate the given colors in the given range of values.</div> |
| </div> |
| <div class="col-first even-row-color method-summary-table method-summary-table-tab1"><code>static <a href="Colorizer.html" title="interface in org.apache.sis.image">Colorizer</a></code></div> |
| <div class="col-second even-row-color method-summary-table method-summary-table-tab1"><code><a href="#forRanges(java.util.Map)" class="member-name-link">forRanges</a><wbr>(<a href="https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/util/Map.html" title="class or interface in java.util" class="external-link">Map</a><<a href="../../../../../org.apache.sis.util/org/apache/sis/measure/NumberRange.html" title="class in org.apache.sis.measure">NumberRange</a><?>,<wbr><a href="https://docs.oracle.com/en/java/javase/11/docs/api/java.desktop/java/awt/Color.html" title="class or interface in java.awt" class="external-link">Color</a>[]> colors)</code></div> |
| <div class="col-last even-row-color method-summary-table method-summary-table-tab1"> |
| <div class="block">Creates a colorizer which will interpolate colors in multiple ranges of values.</div> |
| </div> |
| <div class="col-first odd-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab5"><code>default <a href="Colorizer.html" title="interface in org.apache.sis.image">Colorizer</a></code></div> |
| <div class="col-second odd-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab5"><code><a href="#orElse(org.apache.sis.image.Colorizer)" class="member-name-link">orElse</a><wbr>(<a href="Colorizer.html" title="interface in org.apache.sis.image">Colorizer</a> alternative)</code></div> |
| <div class="col-last odd-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab5"> |
| <div class="block">Returns a new colorizer which will apply the specified alternative |
| if this colorizer cannot infer a color model.</div> |
| </div> |
| </div> |
| </div> |
| </div> |
| <div class="inherited-list"> |
| <h3 id="methods-inherited-from-class-Function">Methods inherited from interface <a href="https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/util/function/Function.html" title="class or interface in java.util.function" class="external-link">Function</a></h3> |
| <code><a href="https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/util/function/Function.html#andThen(java.util.function.Function)" title="class or interface in java.util.function" class="external-link">andThen</a>, <a href="https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/util/function/Function.html#compose(java.util.function.Function)" title="class or interface in java.util.function" class="external-link">compose</a></code></div> |
| </section> |
| </li> |
| </ul> |
| </section> |
| <section class="details"> |
| <ul class="details-list"> |
| <!-- ============ FIELD DETAIL =========== --> |
| <li> |
| <section class="field-details" id="field-detail"> |
| <h2>Field Details</h2> |
| <ul class="member-list"> |
| <li> |
| <section class="detail" id="ARGB"> |
| <h3>ARGB</h3> |
| <div class="member-signature"><span class="modifiers">static final</span> <span class="return-type"><a href="Colorizer.html" title="interface in org.apache.sis.image">Colorizer</a></span> <span class="element-name">ARGB</span></div> |
| <div class="block">RGB(A) color model for images storing 8 bits integer on 3 or 4 bands. |
| The color model is RGB for image having 3 bands, or ARGB for images having 4 bands.</div> |
| </section> |
| </li> |
| </ul> |
| </section> |
| </li> |
| <!-- ============ METHOD DETAIL ========== --> |
| <li> |
| <section class="method-details" id="method-detail"> |
| <h2>Method Details</h2> |
| <ul class="member-list"> |
| <li> |
| <section class="detail" id="forRange(double,double,java.awt.Color...)"> |
| <h3>forRange</h3> |
| <div class="member-signature"><span class="modifiers">static</span> <span class="return-type"><a href="Colorizer.html" title="interface in org.apache.sis.image">Colorizer</a></span> <span class="element-name">forRange</span><wbr><span class="parameters">(double lower, |
| double upper, |
| <a href="https://docs.oracle.com/en/java/javase/11/docs/api/java.desktop/java/awt/Color.html" title="class or interface in java.awt" class="external-link">Color</a>... colors)</span></div> |
| <div class="block">Creates a colorizer which will interpolate the given colors in the given range of values. |
| When the image data type is 8 or 16 bits integer, this colorizer creates <a href="https://docs.oracle.com/en/java/javase/11/docs/api/java.desktop/java/awt/image/IndexColorModel.html" title="class or interface in java.awt.image" class="external-link"><code>IndexColorModel</code></a> instances. |
| For other kinds of data type such as floating points, |
| this colorizer creates a non-standard (and potentially slow) color model. |
| |
| <h4 id="limitations-heading">Limitations</h4> |
| In current implementation, the non-standard color model ignores the specified colors. |
| If the image data type is not 8 or 16 bits integer, the colors are always grayscale.</div> |
| <dl class="notes"> |
| <dt>Parameters:</dt> |
| <dd><code>lower</code> - the minimum sample value, inclusive.</dd> |
| <dd><code>upper</code> - the maximum sample value, exclusive.</dd> |
| <dd><code>colors</code> - the colors to use for the specified range of sample values.</dd> |
| <dt>Returns:</dt> |
| <dd>a colorizer which will interpolate the given colors in the given range of values.</dd> |
| </dl> |
| </section> |
| </li> |
| <li> |
| <section class="detail" id="forRanges(java.util.Map)"> |
| <h3>forRanges</h3> |
| <div class="member-signature"><span class="modifiers">static</span> <span class="return-type"><a href="Colorizer.html" title="interface in org.apache.sis.image">Colorizer</a></span> <span class="element-name">forRanges</span><wbr><span class="parameters">(<a href="https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/util/Map.html" title="class or interface in java.util" class="external-link">Map</a><<a href="../../../../../org.apache.sis.util/org/apache/sis/measure/NumberRange.html" title="class in org.apache.sis.measure">NumberRange</a><?>,<wbr><a href="https://docs.oracle.com/en/java/javase/11/docs/api/java.desktop/java/awt/Color.html" title="class or interface in java.awt" class="external-link">Color</a>[]> colors)</span></div> |
| <div class="block">Creates a colorizer which will interpolate colors in multiple ranges of values. |
| The range of pixel values are specified by <a href="../../../../../org.apache.sis.util/org/apache/sis/measure/NumberRange.html" title="class in org.apache.sis.measure"><code>NumberRange</code></a> elements, |
| and the colors to interpolate in each range are specified by <code>Color[]</code> arrays. |
| Empty arrays (i.e. no color) are interpreted as an explicit request for full transparency. |
| |
| <p>When the image data type is 8 or 16 bits integer, |
| this colorizer creates <a href="https://docs.oracle.com/en/java/javase/11/docs/api/java.desktop/java/awt/image/IndexColorModel.html" title="class or interface in java.awt.image" class="external-link"><code>IndexColorModel</code></a> instances. |
| For other kinds of data type such as floating points, |
| this colorizer creates a non-standard (and potentially slow) color model.</p> |
| |
| <h4 id="default-colors-heading">Default colors</h4> |
| The given <code>colors</code> map can associate to some keys a null or an empty color arrays. |
| An empty array (i.e. no color) is interpreted as an explicit request for transparency. |
| But null values are interpreted as unspecified colors, |
| in which case the defaults are implementation dependent. |
| In current implementation, the defaults are: |
| |
| <ul> |
| <li>If this colorizer is used for <a href="ImageProcessor.html#visualize(java.awt.image.RenderedImage)">visualization</a>, |
| try to keep the existing colors of the image to visualize.</li> |
| <li>Otherwise if the range minimum and maximum values are not equal, default to grayscale colors.</li> |
| <li>Otherwise default to a fully transparent color.</li> |
| </ul> |
| |
| <h4 id="limitations-heading1">Limitations</h4> |
| In current implementation, the non-standard color model ignores the specified colors. |
| If the image data type is not 8 or 16 bits integer, the colors are always grayscale.</div> |
| <dl class="notes"> |
| <dt>Parameters:</dt> |
| <dd><code>colors</code> - the colors to use for the specified range of sample values.</dd> |
| <dt>Returns:</dt> |
| <dd>a colorizer which will interpolate the given colors in the given range of values.</dd> |
| <dt>See Also:</dt> |
| <dd> |
| <ul class="tag-list-long"> |
| <li><a href="ImageProcessor.html#visualize(java.awt.image.RenderedImage)"><code>ImageProcessor.visualize(RenderedImage)</code></a></li> |
| </ul> |
| </dd> |
| </dl> |
| </section> |
| </li> |
| <li> |
| <section class="detail" id="forCategories(java.util.function.Function)"> |
| <h3>forCategories</h3> |
| <div class="member-signature"><span class="modifiers">static</span> <span class="return-type"><a href="Colorizer.html" title="interface in org.apache.sis.image">Colorizer</a></span> <span class="element-name">forCategories</span><wbr><span class="parameters">(<a href="https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/util/function/Function.html" title="class or interface in java.util.function" class="external-link">Function</a><<a href="../coverage/Category.html" title="class in org.apache.sis.coverage">Category</a>,<wbr><a href="https://docs.oracle.com/en/java/javase/11/docs/api/java.desktop/java/awt/Color.html" title="class or interface in java.awt" class="external-link">Color</a>[]> colors)</span></div> |
| <div class="block">Creates a colorizer which will interpolate colors in ranges identified by categories. |
| This colorizer is similar to <a href="#forRanges(java.util.Map)"><code>forRanges(Map)</code></a> (with the same limitations) except that instead of mapping |
| colors to predefined ranges of pixel values, it maps colors to <a href="../coverage/Category.html#getName()">category names</a>, |
| <a href="../../../../../org.apache.sis.util/org/apache/sis/measure/MeasurementRange.html#unit()">units of measurement</a> or other properties. |
| The given function provides a way to colorize images without knowing in advance the numerical values of pixels. |
| For example, instead of specifying <cite>"pixel value 0 is blue, 1 is green, 2 is yellow"</cite>, |
| the given function allows to specify <cite>"Lakes are blue, Forests are green, Sand is yellow"</cite>. |
| |
| <h4 id="default-colors-heading1">Default colors</h4> |
| The given function can return <code>null</code> or empty color arrays for some categories. |
| An empty array (i.e. no color) is interpreted as an explicit request for transparency. |
| But null arrays are interpreted as unrecognized category, |
| in which case the defaults are implementation dependent. |
| In current implementation, the defaults are: |
| |
| <ul> |
| <li>If this colorizer is used for <a href="ImageProcessor.html#visualize(java.awt.image.RenderedImage)">visualization</a>, |
| try to keep the existing colors of the image to visualize.</li> |
| <li>Otherwise if all categories are unrecognized, then the colorizer returns an empty value.</li> |
| <li>Otherwise, <a href="../coverage/Category.html#isQuantitative()">quantitative</a> categories default to grayscale colors.</li> |
| <li>Otherwise qualitative categories default to a fully transparent color.</li> |
| </ul> |
| |
| <h4 id="conditions-heading">Conditions</h4> |
| This colorizer is used when <a href="Colorizer.Target.html#getRanges()"><code>Colorizer.Target.getRanges()</code></a> provides a non-empty value. |
| That value is typically fetched from the <a href="PlanarImage.html#SAMPLE_DIMENSIONS_KEY">"org.apache.sis.SampleDimensions"</a> image property, |
| which is itself typically fetched from <a href="../coverage/grid/GridCoverage.html#getSampleDimensions()"><code>GridCoverage.getSampleDimensions()</code></a>. |
| If no sample dimension information is available, |
| or if the specified function did not returned at non-null value for at least one category, |
| then this colorizer does not build a color model. |
| A fallback can be specified with <a href="#orElse(org.apache.sis.image.Colorizer)"><code>orElse(Colorizer)</code></a>.</div> |
| <dl class="notes"> |
| <dt>Parameters:</dt> |
| <dd><code>colors</code> - colors to use for arbitrary categories of sample values.</dd> |
| <dt>Returns:</dt> |
| <dd>a colorizer which will apply colors determined by the <a href="../coverage/Category.html" title="class in org.apache.sis.coverage"><code>Category</code></a> of sample values.</dd> |
| <dt>See Also:</dt> |
| <dd> |
| <ul class="tag-list-long"> |
| <li><a href="ImageProcessor.html#visualize(java.awt.image.RenderedImage)"><code>ImageProcessor.visualize(RenderedImage)</code></a></li> |
| </ul> |
| </dd> |
| </dl> |
| </section> |
| </li> |
| <li> |
| <section class="detail" id="forInstance(java.awt.image.ColorModel)"> |
| <h3>forInstance</h3> |
| <div class="member-signature"><span class="modifiers">static</span> <span class="return-type"><a href="Colorizer.html" title="interface in org.apache.sis.image">Colorizer</a></span> <span class="element-name">forInstance</span><wbr><span class="parameters">(<a href="https://docs.oracle.com/en/java/javase/11/docs/api/java.desktop/java/awt/image/ColorModel.html" title="class or interface in java.awt.image" class="external-link">ColorModel</a> colors)</span></div> |
| <div class="block">Creates a colorizer which will use the specified color model instance if compatible with the target.</div> |
| <dl class="notes"> |
| <dt>Parameters:</dt> |
| <dd><code>colors</code> - the color model instance to use.</dd> |
| <dt>Returns:</dt> |
| <dd>a colorizer which will try to apply the specified color model <i>as-is</i>.</dd> |
| </dl> |
| </section> |
| </li> |
| <li> |
| <section class="detail" id="apply(org.apache.sis.image.Colorizer.Target)"> |
| <h3>apply</h3> |
| <div class="member-signature"><span class="return-type"><a href="https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/util/Optional.html" title="class or interface in java.util" class="external-link">Optional</a><<a href="https://docs.oracle.com/en/java/javase/11/docs/api/java.desktop/java/awt/image/ColorModel.html" title="class or interface in java.awt.image" class="external-link">ColorModel</a>></span> <span class="element-name">apply</span><wbr><span class="parameters">(<a href="Colorizer.Target.html" title="class in org.apache.sis.image">Colorizer.Target</a> model)</span></div> |
| <div class="block">Returns the color model to use for an image having the given sample model. |
| If this function does not support the creation of a color model for the given sample model, |
| then an empty value is returned. In the latter case, caller will typically fallback on grayscale. |
| Otherwise if a non-empty value is returned, then that color model shall be |
| <a href="https://docs.oracle.com/en/java/javase/11/docs/api/java.desktop/java/awt/image/ColorModel.html#isCompatibleSampleModel(java.awt.image.SampleModel)" title="class or interface in java.awt.image" class="external-link">compatible</a> |
| with the <a href="Colorizer.Target.html#getSampleModel()">target sample model</a>.</div> |
| <dl class="notes"> |
| <dt>Specified by:</dt> |
| <dd><code><a href="https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/util/function/Function.html#apply(T)" title="class or interface in java.util.function" class="external-link">apply</a></code> in interface <code><a href="https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/util/function/Function.html" title="class or interface in java.util.function" class="external-link">Function</a><<a href="Colorizer.Target.html" title="class in org.apache.sis.image">Colorizer.Target</a>,<wbr><a href="https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/util/Optional.html" title="class or interface in java.util" class="external-link">Optional</a><<a href="https://docs.oracle.com/en/java/javase/11/docs/api/java.desktop/java/awt/image/ColorModel.html" title="class or interface in java.awt.image" class="external-link">ColorModel</a>>></code></dd> |
| <dt>Parameters:</dt> |
| <dd><code>model</code> - the sample model of the image for which to create a color model.</dd> |
| <dt>Returns:</dt> |
| <dd>the color model to use for the specified sample model.</dd> |
| </dl> |
| </section> |
| </li> |
| <li> |
| <section class="detail" id="orElse(org.apache.sis.image.Colorizer)"> |
| <h3>orElse</h3> |
| <div class="member-signature"><span class="modifiers">default</span> <span class="return-type"><a href="Colorizer.html" title="interface in org.apache.sis.image">Colorizer</a></span> <span class="element-name">orElse</span><wbr><span class="parameters">(<a href="Colorizer.html" title="interface in org.apache.sis.image">Colorizer</a> alternative)</span></div> |
| <div class="block">Returns a new colorizer which will apply the specified alternative |
| if this colorizer cannot infer a color model.</div> |
| <dl class="notes"> |
| <dt>Parameters:</dt> |
| <dd><code>alternative</code> - the alternative strategy for creating a color model.</dd> |
| <dt>Returns:</dt> |
| <dd>a new colorizer which will attempt to apply <code>this</code> first, |
| then fallback on the specified alternative this colorizer did not produced a result.</dd> |
| </dl> |
| </section> |
| </li> |
| </ul> |
| </section> |
| </li> |
| </ul> |
| </section> |
| <!-- ========= END OF CLASS DATA ========= --> |
| </main> |
| </div> |
| </div> |
| </body> |
| </html> |