blob: 3191a101f4070a8ad5d53d3d2f37c694b677c005 [file] [log] [blame]
<!DOCTYPE HTML>
<!-- NewPage -->
<html lang="en">
<head>
<!-- Generated by javadoc (11.0.4) on Fri Sep 20 12:10:30 CEST 2019 -->
<title>PixelIterator (Apache SIS 1.0 API)</title>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<meta name="dc.created" content="2019-09-20">
<meta name="keywords" content="org.apache.sis.image.PixelIterator class">
<meta name="keywords" content="create()">
<meta name="keywords" content="isWritable()">
<meta name="keywords" content="getTransferType()">
<meta name="keywords" content="getSampleRanges()">
<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="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="../../../../jquery/jquery-ui.css" title="Style">
<script type="text/javascript" src="../../../../script.js"></script>
<script type="text/javascript" src="../../../../jquery/jszip/dist/jszip.min.js"></script>
<script type="text/javascript" src="../../../../jquery/jszip-utils/dist/jszip-utils.min.js"></script>
<!--[if IE]>
<script type="text/javascript" src="../../../../jquery/jszip-utils/dist/jszip-utils-ie.min.js"></script>
<![endif]-->
<script type="text/javascript" src="../../../../jquery/jquery-3.3.1.js"></script>
<script type="text/javascript" src="../../../../jquery/jquery-migrate-3.0.1.js"></script>
<script type="text/javascript" src="../../../../jquery/jquery-ui.js"></script>
</head>
<body>
<script type="text/javascript"><!--
try {
if (location.href.indexOf('is-external=true') == -1) {
parent.document.title="PixelIterator (Apache SIS 1.0 API)";
}
}
catch(err) {
}
//-->
var data = {"i0":9,"i1":6,"i2":10,"i3":10,"i4":6,"i5":6,"i6":6,"i7":6,"i8":6,"i9":6,"i10":6,"i11":10,"i12":10,"i13":10,"i14":6,"i15":6,"i16":6};
var tabs = {65535:["t0","All Methods"],1:["t1","Static Methods"],2:["t2","Instance Methods"],4:["t3","Abstract Methods"],8:["t4","Concrete Methods"]};
var altColor = "altColor";
var rowColor = "rowColor";
var tableTab = "tableTab";
var activeTableTab = "activeTableTab";
var pathtoroot = "../../../../";
var useModuleDirectories = false;
loadScripts(document, 'script');</script>
<noscript>
<div>JavaScript is disabled on your browser.</div>
</noscript>
<header role="banner">
<nav role="navigation">
<div class="fixedNav">
<!-- ========= START OF TOP NAVBAR ======= -->
<div class="topNav"><a id="navbar.top">
<!-- -->
</a>
<div class="skipNav"><a href="#skip.navbar.top" title="Skip navigation links">Skip navigation links</a></div>
<a id="navbar.top.firstrow">
<!-- -->
</a>
<ul class="navList" title="Navigation">
<li><a href="../../../../index.html">Overview</a></li>
<li><a href="package-summary.html">Package</a></li>
<li class="navBarCell1Rev">Class</li>
<li><a href="class-use/PixelIterator.html">Use</a></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">Help</a></li>
</ul>
</div>
<div class="subNav">
<ul class="navList" id="allclasses_navbar_top">
<li><a href="../../../../allclasses.html">All&nbsp;Classes</a></li>
</ul>
<ul class="navListSearch">
<li><label for="search">SEARCH:</label>
<input type="text" id="search" value="search" disabled="disabled">
<input type="reset" id="reset" value="reset" disabled="disabled">
</li>
</ul>
<div>
<script type="text/javascript"><!--
allClassesLink = document.getElementById("allclasses_navbar_top");
if(window==top) {
allClassesLink.style.display = "block";
}
else {
allClassesLink.style.display = "none";
}
//-->
</script>
<noscript>
<div>JavaScript is disabled on your browser.</div>
</noscript>
</div>
<div>
<ul class="subNavList">
<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="subNavList">
<li>Detail:&nbsp;</li>
<li>Field&nbsp;|&nbsp;</li>
<li>Constr&nbsp;|&nbsp;</li>
<li><a href="#method.detail">Method</a></li>
</ul>
</div>
<a id="skip.navbar.top">
<!-- -->
</a></div>
<!-- ========= END OF TOP NAVBAR ========= -->
</div>
<div class="navPadding">&nbsp;</div>
<script type="text/javascript"><!--
$('.navPadding').css('padding-top', $('.fixedNav').css("height"));
//-->
</script>
</nav>
</header>
<!-- ======== START OF CLASS DATA ======== -->
<main role="main">
<div class="header">
<div class="subTitle"><span class="packageLabelInType">Package</span>&nbsp;<a href="package-summary.html">org.apache.sis.image</a></div>
<h2 title="Class PixelIterator" class="title">Class PixelIterator</h2>
</div>
<div class="contentContainer">
<ul class="inheritance">
<li><a href="https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html?is-external=true" title="class or interface in java.lang" class="externalLink">Object</a></li>
<li>
<ul class="inheritance">
<li>PixelIterator</li>
</ul>
</li>
</ul>
<div class="description">
<ul class="blockList">
<li class="blockList">
<dl>
<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>
<pre>public abstract class <span class="typeNameLabel">PixelIterator</span>
extends <a href="https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html?is-external=true" title="class or interface in java.lang" class="externalLink">Object</a></pre>
<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/javase/8/docs/api/java/awt/image/RenderedImage.html?is-external=true#getTile(int,int)" title="class or interface in java.awt.image" class="externalLink">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/javase/8/docs/api/java/awt/image/SampleModel.html?is-external=true" title="class or interface in java.awt.image" class="externalLink">sample models</a>.
<div class="note"><b>Example:</b>
<blockquote><pre>PixelIterator it = PixelIterator.<b>create</b>(image);
<font color="green">double</font>[] samples = <font color="green">null</font>;
<font color="green">while</font> (it.<b>next</b>()) {
samples = it.<b>getPixel</b>(samples); <i><font color="gray">// Get values in all bands.</font></i>
<i><font color="gray">// Perform computation here...</font></i>
}</pre></blockquote>
</div></div>
<dl>
<dt><span class="simpleTagLabel">Since:</span></dt>
<dd>1.0</dd>
<p><font size="-1">Defined in the <code>sis-feature</code> module</font></p>
</dl>
</li>
</ul>
</div>
<div class="summary">
<ul class="blockList">
<li class="blockList">
<!-- ======== NESTED CLASS SUMMARY ======== -->
<section role="region">
<ul class="blockList">
<li class="blockList"><a id="nested.class.summary">
<!-- -->
</a>
<h3>Nested Class Summary</h3>
<table class="memberSummary">
<caption><span>Nested Classes</span><span class="tabEnd">&nbsp;</span></caption>
<tr>
<th class="colFirst" scope="col">Modifier and Type</th>
<th class="colSecond" scope="col">Class</th>
<th class="colLast" scope="col">Description</th>
</tr>
<tr class="altColor">
<td class="colFirst"><code>static class&nbsp;</code></td>
<th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="PixelIterator.Builder.html" title="class in org.apache.sis.image">PixelIterator.Builder</a></span></code></th>
<td class="colLast">
<div class="block">Builds pixel iterators for specified region of interest, window size or iteration order.</div>
</td>
</tr>
<tr class="rowColor">
<td class="colFirst"><code>static class&nbsp;</code></td>
<th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="PixelIterator.Window.html" title="class in org.apache.sis.image">PixelIterator.Window</a>&lt;<a href="PixelIterator.Window.html" title="type parameter in PixelIterator.Window">T</a> extends <a href="https://docs.oracle.com/javase/8/docs/api/java/nio/Buffer.html?is-external=true" title="class or interface in java.nio" class="externalLink">Buffer</a>&gt;</span></code></th>
<td class="colLast">
<div class="block">Contains the sample values in a moving window over the image.</div>
</td>
</tr>
</table>
</li>
</ul>
</section>
<!-- ========== METHOD SUMMARY =========== -->
<section role="region">
<ul class="blockList">
<li class="blockList"><a id="method.summary">
<!-- -->
</a>
<h3>Method Summary</h3>
<table class="memberSummary">
<caption><span id="t0" class="activeTableTab"><span>All Methods</span><span class="tabEnd">&nbsp;</span></span><span id="t1" class="tableTab"><span><a href="javascript:show(1);">Static Methods</a></span><span class="tabEnd">&nbsp;</span></span><span id="t2" class="tableTab"><span><a href="javascript:show(2);">Instance Methods</a></span><span class="tabEnd">&nbsp;</span></span><span id="t3" class="tableTab"><span><a href="javascript:show(4);">Abstract Methods</a></span><span class="tabEnd">&nbsp;</span></span><span id="t4" class="tableTab"><span><a href="javascript:show(8);">Concrete Methods</a></span><span class="tabEnd">&nbsp;</span></span></caption>
<tr>
<th class="colFirst" scope="col">Modifier and Type</th>
<th class="colSecond" scope="col">Method</th>
<th class="colLast" scope="col">Description</th>
</tr>
<tr id="i0" class="altColor">
<td class="colFirst"><code>static <a href="PixelIterator.html" title="class in org.apache.sis.image">PixelIterator</a></code></td>
<th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#create(java.awt.image.RenderedImage)">create</a></span>&#8203;(<a href="https://docs.oracle.com/javase/8/docs/api/java/awt/image/RenderedImage.html?is-external=true" title="class or interface in java.awt.image" class="externalLink">RenderedImage</a>&nbsp;data)</code></th>
<td class="colLast">
<div class="block">Creates an iterator for all pixels in the given image.</div>
</td>
</tr>
<tr id="i1" class="rowColor">
<td class="colFirst"><code>abstract &lt;T extends <a href="https://docs.oracle.com/javase/8/docs/api/java/nio/Buffer.html?is-external=true" title="class or interface in java.nio" class="externalLink">Buffer</a>&gt;<br><a href="PixelIterator.Window.html" title="class in org.apache.sis.image">PixelIterator.Window</a>&lt;T&gt;</code></td>
<th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#createWindow(org.apache.sis.image.TransferType)">createWindow</a></span>&#8203;(<a href="TransferType.html" title="class in org.apache.sis.image">TransferType</a>&lt;T&gt;&nbsp;type)</code></th>
<td class="colLast">
<div class="block">Returns a moving window over the sample values in a rectangular region starting at iterator position.</div>
</td>
</tr>
<tr id="i2" class="altColor">
<td class="colFirst"><code><a href="https://docs.oracle.com/javase/8/docs/api/java/awt/Rectangle.html?is-external=true" title="class or interface in java.awt" class="externalLink">Rectangle</a></code></td>
<th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#getDomain()">getDomain</a></span>()</code></th>
<td class="colLast">
<div class="block">Returns the pixel coordinates of the region where this iterator is doing the iteration.</div>
</td>
</tr>
<tr id="i3" class="rowColor">
<td class="colFirst"><code>int</code></td>
<th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#getNumBands()">getNumBands</a></span>()</code></th>
<td class="colLast">
<div class="block">Returns the number of bands (samples per pixel) in the image or raster.</div>
</td>
</tr>
<tr id="i4" class="altColor">
<td class="colFirst"><code>abstract double[]</code></td>
<th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#getPixel(double%5B%5D)">getPixel</a></span>&#8203;(double[]&nbsp;dest)</code></th>
<td class="colLast">
<div class="block">Returns the sample values of current pixel for all bands.</div>
</td>
</tr>
<tr id="i5" class="rowColor">
<td class="colFirst"><code>abstract float[]</code></td>
<th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#getPixel(float%5B%5D)">getPixel</a></span>&#8203;(float[]&nbsp;dest)</code></th>
<td class="colLast">
<div class="block">Returns the sample values of current pixel for all bands.</div>
</td>
</tr>
<tr id="i6" class="altColor">
<td class="colFirst"><code>abstract int[]</code></td>
<th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#getPixel(int%5B%5D)">getPixel</a></span>&#8203;(int[]&nbsp;dest)</code></th>
<td class="colLast">
<div class="block">Returns the sample values of current pixel for all bands.</div>
</td>
</tr>
<tr id="i7" class="rowColor">
<td class="colFirst"><code>abstract <a href="https://docs.oracle.com/javase/8/docs/api/java/awt/Point.html?is-external=true" title="class or interface in java.awt" class="externalLink">Point</a></code></td>
<th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#getPosition()">getPosition</a></span>()</code></th>
<td class="colLast">
<div class="block">Returns the column (x) and row (y) indices of the current pixel.</div>
</td>
</tr>
<tr id="i8" class="altColor">
<td class="colFirst"><code>abstract int</code></td>
<th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#getSample(int)">getSample</a></span>&#8203;(int&nbsp;band)</code></th>
<td class="colLast">
<div class="block">Returns the sample value in the specified band of current pixel, rounded toward zero.</div>
</td>
</tr>
<tr id="i9" class="rowColor">
<td class="colFirst"><code>abstract double</code></td>
<th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#getSampleDouble(int)">getSampleDouble</a></span>&#8203;(int&nbsp;band)</code></th>
<td class="colLast">
<div class="block">Returns the sample value in the specified band of current pixel, without precision lost.</div>
</td>
</tr>
<tr id="i10" class="altColor">
<td class="colFirst"><code>abstract float</code></td>
<th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#getSampleFloat(int)">getSampleFloat</a></span>&#8203;(int&nbsp;band)</code></th>
<td class="colLast">
<div class="block">Returns the sample value in the specified band of current pixel as a single-precision floating point number.</div>
</td>
</tr>
<tr id="i11" class="rowColor">
<td class="colFirst"><code><a href="../measure/NumberRange.html" title="class in org.apache.sis.measure">NumberRange</a>&lt;?&gt;[]</code></td>
<th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#getSampleRanges()">getSampleRanges</a></span>()</code></th>
<td class="colLast">
<div class="block">Returns the range of sample values that can be stored in each band of the rendered image or raster.</div>
</td>
</tr>
<tr id="i12" class="altColor">
<td class="colFirst"><code><a href="TransferType.html" title="class in org.apache.sis.image">TransferType</a>&lt;?&gt;</code></td>
<th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#getTransferType()">getTransferType</a></span>()</code></th>
<td class="colLast">
<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>
</td>
</tr>
<tr id="i13" class="rowColor">
<td class="colFirst"><code>boolean</code></td>
<th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#isWritable()">isWritable</a></span>()</code></th>
<td class="colLast">
<div class="block">Returns <code>true</code> if this iterator can write pixel values (after cast to <code>Writable­Pixel­Iterator</code>).</div>
</td>
</tr>
<tr id="i14" class="altColor">
<td class="colFirst"><code>abstract void</code></td>
<th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#moveTo(int,int)">moveTo</a></span>&#8203;(int&nbsp;x,
int&nbsp;y)</code></th>
<td class="colLast">
<div class="block">Moves the pixel iterator to the given column (x) and row (y) indices.</div>
</td>
</tr>
<tr id="i15" class="rowColor">
<td class="colFirst"><code>abstract boolean</code></td>
<th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#next()">next</a></span>()</code></th>
<td class="colLast">
<div class="block">Moves the iterator to the next pixel.</div>
</td>
</tr>
<tr id="i16" class="altColor">
<td class="colFirst"><code>abstract void</code></td>
<th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#rewind()">rewind</a></span>()</code></th>
<td class="colLast">
<div class="block">Restores the iterator to the start position.</div>
</td>
</tr>
</table>
<ul class="blockList">
<li class="blockList"><a id="methods.inherited.from.class.Object">
<!-- -->
</a>
<h3>Methods inherited from class&nbsp;<a href="https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html?is-external=true" title="class or interface in java.lang" class="externalLink">Object</a></h3>
<code><a href="https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html?is-external=true#clone()" title="class or interface in java.lang" class="externalLink">clone</a>, <a href="https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html?is-external=true#equals(java.lang.Object)" title="class or interface in java.lang" class="externalLink">equals</a>, <a href="https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html?is-external=true#finalize()" title="class or interface in java.lang" class="externalLink">finalize</a>, <a href="https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html?is-external=true#getClass()" title="class or interface in java.lang" class="externalLink">get­Class</a>, <a href="https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html?is-external=true#hashCode()" title="class or interface in java.lang" class="externalLink">hash­Code</a>, <a href="https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html?is-external=true#notify()" title="class or interface in java.lang" class="externalLink">notify</a>, <a href="https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html?is-external=true#notifyAll()" title="class or interface in java.lang" class="externalLink">notify­All</a>, <a href="https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html?is-external=true#toString()" title="class or interface in java.lang" class="externalLink">to­String</a>, <a href="https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html?is-external=true#wait()" title="class or interface in java.lang" class="externalLink">wait</a>, <a href="https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html?is-external=true#wait(long)" title="class or interface in java.lang" class="externalLink">wait</a>, <a href="https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html?is-external=true#wait(long,int)" title="class or interface in java.lang" class="externalLink">wait</a></code></li>
</ul>
</li>
</ul>
</section>
</li>
</ul>
</div>
<div class="details">
<ul class="blockList">
<li class="blockList">
<!-- ============ METHOD DETAIL ========== -->
<section role="region">
<ul class="blockList">
<li class="blockList"><a id="method.detail">
<!-- -->
</a>
<h3>Method Detail</h3>
<a id="create(java.awt.image.RenderedImage)">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>create</h4>
<pre class="methodSignature">public static&nbsp;<a href="PixelIterator.html" title="class in org.apache.sis.image">PixelIterator</a>&nbsp;create&#8203;(<a href="https://docs.oracle.com/javase/8/docs/api/java/awt/image/RenderedImage.html?is-external=true" title="class or interface in java.awt.image" class="externalLink">RenderedImage</a>&nbsp;data)</pre>
<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>
<dt><span class="paramLabel">Parameters:</span></dt>
<dd><code>data</code> - the image which contains the sample values on which to iterate.</dd>
<dt><span class="returnLabel">Returns:</span></dt>
<dd>a new iterator traversing all pixels in the given image, in arbitrary order.</dd>
</dl>
</li>
</ul>
<a id="isWritable()">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>isWritable</h4>
<pre class="methodSignature">public&nbsp;boolean&nbsp;isWritable()</pre>
<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 than <code>instanceof</code> check because, for some implementations, being
an instance of <code>Writable­Pixel­Iterator</code> is not a sufficient condition.</div>
<dl>
<dt><span class="returnLabel">Returns:</span></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>
</li>
</ul>
<a id="getTransferType()">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>getTransferType</h4>
<pre class="methodSignature">public&nbsp;<a href="TransferType.html" title="class in org.apache.sis.image">TransferType</a>&lt;?&gt;&nbsp;getTransferType()</pre>
<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>
<dt><span class="returnLabel">Returns:</span></dt>
<dd>the most efficient data type for transferring data.</dd>
</dl>
</li>
</ul>
<a id="getSampleRanges()">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>getSampleRanges</h4>
<pre class="methodSignature">public&nbsp;<a href="../measure/NumberRange.html" title="class in org.apache.sis.measure">NumberRange</a>&lt;?&gt;[]&nbsp;getSampleRanges()</pre>
<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/javase/8/docs/api/java/awt/image/SinglePixelPackedSampleModel.html?is-external=true" title="class or interface in java.awt.image" class="externalLink"><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>
<dt><span class="returnLabel">Returns:</span></dt>
<dd>the ranges of valid sample values for each band. Ranges may be <a href="../measure/Range.html#isBounded()">unbounded</a>.</dd>
</dl>
</li>
</ul>
<a id="getNumBands()">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>getNumBands</h4>
<pre class="methodSignature">public&nbsp;int&nbsp;getNumBands()</pre>
<div class="block">Returns the number of bands (samples per pixel) in the image or raster.</div>
<dl>
<dt><span class="returnLabel">Returns:</span></dt>
<dd>number of bands.</dd>
</dl>
</li>
</ul>
<a id="getDomain()">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>getDomain</h4>
<pre class="methodSignature">public&nbsp;<a href="https://docs.oracle.com/javase/8/docs/api/java/awt/Rectangle.html?is-external=true" title="class or interface in java.awt" class="externalLink">Rectangle</a>&nbsp;getDomain()</pre>
<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>
<dt><span class="returnLabel">Returns:</span></dt>
<dd>pixel coordinates of the iteration region.</dd>
</dl>
</li>
</ul>
<a id="getPosition()">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>getPosition</h4>
<pre class="methodSignature">public abstract&nbsp;<a href="https://docs.oracle.com/javase/8/docs/api/java/awt/Point.html?is-external=true" title="class or interface in java.awt" class="externalLink">Point</a>&nbsp;getPosition()</pre>
<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>
<dt><span class="returnLabel">Returns:</span></dt>
<dd>column and row indices of current iterator position.</dd>
<dt><span class="throwsLabel">Throws:</span></dt>
<dd><code><a href="https://docs.oracle.com/javase/8/docs/api/java/lang/IllegalStateException.html?is-external=true" title="class or interface in java.lang" class="externalLink">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>
</li>
</ul>
<a id="moveTo(int,int)">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>moveTo</h4>
<pre class="methodSignature">public abstract&nbsp;void&nbsp;moveTo&#8203;(int&nbsp;x,
int&nbsp;y)</pre>
<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.
<div class="note"><b>Usage example:</b>
<blockquote><pre>iterator.<b>moveTo</b>(x, y);
<font color="green">do</font> {
<font color="green">int</font> sample = iterator.<b>getSample</b>(band);
<i><font color="gray">// Use sample value here...</font></i>
} <font color="green">while</font> (iterator.<b>next</b>());</pre></blockquote>
</div></div>
<dl>
<dt><span class="paramLabel">Parameters:</span></dt>
<dd><code>x</code> - the column index of the pixel to make current.</dd>
<dd><code>y</code> - the row index of the pixel to make current.</dd>
<dt><span class="throwsLabel">Throws:</span></dt>
<dd><code><a href="https://docs.oracle.com/javase/8/docs/api/java/lang/IndexOutOfBoundsException.html?is-external=true" title="class or interface in java.lang" class="externalLink">Index­Out­Of­Bounds­Exception</a></code> - if the given indices are outside the iteration domain.</dd>
</dl>
</li>
</ul>
<a id="next()">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>next</h4>
<pre class="methodSignature">public abstract&nbsp;boolean&nbsp;next()</pre>
<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/javase/8/docs/api/java/util/NoSuchElementException.html?is-external=true" title="class or interface in java.util" class="externalLink"><code>No­Such­Element­Exception</code></a> to be
thrown.</p></div>
<dl>
<dt><span class="returnLabel">Returns:</span></dt>
<dd><code>true</code> if the current pixel is valid, or <code>false</code> if there is no more pixels.</dd>
<dt><span class="throwsLabel">Throws:</span></dt>
<dd><code><a href="https://docs.oracle.com/javase/8/docs/api/java/lang/IllegalStateException.html?is-external=true" title="class or interface in java.lang" class="externalLink">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>
</li>
</ul>
<a id="getSample(int)">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>getSample</h4>
<pre class="methodSignature">public abstract&nbsp;int&nbsp;getSample&#8203;(int&nbsp;band)</pre>
<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>
<dt><span class="paramLabel">Parameters:</span></dt>
<dd><code>band</code> - the band for which to get the sample value.</dd>
<dt><span class="returnLabel">Returns:</span></dt>
<dd>sample value in specified band of current pixel.</dd>
<dt><span class="seeLabel">See Also:</span></dt>
<dd><a href="https://docs.oracle.com/javase/8/docs/api/java/awt/image/Raster.html?is-external=true#getSample(int,int,int)" title="class or interface in java.awt.image" class="externalLink"><code>Raster​.get­Sample(int, int, int)</code></a></dd>
</dl>
</li>
</ul>
<a id="getSampleFloat(int)">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>getSampleFloat</h4>
<pre class="methodSignature">public abstract&nbsp;float&nbsp;getSampleFloat&#8203;(int&nbsp;band)</pre>
<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>
<dt><span class="paramLabel">Parameters:</span></dt>
<dd><code>band</code> - the band for which to get the sample value.</dd>
<dt><span class="returnLabel">Returns:</span></dt>
<dd>sample value in specified band of current pixel.</dd>
<dt><span class="seeLabel">See Also:</span></dt>
<dd><a href="https://docs.oracle.com/javase/8/docs/api/java/awt/image/Raster.html?is-external=true#getSampleFloat(int,int,int)" title="class or interface in java.awt.image" class="externalLink"><code>Raster​.get­Sample­Float(int, int, int)</code></a></dd>
</dl>
</li>
</ul>
<a id="getSampleDouble(int)">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>getSampleDouble</h4>
<pre class="methodSignature">public abstract&nbsp;double&nbsp;getSampleDouble&#8203;(int&nbsp;band)</pre>
<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>
<dt><span class="paramLabel">Parameters:</span></dt>
<dd><code>band</code> - the band for which to get the sample value.</dd>
<dt><span class="returnLabel">Returns:</span></dt>
<dd>sample value in specified band of current pixel.</dd>
<dt><span class="seeLabel">See Also:</span></dt>
<dd><a href="https://docs.oracle.com/javase/8/docs/api/java/awt/image/Raster.html?is-external=true#getSampleDouble(int,int,int)" title="class or interface in java.awt.image" class="externalLink"><code>Raster​.get­Sample­Double(int, int, int)</code></a></dd>
</dl>
</li>
</ul>
<a id="getPixel(int[])">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>getPixel</h4>
<pre class="methodSignature">public abstract&nbsp;int[]&nbsp;getPixel&#8203;(int[]&nbsp;dest)</pre>
<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>
<dt><span class="paramLabel">Parameters:</span></dt>
<dd><code>dest</code> - a pre-allocated array where to store the sample values, or <code>null</code> if none.</dd>
<dt><span class="returnLabel">Returns:</span></dt>
<dd>the sample values for current pixel.</dd>
<dt><span class="seeLabel">See Also:</span></dt>
<dd><a href="https://docs.oracle.com/javase/8/docs/api/java/awt/image/Raster.html?is-external=true#getPixel(int,int,int%5B%5D)" title="class or interface in java.awt.image" class="externalLink"><code>Raster​.get­Pixel(int, int, int[])</code></a></dd>
</dl>
</li>
</ul>
<a id="getPixel(float[])">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>getPixel</h4>
<pre class="methodSignature">public abstract&nbsp;float[]&nbsp;getPixel&#8203;(float[]&nbsp;dest)</pre>
<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>
<dt><span class="paramLabel">Parameters:</span></dt>
<dd><code>dest</code> - a pre-allocated array where to store the sample values, or <code>null</code> if none.</dd>
<dt><span class="returnLabel">Returns:</span></dt>
<dd>the sample values for current pixel.</dd>
<dt><span class="seeLabel">See Also:</span></dt>
<dd><a href="https://docs.oracle.com/javase/8/docs/api/java/awt/image/Raster.html?is-external=true#getPixel(int,int,float%5B%5D)" title="class or interface in java.awt.image" class="externalLink"><code>Raster​.get­Pixel(int, int, float[])</code></a></dd>
</dl>
</li>
</ul>
<a id="getPixel(double[])">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>getPixel</h4>
<pre class="methodSignature">public abstract&nbsp;double[]&nbsp;getPixel&#8203;(double[]&nbsp;dest)</pre>
<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>
<dt><span class="paramLabel">Parameters:</span></dt>
<dd><code>dest</code> - a pre-allocated array where to store the sample values, or <code>null</code> if none.</dd>
<dt><span class="returnLabel">Returns:</span></dt>
<dd>the sample values for current pixel.</dd>
<dt><span class="seeLabel">See Also:</span></dt>
<dd><a href="https://docs.oracle.com/javase/8/docs/api/java/awt/image/Raster.html?is-external=true#getPixel(int,int,double%5B%5D)" title="class or interface in java.awt.image" class="externalLink"><code>Raster​.get­Pixel(int, int, double[])</code></a></dd>
</dl>
</li>
</ul>
<a id="createWindow(org.apache.sis.image.TransferType)">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>createWindow</h4>
<pre class="methodSignature">public abstract&nbsp;&lt;T extends <a href="https://docs.oracle.com/javase/8/docs/api/java/nio/Buffer.html?is-external=true" title="class or interface in java.nio" class="externalLink">Buffer</a>&gt;&nbsp;<a href="PixelIterator.Window.html" title="class in org.apache.sis.image">PixelIterator.Window</a>&lt;T&gt;&nbsp;createWindow&#8203;(<a href="TransferType.html" title="class in org.apache.sis.image">TransferType</a>&lt;T&gt;&nbsp;type)</pre>
<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 <code>Sequence­Type​.LINEAR</code>.</p>
<div class="note"><b>Usage example:</b>
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.
<blockquote><pre>PixelIterator it = <b>create</b>(image, <font color="green">null</font>, <font color="green">new</font> <b>Dimension</b>(5, 5), <font color="green">null</font>); <i><font color="gray">// Windows size will be 5×5 pixels.</font></i>
PixelIterator&lt;FloatBuffer&gt; window = it.<b>createWindow</b>(TransferType.FLOAT);
FloatBuffer values = window.values;
<font color="green">while</font> (it.<b>next</b>()) {
window.<b>update</b>();
<font color="green">while</font> (buffer.<b>hasRemaining</b>()) {
<font color="green">float</font> sample = buffer.<b>get</b>();
<i><font color="gray">// use the sample value here.</font></i>
}
}</pre></blockquote>
</div></div>
<dl>
<dt><span class="paramLabel">Type Parameters:</span></dt>
<dd><code>T</code> - the type of the data buffer to use for transferring data.</dd>
<dt><span class="paramLabel">Parameters:</span></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><span class="returnLabel">Returns:</span></dt>
<dd>a window over the sample values in the underlying image or raster.</dd>
<dt><span class="seeLabel">See Also:</span></dt>
<dd><a href="https://docs.oracle.com/javase/8/docs/api/java/awt/image/Raster.html?is-external=true#getPixels(int,int,int,int,double%5B%5D)" title="class or interface in java.awt.image" class="externalLink"><code>Raster​.get­Pixels(int, int, int, int, double[])</code></a></dd>
</dl>
</li>
</ul>
<a id="rewind()">
<!-- -->
</a>
<ul class="blockListLast">
<li class="blockList">
<h4>rewind</h4>
<pre class="methodSignature">public abstract&nbsp;void&nbsp;rewind()</pre>
<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>
</li>
</ul>
</li>
</ul>
</section>
</li>
</ul>
</div>
</div>
</main>
<!-- ========= END OF CLASS DATA ========= -->
<footer role="contentinfo">
<nav role="navigation">
<!-- ======= START OF BOTTOM NAVBAR ====== -->
<div class="bottomNav"><a id="navbar.bottom">
<!-- -->
</a>
<div class="skipNav"><a href="#skip.navbar.bottom" title="Skip navigation links">Skip navigation links</a></div>
<a id="navbar.bottom.firstrow">
<!-- -->
</a>
<ul class="navList" title="Navigation">
<li><a href="../../../../index.html">Overview</a></li>
<li><a href="package-summary.html">Package</a></li>
<li class="navBarCell1Rev">Class</li>
<li><a href="class-use/PixelIterator.html">Use</a></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">Help</a></li>
</ul>
</div>
<div class="subNav">
<ul class="navList" id="allclasses_navbar_bottom">
<li><a href="../../../../allclasses.html">All&nbsp;Classes</a></li>
</ul>
<div>
<script type="text/javascript"><!--
allClassesLink = document.getElementById("allclasses_navbar_bottom");
if(window==top) {
allClassesLink.style.display = "block";
}
else {
allClassesLink.style.display = "none";
}
//-->
</script>
<noscript>
<div>JavaScript is disabled on your browser.</div>
</noscript>
</div>
<div>
<ul class="subNavList">
<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="subNavList">
<li>Detail:&nbsp;</li>
<li>Field&nbsp;|&nbsp;</li>
<li>Constr&nbsp;|&nbsp;</li>
<li><a href="#method.detail">Method</a></li>
</ul>
</div>
<a id="skip.navbar.bottom">
<!-- -->
</a></div>
<!-- ======== END OF BOTTOM NAVBAR ======= -->
</nav>
<p class="legalCopy"><small>Copyright &#169; 2010&#x2013;2019 <a href="https://www.apache.org/">The Apache Software Foundation</a>. All rights reserved.</small></p>
</footer>
</body>
</html>