blob: 6a63aa3de33ab0b74d34a8d8cd9758d28233dd41 [file] [log] [blame]
<!DOCTYPE HTML>
<html lang="en">
<head>
<!-- Generated by javadoc (21) on Thu Oct 05 19:54:57 CEST 2023 -->
<title>PixelIterator (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, class: PixelIterator">
<meta name="generator" content="javadoc/ClassWriterImpl">
<meta name="keywords" content="org.apache.sis.image.PixelIterator class">
<meta name="keywords" content="create()">
<meta name="keywords" content="isWritable()">
<meta name="keywords" content="getDataType()">
<meta name="keywords" content="getTransferType()">
<meta name="keywords" content="getSampleRanges()">
<meta name="keywords" content="getIterationOrder()">
<meta name="keywords" content="getNumBands()">
<meta name="keywords" content="getDomain()">
<meta name="keywords" content="getPosition()">
<meta name="keywords" content="moveTo()">
<meta name="keywords" content="next()">
<meta name="keywords" content="getSample()">
<meta name="keywords" content="getSampleFloat()">
<meta name="keywords" content="getSampleDouble()">
<meta name="keywords" content="getPixel()">
<meta name="keywords" content="getDataElements()">
<meta name="keywords" content="createWindow()">
<meta name="keywords" content="rewind()">
<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">&nbsp;</span><span class="nav-bar-toggle-icon">&nbsp;</span><span class="nav-bar-toggle-icon">&nbsp;</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>Field</li>
<li>Constr</li>
<li><a href="#method-summary">Method</a></li>
</ul>
</li>
<li>
<p>Detail:</p>
<ul>
<li>Field</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:&nbsp;</li>
<li><a href="#nested-class-summary">Nested</a>&nbsp;|&nbsp;</li>
<li>Field&nbsp;|&nbsp;</li>
<li>Constr&nbsp;|&nbsp;</li>
<li><a href="#method-summary">Method</a></li>
</ul>
<ul class="sub-nav-list">
<li>Detail:&nbsp;</li>
<li>Field&nbsp;|&nbsp;</li>
<li>Constr&nbsp;|&nbsp;</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>&nbsp;<a href="../../../../module-summary.html">org.apache.sis.feature</a></div>
<div class="sub-title"><span class="package-label-in-type">Package</span>&nbsp;<a href="package-summary.html">org.apache.sis.image</a></div>
<h1 title="Class PixelIterator" class="title">Class PixelIterator</h1>
</div>
<div class="inheritance" title="Inheritance Tree"><a href="https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/lang/Object.html" title="class or interface in java.lang" class="external-link">Object</a>
<div class="inheritance">PixelIterator</div>
</div>
<section class="class-description" id="class-description">
<dl class="notes">
<dt>Direct Known Subclasses:</dt>
<dd><code><a href="WritablePixelIterator.html" title="class in org.apache.sis.image">Writable­Pixel­Iterator</a></code></dd>
</dl>
<hr>
<div class="type-signature"><span class="modifiers">public class </span><span class="element-name type-name-label">PixelIterator</span>
<span class="extends-implements">extends <a href="https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/lang/Object.html" title="class or interface in java.lang" class="external-link">Object</a></span></div>
<div class="block">An iterator over sample values in a raster or an image. This iterator makes easier to read and write efficiently
pixel or sample values. The iterator <a href="https://docs.oracle.com/en/java/javase/11/docs/api/java.desktop/java/awt/image/RenderedImage.html#getTile(int,int)" title="class or interface in java.awt.image" class="external-link">acquires tiles</a> and releases them
automatically. Unless otherwise specified, iterators are free to use an <a href="#getIterationOrder()">iteration
order</a> that minimize the "acquire / release tile" operations (in other words, iterations are not necessarily from
left to right). Iteration can be performed on a complete image or only a sub-region of it. Some optimized iterator
implementations exist for a few commonly used <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">sample models</a>.
<h2 id="example-heading">Example</h2>
<div class="snippet-container"><button class="copy snippet-copy" aria-label="Copy snippet" onclick="copySnippet(this)"><span data-copied="Copied!">Copy</span><img src="../../../../../copy.svg" alt="Copy snippet"></button>
<pre class="snippet"><code class="language-java">PixelIterator it = PixelIterator.create(image);
double[] samples = null;
while (it.next()) {
samples = it.getPixel(samples); // Get values in all bands.
// Perform computation here...
}
</code></pre>
</div>
<h2 id="default-implementation-heading">Default implementation</h2>
This base class uses the <a href="https://docs.oracle.com/en/java/javase/11/docs/api/java.desktop/java/awt/image/Raster.html" title="class or interface in java.awt.image" class="external-link"><code>Raster</code></a> API for traversing the pixels in each tile.
Calls to <a href="#next()"><code>next()</code></a> move the current position by increasing the following values, in order:
<ol>
<li>Column index in a single tile (from left to right)</li>
<li>Row index in a single tile (from top to bottom).</li>
<li>Then, <code>tile­X</code> index from left to right.</li>
<li>Then, <code>tile­Y</code> index from top to bottom.</li>
</ol></div>
<dl class="notes">
<dt>Since:</dt>
<dd>1.0</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">Class</div>
<div class="table-header col-last">Description</div>
<div class="col-first even-row-color"><code>static class&nbsp;</code></div>
<div class="col-second even-row-color"><code><a href="PixelIterator.Builder.html" class="type-name-link" title="class in org.apache.sis.image">Pixel­Iterator​.Builder</a></code></div>
<div class="col-last even-row-color">
<div class="block">Builds pixel iterators for specified region of interest, window size or iteration order.</div>
</div>
<div class="col-first odd-row-color"><code>static class&nbsp;</code></div>
<div class="col-second odd-row-color"><code><a href="PixelIterator.Window.html" class="type-name-link" title="class in org.apache.sis.image">Pixel­Iterator​.Window</a>&lt;<a href="PixelIterator.Window.html" title="type parameter in PixelIterator.Window">T</a> extends <a href="https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/nio/Buffer.html" title="class or interface in java.nio" class="external-link">Buffer</a>&gt;</code></div>
<div class="col-last odd-row-color">
<div class="block">Contains the sample values in a moving window over the image.</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-tab4" role="tab" aria-selected="false" aria-controls="method-summary-table.tabpanel" tabindex="-1" onkeydown="switchTab(event)" onclick="show('method-summary-table', 'method-summary-table-tab4', 3)" class="table-tab">Concrete 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-tab1 method-summary-table-tab4"><code>static <a href="PixelIterator.html" title="class in org.apache.sis.image">Pixel­Iterator</a></code></div>
<div class="col-second even-row-color method-summary-table method-summary-table-tab1 method-summary-table-tab4"><code><a href="#create(java.awt.image.RenderedImage)" class="member-name-link">create</a><wbr>(<a href="https://docs.oracle.com/en/java/javase/11/docs/api/java.desktop/java/awt/image/RenderedImage.html" title="class or interface in java.awt.image" class="external-link">Rendered­Image</a>&nbsp;data)</code></div>
<div class="col-last even-row-color method-summary-table method-summary-table-tab1 method-summary-table-tab4">
<div class="block">Creates an iterator for all pixels in the given image.</div>
</div>
<div class="col-first odd-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab4"><code>&lt;T extends <a href="https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/nio/Buffer.html" title="class or interface in java.nio" class="external-link">Buffer</a>&gt;<br><a href="PixelIterator.Window.html" title="class in org.apache.sis.image">Pixel­Iterator​.Window</a><wbr>&lt;T&gt;</code></div>
<div class="col-second odd-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab4"><code><a href="#createWindow(org.apache.sis.image.TransferType)" class="member-name-link">create­Window</a><wbr>(<a href="TransferType.html" title="class in org.apache.sis.image">Transfer­Type</a>&lt;T&gt;&nbsp;type)</code></div>
<div class="col-last odd-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab4">
<div class="block">Returns a moving window over the sample values in a rectangular region starting at iterator position.</div>
</div>
<div class="col-first even-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab4"><code><a href="https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/lang/Object.html" title="class or interface in java.lang" class="external-link">Object</a></code></div>
<div class="col-second even-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab4"><code><a href="#getDataElements(java.lang.Object)" class="member-name-link">get­Data­Elements</a><wbr>(<a href="https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/lang/Object.html" title="class or interface in java.lang" class="external-link">Object</a>&nbsp;dest)</code></div>
<div class="col-last even-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab4">
<div class="block">Returns the data elements (not necessarily band values) of current pixel.</div>
</div>
<div class="col-first odd-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab4"><code><a href="DataType.html" title="enum class in org.apache.sis.image">Data­Type</a></code></div>
<div class="col-second odd-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab4"><code><a href="#getDataType()" class="member-name-link">get­Data­Type</a>()</code></div>
<div class="col-last odd-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab4">
<div class="block">Returns the type used for storing data in the raster buffer.</div>
</div>
<div class="col-first even-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab4"><code><a href="https://docs.oracle.com/en/java/javase/11/docs/api/java.desktop/java/awt/Rectangle.html" title="class or interface in java.awt" class="external-link">Rectangle</a></code></div>
<div class="col-second even-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab4"><code><a href="#getDomain()" class="member-name-link">get­Domain</a>()</code></div>
<div class="col-last even-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab4">
<div class="block">Returns the pixel coordinates of the region where this iterator is doing the iteration.</div>
</div>
<div class="col-first odd-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab4"><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>&lt;<a href="SequenceType.html" title="enum class in org.apache.sis.image">Sequence­Type</a>&gt;</code></div>
<div class="col-second odd-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab4"><code><a href="#getIterationOrder()" class="member-name-link">get­Iteration­Order</a>()</code></div>
<div class="col-last odd-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab4">
<div class="block">Returns the order in which pixels are traversed.</div>
</div>
<div class="col-first even-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab4"><code>int</code></div>
<div class="col-second even-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab4"><code><a href="#getNumBands()" class="member-name-link">get­Num­Bands</a>()</code></div>
<div class="col-last even-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab4">
<div class="block">Returns the number of bands (samples per pixel) in the image or raster.</div>
</div>
<div class="col-first odd-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab4"><code>double[]</code></div>
<div class="col-second odd-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab4"><code><a href="#getPixel(double%5B%5D)" class="member-name-link">get­Pixel</a><wbr>(double[]&nbsp;dest)</code></div>
<div class="col-last odd-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab4">
<div class="block">Returns the sample values of current pixel for all bands.</div>
</div>
<div class="col-first even-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab4"><code>float[]</code></div>
<div class="col-second even-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab4"><code><a href="#getPixel(float%5B%5D)" class="member-name-link">get­Pixel</a><wbr>(float[]&nbsp;dest)</code></div>
<div class="col-last even-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab4">
<div class="block">Returns the sample values of current pixel for all bands.</div>
</div>
<div class="col-first odd-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab4"><code>int[]</code></div>
<div class="col-second odd-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab4"><code><a href="#getPixel(int%5B%5D)" class="member-name-link">get­Pixel</a><wbr>(int[]&nbsp;dest)</code></div>
<div class="col-last odd-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab4">
<div class="block">Returns the sample values of current pixel for all bands.</div>
</div>
<div class="col-first even-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab4"><code><a href="https://docs.oracle.com/en/java/javase/11/docs/api/java.desktop/java/awt/Point.html" title="class or interface in java.awt" class="external-link">Point</a></code></div>
<div class="col-second even-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab4"><code><a href="#getPosition()" class="member-name-link">get­Position</a>()</code></div>
<div class="col-last even-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab4">
<div class="block">Returns the column (x) and row (y) indices of the current pixel.</div>
</div>
<div class="col-first odd-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab4"><code>int</code></div>
<div class="col-second odd-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab4"><code><a href="#getSample(int)" class="member-name-link">get­Sample</a><wbr>(int&nbsp;band)</code></div>
<div class="col-last odd-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab4">
<div class="block">Returns the sample value in the specified band of current pixel, rounded toward zero.</div>
</div>
<div class="col-first even-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab4"><code>double</code></div>
<div class="col-second even-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab4"><code><a href="#getSampleDouble(int)" class="member-name-link">get­Sample­Double</a><wbr>(int&nbsp;band)</code></div>
<div class="col-last even-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab4">
<div class="block">Returns the sample value in the specified band of current pixel, without precision lost.</div>
</div>
<div class="col-first odd-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab4"><code>float</code></div>
<div class="col-second odd-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab4"><code><a href="#getSampleFloat(int)" class="member-name-link">get­Sample­Float</a><wbr>(int&nbsp;band)</code></div>
<div class="col-last odd-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab4">
<div class="block">Returns the sample value in the specified band of current pixel as a single-precision floating point number.</div>
</div>
<div class="col-first even-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab4"><code><a href="../../../../../org.apache.sis.util/org/apache/sis/measure/NumberRange.html" title="class in org.apache.sis.measure">Number­Range</a>&lt;?&gt;[]</code></div>
<div class="col-second even-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab4"><code><a href="#getSampleRanges()" class="member-name-link">get­Sample­Ranges</a>()</code></div>
<div class="col-last even-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab4">
<div class="block">Returns the range of sample values that can be stored in each band of the rendered image or raster.</div>
</div>
<div class="col-first odd-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab4"><code><a href="TransferType.html" title="class in org.apache.sis.image">Transfer­Type</a><wbr>&lt;?&gt;</code></div>
<div class="col-second odd-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab4"><code><a href="#getTransferType()" class="member-name-link">get­Transfer­Type</a>()</code></div>
<div class="col-last odd-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab4">
<div class="block">Returns the most efficient type (<code>int</code>, <code>float</code> or <code>double</code>) for transferring data between the
underlying rasters and this iterator.</div>
</div>
<div class="col-first even-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab4"><code>boolean</code></div>
<div class="col-second even-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab4"><code><a href="#isWritable()" class="member-name-link">is­Writable</a>()</code></div>
<div class="col-last even-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab4">
<div class="block">Returns <code>true</code> if this iterator can write pixel values (after cast to <code>Writable­Pixel­Iterator</code>).</div>
</div>
<div class="col-first odd-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab4"><code>void</code></div>
<div class="col-second odd-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab4"><code><a href="#moveTo(int,int)" class="member-name-link">move­To</a><wbr>(int&nbsp;px,
int&nbsp;py)</code></div>
<div class="col-last odd-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab4">
<div class="block">Moves the pixel iterator to the given column (x) and row (y) indices.</div>
</div>
<div class="col-first even-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab4"><code>boolean</code></div>
<div class="col-second even-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab4"><code><a href="#next()" class="member-name-link">next</a>()</code></div>
<div class="col-last even-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab4">
<div class="block">Moves the iterator to the next pixel.</div>
</div>
<div class="col-first odd-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab4"><code>void</code></div>
<div class="col-second odd-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab4"><code><a href="#rewind()" class="member-name-link">rewind</a>()</code></div>
<div class="col-last odd-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab4">
<div class="block">Restores the iterator to the start position.</div>
</div>
</div>
</div>
</div>
<div class="inherited-list">
<h3 id="methods-inherited-from-class-Object">Methods inherited from class&nbsp;<a href="https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/lang/Object.html" title="class or interface in java.lang" class="external-link">Object</a></h3>
<code><a href="https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/lang/Object.html#clone()" title="class or interface in java.lang" class="external-link">clone</a>, <a href="https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/lang/Object.html#equals(java.lang.Object)" title="class or interface in java.lang" class="external-link">equals</a>, <a href="https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/lang/Object.html#finalize()" title="class or interface in java.lang" class="external-link">finalize</a>, <a href="https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/lang/Object.html#getClass()" title="class or interface in java.lang" class="external-link">get­Class</a>, <a href="https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/lang/Object.html#hashCode()" title="class or interface in java.lang" class="external-link">hash­Code</a>, <a href="https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/lang/Object.html#notify()" title="class or interface in java.lang" class="external-link">notify</a>, <a href="https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/lang/Object.html#notifyAll()" title="class or interface in java.lang" class="external-link">notify­All</a>, <a href="https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/lang/Object.html#toString()" title="class or interface in java.lang" class="external-link">to­String</a>, <a href="https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/lang/Object.html#wait()" title="class or interface in java.lang" class="external-link">wait</a>, <a href="https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/lang/Object.html#wait(long)" title="class or interface in java.lang" class="external-link">wait</a>, <a href="https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/lang/Object.html#wait(long,int)" title="class or interface in java.lang" class="external-link">wait</a></code></div>
</section>
</li>
</ul>
</section>
<section class="details">
<ul class="details-list">
<!-- ============ METHOD DETAIL ========== -->
<li>
<section class="method-details" id="method-detail">
<h2>Method Details</h2>
<ul class="member-list">
<li>
<section class="detail" id="create(java.awt.image.RenderedImage)">
<h3>create</h3>
<div class="member-signature"><span class="modifiers">public static</span>&nbsp;<span class="return-type"><a href="PixelIterator.html" title="class in org.apache.sis.image">PixelIterator</a></span>&nbsp;<span class="element-name">create</span><wbr><span class="parameters">(<a href="https://docs.oracle.com/en/java/javase/11/docs/api/java.desktop/java/awt/image/RenderedImage.html" title="class or interface in java.awt.image" class="external-link">RenderedImage</a>&nbsp;data)</span></div>
<div class="block">Creates an iterator for all pixels in the given image.
This is a convenience method for <code>new Builder()​.create(data)</code>.</div>
<dl class="notes">
<dt>Parameters:</dt>
<dd><code>data</code> - the image which contains the sample values on which to iterate.</dd>
<dt>Returns:</dt>
<dd>a new iterator traversing all pixels in the given image, in arbitrary order.</dd>
</dl>
</section>
</li>
<li>
<section class="detail" id="isWritable()">
<h3>isWritable</h3>
<div class="member-signature"><span class="modifiers">public</span>&nbsp;<span class="return-type">boolean</span>&nbsp;<span class="element-name">isWritable</span>()</div>
<div class="block">Returns <code>true</code> if this iterator can write pixel values (after cast to <code>Writable­Pixel­Iterator</code>).
This method should be used instead of <code>instanceof</code> check because, for some implementations, being
an instance of <code>Writable­Pixel­Iterator</code> is not a sufficient condition.</div>
<dl class="notes">
<dt>Returns:</dt>
<dd><code>true</code> if this iterator can safely be casted to <a href="WritablePixelIterator.html" title="class in org.apache.sis.image"><code>Writable­Pixel­Iterator</code></a> and used for
writing pixel values.</dd>
</dl>
</section>
</li>
<li>
<section class="detail" id="getDataType()">
<h3>getDataType</h3>
<div class="member-signature"><span class="modifiers">public</span>&nbsp;<span class="return-type"><a href="DataType.html" title="enum class in org.apache.sis.image">DataType</a></span>&nbsp;<span class="element-name">getDataType</span>()</div>
<div class="block">Returns the type used for storing data in the raster buffer.
The data type identifies the <a href="https://docs.oracle.com/en/java/javase/11/docs/api/java.desktop/java/awt/image/DataBuffer.html" title="class or interface in java.awt.image" class="external-link"><code>Data­Buffer</code></a> subclass used for storage.</div>
<dl class="notes">
<dt>Returns:</dt>
<dd>the type used for storing data in the raster buffer.</dd>
<dt>Since:</dt>
<dd>1.2</dd>
<dt>See Also:</dt>
<dd>
<ul class="tag-list">
<li><a href="https://docs.oracle.com/en/java/javase/11/docs/api/java.desktop/java/awt/image/SampleModel.html#getDataType()" title="class or interface in java.awt.image" class="external-link"><code>Sample­Model​.get­Data­Type()</code></a></li>
</ul>
</dd>
</dl>
</section>
</li>
<li>
<section class="detail" id="getTransferType()">
<h3>getTransferType</h3>
<div class="member-signature"><span class="modifiers">public</span>&nbsp;<span class="return-type"><a href="TransferType.html" title="class in org.apache.sis.image">TransferType</a>&lt;?&gt;</span>&nbsp;<span class="element-name">getTransferType</span>()</div>
<div class="block">Returns the most efficient type (<code>int</code>, <code>float</code> or <code>double</code>) for transferring data between the
underlying rasters and this iterator. The transfer type is not necessarily the storage type used by the rasters.
For example, <code>int</code> values will be used for transferring data even if the underlying rasters store all sample
values as <code>byte</code>s.
<p>The transfer type is only a hint since all iterator methods work for any type (conversions are applied as needed).
However if this method returns <a href="TransferType.html#INT"><code>Transfer­Type​.INT</code></a>, then <a href="#getSample(int)"><code>get­Sample(int)</code></a> and <a href="#getPixel(int%5B%5D)"><code>get­Pixel(int[])</code></a>
will be slightly more efficient than equivalent methods for other types. Conversely if this method returns
<a href="TransferType.html#DOUBLE"><code>Transfer­Type​.DOUBLE</code></a>, then <a href="#getSampleDouble(int)"><code>get­Sample­Double(int)</code></a> will be both more efficient and avoid accuracy lost.</p></div>
<dl class="notes">
<dt>Returns:</dt>
<dd>the most efficient data type for transferring data.</dd>
<dt>See Also:</dt>
<dd>
<ul class="tag-list">
<li><a href="https://docs.oracle.com/en/java/javase/11/docs/api/java.desktop/java/awt/image/SampleModel.html#getTransferType()" title="class or interface in java.awt.image" class="external-link"><code>Sample­Model​.get­Transfer­Type()</code></a></li>
</ul>
</dd>
</dl>
</section>
</li>
<li>
<section class="detail" id="getSampleRanges()">
<h3>getSampleRanges</h3>
<div class="member-signature"><span class="modifiers">public</span>&nbsp;<span class="return-type"><a href="../../../../../org.apache.sis.util/org/apache/sis/measure/NumberRange.html" title="class in org.apache.sis.measure">NumberRange</a>&lt;?&gt;[]</span>&nbsp;<span class="element-name">getSampleRanges</span>()</div>
<div class="block">Returns the range of sample values that can be stored in each band of the rendered image or raster.
The ranges depend on the data type (byte, integer, <i>etc.</i>) and the number of bits per sample.
If the samples are stored as floating point values, then the ranges are infinite (unbounded).
<p>Usually, the range is the same for all bands. A situation where the ranges may differ is when an
image uses <a href="https://docs.oracle.com/en/java/javase/11/docs/api/java.desktop/java/awt/image/SinglePixelPackedSampleModel.html" title="class or interface in java.awt.image" class="external-link"><code>Single­Pixel­Packed­Sample­Model</code></a>, in which case the number of bits per
pixel may vary for different bands.</p></div>
<dl class="notes">
<dt>Returns:</dt>
<dd>the ranges of valid sample values for each band. Ranges may be <a href="../../../../../org.apache.sis.util/org/apache/sis/measure/Range.html#isBounded()">unbounded</a>.</dd>
</dl>
</section>
</li>
<li>
<section class="detail" id="getIterationOrder()">
<h3>getIterationOrder</h3>
<div class="member-signature"><span class="modifiers">public</span>&nbsp;<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>&lt;<a href="SequenceType.html" title="enum class in org.apache.sis.image">SequenceType</a>&gt;</span>&nbsp;<span class="element-name">getIterationOrder</span>()</div>
<div class="block">Returns the order in which pixels are traversed. <a href="SequenceType.html#LINEAR"><code>Sequence­Type​.LINEAR</code></a> means that pixels on the first
row are traversed from left to right, then pixels on the second row from left to right, <i>etc.</i>
An empty value means that the iteration order is unspecified.</div>
<dl class="notes">
<dt>Returns:</dt>
<dd>order in which pixels are traversed.</dd>
</dl>
</section>
</li>
<li>
<section class="detail" id="getNumBands()">
<h3>getNumBands</h3>
<div class="member-signature"><span class="modifiers">public</span>&nbsp;<span class="return-type">int</span>&nbsp;<span class="element-name">getNumBands</span>()</div>
<div class="block">Returns the number of bands (samples per pixel) in the image or raster.</div>
<dl class="notes">
<dt>Returns:</dt>
<dd>number of bands.</dd>
</dl>
</section>
</li>
<li>
<section class="detail" id="getDomain()">
<h3>getDomain</h3>
<div class="member-signature"><span class="modifiers">public</span>&nbsp;<span class="return-type"><a href="https://docs.oracle.com/en/java/javase/11/docs/api/java.desktop/java/awt/Rectangle.html" title="class or interface in java.awt" class="external-link">Rectangle</a></span>&nbsp;<span class="element-name">getDomain</span>()</div>
<div class="block">Returns the pixel coordinates of the region where this iterator is doing the iteration.
If no region was specified at construction time, then this method returns the image or raster bounds.</div>
<dl class="notes">
<dt>Returns:</dt>
<dd>pixel coordinates of the iteration region.</dd>
</dl>
</section>
</li>
<li>
<section class="detail" id="getPosition()">
<h3>getPosition</h3>
<div class="member-signature"><span class="modifiers">public</span>&nbsp;<span class="return-type"><a href="https://docs.oracle.com/en/java/javase/11/docs/api/java.desktop/java/awt/Point.html" title="class or interface in java.awt" class="external-link">Point</a></span>&nbsp;<span class="element-name">getPosition</span>()</div>
<div class="block">Returns the column (x) and row (y) indices of the current pixel.
The <a href="#next()"><code>next()</code></a> or <a href="#moveTo(int,int)"><code>move­To(int,int)</code></a> method must have been invoked before this method.
Indices of the first pixel are not necessarily zero; they can even be negative.</div>
<dl class="notes">
<dt>Returns:</dt>
<dd>column and row indices of current iterator position.</dd>
<dt>Throws:</dt>
<dd><code><a href="https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/lang/IllegalStateException.html" title="class or interface in java.lang" class="external-link">Illegal­State­Exception</a></code> - if this method is invoked before the first call to <a href="#next()"><code>next()</code></a>
or <a href="#moveTo(int,int)"><code>move­To(int,int)</code></a>, or after <code>next()</code> returned <code>false</code>.</dd>
</dl>
</section>
</li>
<li>
<section class="detail" id="moveTo(int,int)">
<h3>moveTo</h3>
<div class="member-signature"><span class="modifiers">public</span>&nbsp;<span class="return-type">void</span>&nbsp;<span class="element-name">moveTo</span><wbr><span class="parameters">(int&nbsp;px,
int&nbsp;py)</span></div>
<div class="block">Moves the pixel iterator to the given column (x) and row (y) indices. After this method invocation,
the iterator state is as if the <a href="#next()"><code>next()</code></a> method has been invoked just before to reach the
specified position.
<h4 id="usage-example-heading">Usage example</h4>
<div class="snippet-container"><button class="copy snippet-copy" aria-label="Copy snippet" onclick="copySnippet(this)"><span data-copied="Copied!">Copy</span><img src="../../../../../copy.svg" alt="Copy snippet"></button>
<pre class="snippet"><code class="language-java">iterator.moveTo(x, y);
do {
int sample = iterator.getSample(band);
// Use sample value here...
} while (iterator.next());
</code></pre>
</div>
</div>
<dl class="notes">
<dt>Parameters:</dt>
<dd><code>px</code> - the column index of the pixel to make current.</dd>
<dd><code>py</code> - the row index of the pixel to make current.</dd>
<dt>Throws:</dt>
<dd><code><a href="https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/lang/IndexOutOfBoundsException.html" title="class or interface in java.lang" class="external-link">Index­Out­Of­Bounds­Exception</a></code> - if the given indices are outside the iteration domain.</dd>
</dl>
</section>
</li>
<li>
<section class="detail" id="next()">
<h3>next</h3>
<div class="member-signature"><span class="modifiers">public</span>&nbsp;<span class="return-type">boolean</span>&nbsp;<span class="element-name">next</span>()</div>
<div class="block">Moves the iterator to the next pixel. A pixel iterator is initially positioned before the first pixel.
The first call to <code>next()</code> makes the first pixel the current one; the second call makes the second
pixel the current one, <i>etc.</i> The second pixel is not necessarily on the same row than the first one;
iteration order is implementation dependent.
<p>When a call to <code>next()</code> returns <code>false</code>, the iterator is positioned after the last pixel.
Any invocation of a <code>get­Sample(int)</code> method will result in a <a href="https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/util/NoSuchElementException.html" title="class or interface in java.util" class="external-link"><code>No­Such­Element­Exception</code></a> to be
thrown.</p></div>
<dl class="notes">
<dt>Returns:</dt>
<dd><code>true</code> if the current pixel is valid, or <code>false</code> if there are no more pixels.</dd>
<dt>Throws:</dt>
<dd><code><a href="https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/lang/IllegalStateException.html" title="class or interface in java.lang" class="external-link">Illegal­State­Exception</a></code> - if this iterator already reached end of iteration in a previous call
to <code>next()</code>, and <a href="#rewind()"><code>rewind()</code></a> or <a href="#moveTo(int,int)"><code>move­To(int,int)</code></a> have not been invoked.</dd>
</dl>
</section>
</li>
<li>
<section class="detail" id="getSample(int)">
<h3>getSample</h3>
<div class="member-signature"><span class="modifiers">public</span>&nbsp;<span class="return-type">int</span>&nbsp;<span class="element-name">getSample</span><wbr><span class="parameters">(int&nbsp;band)</span></div>
<div class="block">Returns the sample value in the specified band of current pixel, rounded toward zero.
The <a href="#next()"><code>next()</code></a> method must have returned <code>true</code>, or the <a href="#moveTo(int,int)"><code>move­To(int,int)</code></a> method must have
been invoked successfully, before this <code>get­Sample(int)</code> method is invoked. If above condition is not met,
then this method behavior is undefined: it may throw any runtime exception or return a meaningless value
(there is no explicit bounds check for performance reasons).</div>
<dl class="notes">
<dt>Parameters:</dt>
<dd><code>band</code> - the band for which to get the sample value.</dd>
<dt>Returns:</dt>
<dd>sample value in specified band of current pixel.</dd>
<dt>See Also:</dt>
<dd>
<ul class="tag-list-long">
<li><a href="https://docs.oracle.com/en/java/javase/11/docs/api/java.desktop/java/awt/image/Raster.html#getSample(int,int,int)" title="class or interface in java.awt.image" class="external-link"><code>Raster​.get­Sample(int, int, int)</code></a></li>
</ul>
</dd>
</dl>
</section>
</li>
<li>
<section class="detail" id="getSampleFloat(int)">
<h3>getSampleFloat</h3>
<div class="member-signature"><span class="modifiers">public</span>&nbsp;<span class="return-type">float</span>&nbsp;<span class="element-name">getSampleFloat</span><wbr><span class="parameters">(int&nbsp;band)</span></div>
<div class="block">Returns the sample value in the specified band of current pixel as a single-precision floating point number.
The <a href="#next()"><code>next()</code></a> method must have returned <code>true</code>, or the <a href="#moveTo(int,int)"><code>move­To(int,int)</code></a> method must have
been invoked successfully, before this <code>get­Sample­Float(int)</code> method is invoked. If above condition is
not met, then this method behavior is undefined: it may throw any runtime exception or return a meaningless
value (there is no explicit bounds check for performance reasons).</div>
<dl class="notes">
<dt>Parameters:</dt>
<dd><code>band</code> - the band for which to get the sample value.</dd>
<dt>Returns:</dt>
<dd>sample value in specified band of current pixel.</dd>
<dt>See Also:</dt>
<dd>
<ul class="tag-list-long">
<li><a href="https://docs.oracle.com/en/java/javase/11/docs/api/java.desktop/java/awt/image/Raster.html#getSampleFloat(int,int,int)" title="class or interface in java.awt.image" class="external-link"><code>Raster​.get­Sample­Float(int, int, int)</code></a></li>
</ul>
</dd>
</dl>
</section>
</li>
<li>
<section class="detail" id="getSampleDouble(int)">
<h3>getSampleDouble</h3>
<div class="member-signature"><span class="modifiers">public</span>&nbsp;<span class="return-type">double</span>&nbsp;<span class="element-name">getSampleDouble</span><wbr><span class="parameters">(int&nbsp;band)</span></div>
<div class="block">Returns the sample value in the specified band of current pixel, without precision lost.
The <a href="#next()"><code>next()</code></a> method must have returned <code>true</code>, or the <a href="#moveTo(int,int)"><code>move­To(int,int)</code></a> method must have
been invoked successfully, before this <code>get­Sample­Double(int)</code> method is invoked. If above condition is
not met, then this method behavior is undefined: it may throw any runtime exception or return a meaningless
value (there is no explicit bounds check for performance reasons).</div>
<dl class="notes">
<dt>Parameters:</dt>
<dd><code>band</code> - the band for which to get the sample value.</dd>
<dt>Returns:</dt>
<dd>sample value in specified band of current pixel.</dd>
<dt>See Also:</dt>
<dd>
<ul class="tag-list-long">
<li><a href="https://docs.oracle.com/en/java/javase/11/docs/api/java.desktop/java/awt/image/Raster.html#getSampleDouble(int,int,int)" title="class or interface in java.awt.image" class="external-link"><code>Raster​.get­Sample­Double(int, int, int)</code></a></li>
</ul>
</dd>
</dl>
</section>
</li>
<li>
<section class="detail" id="getPixel(int[])">
<h3>getPixel</h3>
<div class="member-signature"><span class="modifiers">public</span>&nbsp;<span class="return-type">int[]</span>&nbsp;<span class="element-name">getPixel</span><wbr><span class="parameters">(int[]&nbsp;dest)</span></div>
<div class="block">Returns the sample values of current pixel for all bands.
The <a href="#next()"><code>next()</code></a> method must have returned <code>true</code>, or the <a href="#moveTo(int,int)"><code>move­To(int,int)</code></a> method must have
been invoked successfully, before this <code>get­Pixel(…)</code> method is invoked. If above condition is not met,
then this method behavior is undefined: it may throw any runtime exception or return a meaningless value
(there is no explicit bounds check for performance reasons).</div>
<dl class="notes">
<dt>Parameters:</dt>
<dd><code>dest</code> - a pre-allocated array where to store the sample values, or <code>null</code> if none.</dd>
<dt>Returns:</dt>
<dd>the sample values for current pixel.</dd>
<dt>See Also:</dt>
<dd>
<ul class="tag-list-long">
<li><a href="https://docs.oracle.com/en/java/javase/11/docs/api/java.desktop/java/awt/image/Raster.html#getPixel(int,int,int%5B%5D)" title="class or interface in java.awt.image" class="external-link"><code>Raster​.get­Pixel(int, int, int[])</code></a></li>
</ul>
</dd>
</dl>
</section>
</li>
<li>
<section class="detail" id="getPixel(float[])">
<h3>getPixel</h3>
<div class="member-signature"><span class="modifiers">public</span>&nbsp;<span class="return-type">float[]</span>&nbsp;<span class="element-name">getPixel</span><wbr><span class="parameters">(float[]&nbsp;dest)</span></div>
<div class="block">Returns the sample values of current pixel for all bands.
The <a href="#next()"><code>next()</code></a> method must have returned <code>true</code>, or the <a href="#moveTo(int,int)"><code>move­To(int,int)</code></a> method must have
been invoked successfully, before this <code>get­Pixel(…)</code> method is invoked. If above condition is not met,
then this method behavior is undefined: it may throw any runtime exception or return a meaningless value
(there is no explicit bounds check for performance reasons).</div>
<dl class="notes">
<dt>Parameters:</dt>
<dd><code>dest</code> - a pre-allocated array where to store the sample values, or <code>null</code> if none.</dd>
<dt>Returns:</dt>
<dd>the sample values for current pixel.</dd>
<dt>See Also:</dt>
<dd>
<ul class="tag-list-long">
<li><a href="https://docs.oracle.com/en/java/javase/11/docs/api/java.desktop/java/awt/image/Raster.html#getPixel(int,int,float%5B%5D)" title="class or interface in java.awt.image" class="external-link"><code>Raster​.get­Pixel(int, int, float[])</code></a></li>
</ul>
</dd>
</dl>
</section>
</li>
<li>
<section class="detail" id="getPixel(double[])">
<h3>getPixel</h3>
<div class="member-signature"><span class="modifiers">public</span>&nbsp;<span class="return-type">double[]</span>&nbsp;<span class="element-name">getPixel</span><wbr><span class="parameters">(double[]&nbsp;dest)</span></div>
<div class="block">Returns the sample values of current pixel for all bands.
The <a href="#next()"><code>next()</code></a> method must have returned <code>true</code>, or the <a href="#moveTo(int,int)"><code>move­To(int,int)</code></a> method must have
been invoked successfully, before this <code>get­Pixel(…)</code> method is invoked. If above condition is not met,
then this method behavior is undefined: it may throw any runtime exception or return a meaningless value
(there is no explicit bounds check for performance reasons).</div>
<dl class="notes">
<dt>Parameters:</dt>
<dd><code>dest</code> - a pre-allocated array where to store the sample values, or <code>null</code> if none.</dd>
<dt>Returns:</dt>
<dd>the sample values for current pixel.</dd>
<dt>See Also:</dt>
<dd>
<ul class="tag-list-long">
<li><a href="https://docs.oracle.com/en/java/javase/11/docs/api/java.desktop/java/awt/image/Raster.html#getPixel(int,int,double%5B%5D)" title="class or interface in java.awt.image" class="external-link"><code>Raster​.get­Pixel(int, int, double[])</code></a></li>
</ul>
</dd>
</dl>
</section>
</li>
<li>
<section class="detail" id="getDataElements(java.lang.Object)">
<h3>getDataElements</h3>
<div class="member-signature"><span class="modifiers">public</span>&nbsp;<span class="return-type"><a href="https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/lang/Object.html" title="class or interface in java.lang" class="external-link">Object</a></span>&nbsp;<span class="element-name">getDataElements</span><wbr><span class="parameters">(<a href="https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/lang/Object.html" title="class or interface in java.lang" class="external-link">Object</a>&nbsp;dest)</span></div>
<div class="block">Returns the data elements (not necessarily band values) of current pixel.
The <code>Object</code> argument and return value is a relatively opaque format (it may be <code>int[]</code>,
<code>byte[]</code>, <i>etc.</i>): it is used for transferring values in a packed format between compatible
Java2D sample or color models. That <code>Object</code> should generally not be used directly by the caller.
<p>Data elements are useful for copying values in another image using the same sample model,
or for getting colors with a call to <a href="https://docs.oracle.com/en/java/javase/11/docs/api/java.desktop/java/awt/image/ColorModel.html#getRGB(java.lang.Object)" title="class or interface in java.awt.image" class="external-link"><code>Color­Model​.get­RGB(Object)</code></a>.</p>
<h4 id="example-heading1">Example</h4>
If an image has Red, Green, Blue and Alpha bands, then the <a href="#getPixel(int%5B%5D)"><code>get­Pixel(int[])</code></a> methods will return
arrays of length 4 containing the individual values for each band, no matter how those bands are stored
in the image. By contrast this <code>get­Data­Elements(…)</code> method may return an array of length 1 with
all sample values packed as a single ARGB value.</div>
<dl class="notes">
<dt>Parameters:</dt>
<dd><code>dest</code> - a pre-allocated array where to store the data elements, or <code>null</code> if none.</dd>
<dt>Returns:</dt>
<dd>the data elements for current pixel.</dd>
<dt>Since:</dt>
<dd>1.1</dd>
<dt>See Also:</dt>
<dd>
<ul class="tag-list-long">
<li><a href="https://docs.oracle.com/en/java/javase/11/docs/api/java.desktop/java/awt/image/Raster.html#getDataElements(int,int,java.lang.Object)" title="class or interface in java.awt.image" class="external-link"><code>Raster​.get­Data­Elements(int, int, Object)</code></a></li>
</ul>
</dd>
</dl>
</section>
</li>
<li>
<section class="detail" id="createWindow(org.apache.sis.image.TransferType)">
<h3>createWindow</h3>
<div class="member-signature"><span class="modifiers">public</span>&nbsp;<span class="type-parameters">&lt;T extends <a href="https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/nio/Buffer.html" title="class or interface in java.nio" class="external-link">Buffer</a>&gt;</span>&nbsp;<span class="return-type"><a href="PixelIterator.Window.html" title="class in org.apache.sis.image">PixelIterator.Window</a>&lt;T&gt;</span>&nbsp;<span class="element-name">createWindow</span><wbr><span class="parameters">(<a href="TransferType.html" title="class in org.apache.sis.image">TransferType</a>&lt;T&gt;&nbsp;type)</span></div>
<div class="block">Returns a moving window over the sample values in a rectangular region starting at iterator position.
The <cite>window size</cite> must have been specified at <code>Pixel­Iterator</code> construction time.
The current iterator position is the window corner having the smallest <var>x</var> and <var>y</var> coordinates.
This is typically, but not necessarily (depending on axis orientations) the window upper-left corner.
Sample values are stored in a sequence of length
<var>(number of bands)</var> × <var>(window width)</var> × <var>(window height)</var>.
Values are always stored with band index varying fastest, then column index, then row index.
Columns are traversed from left to right and rows are traversed from top to bottom
(linear iteration order).
That order is the same regardless the <a href="#getIterationOrder()">iteration order</a> of this iterator.
<div class="note"><b>Example:</b>
for an RGB image, the 3 first values are the red, green and blue components of the pixel at
<a href="#getPosition()">current iterator position</a>. The 3 next values are the red, green
and blue components of the pixel at the right of current iterator position (not necessarily
the position where a call to <a href="#next()"><code>next()</code></a> would have go), <i>etc.</i></div>
Calls to <a href="#next()"><code>next()</code></a> or <a href="#moveTo(int,int)"><code>move­To(int,int)</code></a> followed by <a href="PixelIterator.Window.html#update()"><code>Pixel­Iterator​.Window​.update()</code></a>
replaces the window content with values starting at the new iterator position.
Before the first <a href="PixelIterator.Window.html#update()"><code>Pixel­Iterator​.Window​.update()</code></a> invocation, the window is filled with zero values.
<p>If this iterator is used for
<a href="WritablePixelIterator.html#setPixel(int%5B%5D)">writing pixel values at current position</a>,
those write operations may change the content of windows at <a href="#next()">next positions</a>
unless the iteration order of this iterator is <a href="SequenceType.html#LINEAR"><code>Sequence­Type​.LINEAR</code></a>.</p>
<h4 id="usage-example-heading1">Usage example</h4>
following code creates an iterator over the full area of given image, then a window of 5×5 pixels.
The window is moved over all the image area in iteration order. Inside the window, data are copied
in linear order regardless the iteration order.
<div class="snippet-container"><button class="copy snippet-copy" aria-label="Copy snippet" onclick="copySnippet(this)"><span data-copied="Copied!">Copy</span><img src="../../../../../copy.svg" alt="Copy snippet"></button>
<pre class="snippet"><code class="language-java">PixelIterator it = create(image, null, new Dimension(5, 5), null); // Windows size will be 5×5 pixels.
PixelIterator&lt;FloatBuffer&gt; window = it.createWindow(TransferType.FLOAT);
FloatBuffer values = window.values;
while (it.next()) {
window.update();
while (buffer.hasRemaining()) {
float sample = buffer.get();
// use the sample value here.
}
}
</code></pre>
</div>
</div>
<dl class="notes">
<dt>Type Parameters:</dt>
<dd><code>T</code> - the type of the data buffer to use for transferring data.</dd>
<dt>Parameters:</dt>
<dd><code>type</code> - the desired type of values (<code>int</code>, <code>float</code> or <code>double</code>).
Use <a href="#getTransferType()"><code>get­Transfer­Type()</code></a> if the most efficient type is desired.</dd>
<dt>Returns:</dt>
<dd>a window over the sample values in the underlying image or raster.</dd>
<dt>See Also:</dt>
<dd>
<ul class="tag-list-long">
<li><a href="https://docs.oracle.com/en/java/javase/11/docs/api/java.desktop/java/awt/image/Raster.html#getPixels(int,int,int,int,double%5B%5D)" title="class or interface in java.awt.image" class="external-link"><code>Raster​.get­Pixels(int, int, int, int, double[])</code></a></li>
</ul>
</dd>
</dl>
</section>
</li>
<li>
<section class="detail" id="rewind()">
<h3>rewind</h3>
<div class="member-signature"><span class="modifiers">public</span>&nbsp;<span class="return-type">void</span>&nbsp;<span class="element-name">rewind</span>()</div>
<div class="block">Restores the iterator to the start position. After this method has been invoked,
the iterator is in the same state than after construction.</div>
</section>
</li>
</ul>
</section>
</li>
</ul>
</section>
<!-- ========= END OF CLASS DATA ========= -->
</main>
</div>
</div>
</body>
</html>